Fix timing of dynamic baked model registry handoff

This commit is contained in:
embeddedt 2023-07-19 17:31:24 -04:00
parent d1a1fce7e1
commit ad60b1dec6
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
3 changed files with 4 additions and 1 deletions

View File

@ -73,7 +73,8 @@ public class DynamicBakedModelProvider implements Map<ResourceLocation, BakedMod
this.bakery = bakery;
this.bakedCache = cache;
this.permanentOverrides = Collections.synchronizedMap(new Object2ObjectOpenHashMap<>());
currentInstance = this;
if(currentInstance == null)
currentInstance = this;
}
public void setMissingModel(BakedModel model) {

View File

@ -350,6 +350,7 @@ public abstract class ModelBakeryMixin implements IExtendedModelBakery {
this.topLevelModels.clear();
this.topLevelModels.put(MISSING_MODEL_LOCATION, this.missingModel);
this.smallLoadingCache.clear();
DynamicBakedModelProvider.currentInstance = (DynamicBakedModelProvider)this.bakedTopLevelModels;
}
/**

View File

@ -203,6 +203,7 @@ public abstract class ModelBakeryMixin implements IExtendedModelBakery {
profiler.pop();
// ensure missing model is a permanent override
this.bakedTopLevelModels.put(MISSING_MODEL_LOCATION, this.getBakedModel(MISSING_MODEL_LOCATION, BlockModelRotation.X0_Y0, this.atlasSet::getSprite));
DynamicBakedModelProvider.currentInstance = (DynamicBakedModelProvider)this.bakedTopLevelModels;
cir.setReturnValue(atlasSet);
}