Actually cache item models

This commit is contained in:
embeddedt 2023-05-03 21:40:57 -04:00
parent 545c68f122
commit 65f151bbef
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -257,9 +257,16 @@ public abstract class ModelBakeryMixin implements IExtendedModelBakery {
@Override
public BakedModel bakeDefault(ResourceLocation modelLocation) {
ModelBakery.BakedCacheKey key = new ModelBakery.BakedCacheKey(modelLocation, BlockModelRotation.X0_Y0.getRotation(), BlockModelRotation.X0_Y0.isUvLocked());
BakedModel m = loadedBakedModels.getIfPresent(key);
if(m != null)
return m;
ModelBakery self = (ModelBakery) (Object) this;
ModelBaker theBaker = self.new ModelBakerImpl(textureGetter, modelLocation);
return theBaker.bake(modelLocation, BlockModelRotation.X0_Y0);
m = theBaker.bake(modelLocation, BlockModelRotation.X0_Y0);
if(m != null)
loadedBakedModels.put(key, m);
return m;
}
@Override