ModernFix

ModernFix

2M Downloads

Missing models are unidentifiable with Dynamic Resources.

Estecka opened this issue ยท 3 comments

commented

Bug Description

Hi,

I'm the creator of a mod called Invariable Paintings. This mod adds new item models for each painting variant in the game, which are conditionally applied to the vanilla painting item. (Those models work fine, even with Dynamic Resources.)
I support modded paintings, but those don't come bundled with the corresponding item models. I don't consider these missing models to be an error, instead I have a built-in default model, which is used for any variant with no model of its own.

This fallback model is the only model that does not work with Dynamic Resources. It doesn't prevent the model from being loaded, but messes with the logic that decides when it should be used:

BakedModel model = modelManager.getModel(Cits.OfPainting(variantId));

if (model != modelManager.getMissingModel()) // This condition is always true with Dynamic Resources
	return model;
else
	return modelManager.getModel(Cits.CIT_FILLED); // Intended fallback.

(Full code, yarn mappings)

It seems Dynamic Resources generates missing models whose identity is different from the one returned by getMissingModel, making them undetectable.

Reproduction Steps

  • Enable Dynamic Resources.
  • Install Invariable Paintings v2.1.0+1.21. Dependencies are not required
  • Install any datapack (or mod) that adds new painting variants to the game. Corresponding texturepack is not required.
  • In-game, search "Painting" in the creative inventory. Scroll down until you find the newly added ones.

Behaviours without (top) and with (bottom) dynamic resources:
Modernfix

Log File

The log doesn't seem to contains anything of note. There are some warnings about the added paintings not having a model, but I'd say those are expected. Presumably they occur on the first line of the code snippet above.
latest.log

commented

I will see what I can do about this; missing model identity is really annoying to preserve in some cases, which is why I stopped caring about it in the 1.21 rewrite of this option, but I'll see if it can be reintroduced without too much trouble.

commented

783627f seems enough to fix your specific scenario, will release 5.18.7 in a few minutes.

commented

Released 5.18.7 with the fix; it turned out to be quite simple to handle, I had forgotten a design change to how I load models.