diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java index 1fc642db9..dc6292f45 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java @@ -32,6 +32,8 @@ public abstract class AbstractBakedModel implements BakedModel { protected final ModelBakeSettings settings; private final List templateBakedModels; + + public static boolean reloading = false; public AbstractBakedModel(ModelBakeSettings settings, List templateBakedModels) { this.settings = settings; this.templateBakedModels = templateBakedModels; diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ModelHelper.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ModelHelper.java index 15df269ab..bb03f9a11 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ModelHelper.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ModelHelper.java @@ -79,8 +79,8 @@ public static BlockType getBlockType(Identifier identifier) { return BlockType.BLOCK; } - public static VariantBase getVariant(Identifier identifier) { - VariantBase var = getExtraCounterType(identifier); + public static VariantBase getVariant(Identifier identifier) { + VariantBase var = getExtraCounterType(identifier); if (var == null) { var = getStoneType(identifier); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/UnbakedCoffeeBasicTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/UnbakedCoffeeBasicTableModel.java index c3fa164b4..e389085db 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/UnbakedCoffeeBasicTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/UnbakedCoffeeBasicTableModel.java @@ -6,6 +6,8 @@ import com.unlikepaladin.pfm.data.materials.StoneVariantRegistry; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -68,23 +70,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(TABLE_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(TABLE_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : BASIC_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(TABLE_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/UnbakedBasicLampModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/UnbakedBasicLampModel.java index 5a4b5edbb..5a5105c5f 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/UnbakedBasicLampModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/UnbakedBasicLampModel.java @@ -3,6 +3,8 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -70,23 +72,26 @@ public Collection getModelDependencies() { return Collections.singleton(PARENT); } - public static final Map> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(LAMP_MODEL_IDS.get(0)) && PFMRuntimeResources.modelCacheMap.get(LAMP_MODEL_IDS.get(0)).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(LAMP_MODEL_IDS.get(0), rotationContainer, PFMRuntimeResources.modelCacheMap.get(LAMP_MODEL_IDS.get(0)).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(LAMP_MODEL_IDS.get(0))) + PFMRuntimeResources.modelCacheMap.put(LAMP_MODEL_IDS.get(0), new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : ALL_MODEL_IDS) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(LAMP_MODEL_IDS.get(0)).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(LAMP_MODEL_IDS.get(0), rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/UnbakedBasicTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/UnbakedBasicTableModel.java index 7a2a4bfe7..c6338641c 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/UnbakedBasicTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/UnbakedBasicTableModel.java @@ -3,6 +3,8 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -66,19 +68,23 @@ public Collection getTextureDependencies(Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(TABLE_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(TABLE_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : BASIC_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(TABLE_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/UnbakedBedModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/UnbakedBedModel.java index 74d7542c4..9b4a5ce14 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/UnbakedBedModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/UnbakedBedModel.java @@ -4,6 +4,8 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -78,23 +80,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(BED_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(BED_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(BED_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(BED_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(BED_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(BED_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : BED_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(BED_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(BED_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier model, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/UnbakedChairModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/UnbakedChairModel.java index 7f1c3111a..34143d522 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/UnbakedChairModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/UnbakedChairModel.java @@ -6,6 +6,8 @@ import com.unlikepaladin.pfm.data.materials.StoneVariantRegistry; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -53,23 +55,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(CHAIR_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(CHAIR_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(CHAIR_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(CHAIR_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(CHAIR_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(CHAIR_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : CHAIR_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(CHAIR_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(CHAIR_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier model, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/UnbakedChairClassicModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/UnbakedChairClassicModel.java index fe4ea4ca7..0cc2f40c0 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/UnbakedChairClassicModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/UnbakedChairClassicModel.java @@ -6,6 +6,8 @@ import com.unlikepaladin.pfm.data.materials.StoneVariantRegistry; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -52,23 +54,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(CHAIR_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(CHAIR_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(CHAIR_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(CHAIR_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(CHAIR_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(CHAIR_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : CHAIR_CLASSIC_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(CHAIR_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(CHAIR_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/UnbakedChairDinnerModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/UnbakedChairDinnerModel.java index 590056a07..c19747013 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/UnbakedChairDinnerModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/UnbakedChairDinnerModel.java @@ -3,6 +3,8 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -50,23 +52,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(CHAIR_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(CHAIR_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(CHAIR_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(CHAIR_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(CHAIR_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(CHAIR_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : CHAIR_DINNER_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(CHAIR_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(CHAIR_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/UnbakedChairModernModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/UnbakedChairModernModel.java index 96f9741d2..f8f4aa5a9 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/UnbakedChairModernModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/UnbakedChairModernModel.java @@ -6,6 +6,8 @@ import com.unlikepaladin.pfm.data.materials.StoneVariantRegistry; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -52,23 +54,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(CHAIR_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(CHAIR_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(CHAIR_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(CHAIR_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(CHAIR_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(CHAIR_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : CHAIR_MODERN_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(CHAIR_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(CHAIR_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/UnbakedClassicCoffeeTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/UnbakedClassicCoffeeTableModel.java index db01b0a0e..28ff204da 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/UnbakedClassicCoffeeTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/UnbakedClassicCoffeeTableModel.java @@ -6,6 +6,8 @@ import com.unlikepaladin.pfm.data.materials.StoneVariantRegistry; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -58,23 +60,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(TABLE_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(TABLE_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : CLASSIC_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(TABLE_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/UnbakedClassicNightstandModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/UnbakedClassicNightstandModel.java index 62fca7518..d7b3013f4 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/UnbakedClassicNightstandModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/UnbakedClassicNightstandModel.java @@ -3,6 +3,8 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -56,23 +58,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(NIGHTSTAND_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(NIGHTSTAND_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(NIGHTSTAND_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(NIGHTSTAND_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(NIGHTSTAND_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(NIGHTSTAND_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : NIGHTSTAND_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(NIGHTSTAND_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(NIGHTSTAND_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/UnbakedClassicStoolModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/UnbakedClassicStoolModel.java index f560a4f5d..e23de6397 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/UnbakedClassicStoolModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/UnbakedClassicStoolModel.java @@ -6,6 +6,8 @@ import com.unlikepaladin.pfm.data.materials.StoneVariantRegistry; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -51,23 +53,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(STOOL_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(STOOL_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(STOOL_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(STOOL_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(STOOL_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(STOOL_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : CLASSIC_STOOL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(STOOL_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(STOOL_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/UnbakedClassicTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/UnbakedClassicTableModel.java index a0146058f..9643fce26 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/UnbakedClassicTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/UnbakedClassicTableModel.java @@ -3,6 +3,8 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -55,23 +57,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(TABLE_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(TABLE_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : CLASSIC_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(TABLE_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/UnbakedDinnerTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/UnbakedDinnerTableModel.java index 59c2b0e68..966097e77 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/UnbakedDinnerTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/UnbakedDinnerTableModel.java @@ -2,6 +2,8 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -53,23 +55,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(TABLE_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(TABLE_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : DINNER_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(TABLE_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/UnbakedKitchenCabinetModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/UnbakedKitchenCabinetModel.java index ba93a568e..b2a1eb49e 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/UnbakedKitchenCabinetModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/UnbakedKitchenCabinetModel.java @@ -2,6 +2,8 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -64,23 +66,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(CABINET_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(CABINET_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(CABINET_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(CABINET_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(CABINET_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(CABINET_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : CABINET_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(CABINET_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(CABINET_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/UnbakedKitchenCounterModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/UnbakedKitchenCounterModel.java index fece8f9ed..acadf2c86 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/UnbakedKitchenCounterModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/UnbakedKitchenCounterModel.java @@ -2,6 +2,8 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -66,19 +68,23 @@ public Collection getTextureDependencies(Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(COUNTER_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(COUNTER_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(COUNTER_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(COUNTER_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(COUNTER_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(COUNTER_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : COUNTER_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(COUNTER_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(COUNTER_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/UnbakedKitchenCounterOvenModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/UnbakedKitchenCounterOvenModel.java index 3488d009f..f07e5b96b 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/UnbakedKitchenCounterOvenModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/UnbakedKitchenCounterOvenModel.java @@ -3,6 +3,8 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -61,23 +63,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(OVEN_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(OVEN_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(OVEN_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(OVEN_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(OVEN_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(OVEN_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : OVEN_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(OVEN_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(OVEN_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/UnbakedKitchenDrawerModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/UnbakedKitchenDrawerModel.java index 806573921..d4b2a829e 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/UnbakedKitchenDrawerModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/UnbakedKitchenDrawerModel.java @@ -2,6 +2,8 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -68,23 +70,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(DRAWER_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(DRAWER_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(DRAWER_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(DRAWER_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(DRAWER_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(DRAWER_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : COUNTER_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(DRAWER_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(DRAWER_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/UnbakedKitchenSinkModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/UnbakedKitchenSinkModel.java index decf7e75e..2f0676d1d 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/UnbakedKitchenSinkModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/UnbakedKitchenSinkModel.java @@ -2,6 +2,8 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -58,23 +60,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(SINK_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(SINK_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(SINK_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(SINK_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(SINK_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(SINK_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : SINK_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(SINK_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(SINK_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/UnbakedKitchenWallCounterModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/UnbakedKitchenWallCounterModel.java index 59393d996..a090f2216 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/UnbakedKitchenWallCounterModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/UnbakedKitchenWallCounterModel.java @@ -2,6 +2,8 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -59,23 +61,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(COUNTER_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(COUNTER_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(COUNTER_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(COUNTER_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(COUNTER_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(COUNTER_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : COUNTER_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(COUNTER_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(COUNTER_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/UnbakedKitchenWallDrawerModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/UnbakedKitchenWallDrawerModel.java index 769ac611e..99d115eb4 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/UnbakedKitchenWallDrawerModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/UnbakedKitchenWallDrawerModel.java @@ -2,6 +2,8 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -65,23 +67,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(DRAWER_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(DRAWER_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(DRAWER_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(DRAWER_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(DRAWER_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(DRAWER_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : COUNTER_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(DRAWER_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(DRAWER_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/UnbakedKitchenWallDrawerSmallModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/UnbakedKitchenWallDrawerSmallModel.java index 1fad2ebae..bd998931e 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/UnbakedKitchenWallDrawerSmallModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/UnbakedKitchenWallDrawerSmallModel.java @@ -2,6 +2,8 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -56,23 +58,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(DRAWER_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(DRAWER_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(DRAWER_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(DRAWER_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(DRAWER_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(DRAWER_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : DRAWER_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(DRAWER_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(DRAWER_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/UnbakedLadderModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/UnbakedLadderModel.java index ee0db5de7..b08e10834 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/UnbakedLadderModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/UnbakedLadderModel.java @@ -3,6 +3,8 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -45,23 +47,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(LADDER_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(LADDER_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(LADDER_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(LADDER_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(LADDER_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(LADDER_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : LADDER_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(LADDER_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(LADDER_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/UnbakedLogStoolModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/UnbakedLogStoolModel.java index dfa0d97b4..ee7f5defd 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/UnbakedLogStoolModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/UnbakedLogStoolModel.java @@ -3,6 +3,8 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -49,23 +51,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(STOOL_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(STOOL_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(STOOL_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(STOOL_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(STOOL_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(STOOL_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : LOG_STOOL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(STOOL_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(STOOL_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/UnbakedLogTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/UnbakedLogTableModel.java index 58c1f3c53..41c21fada 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/UnbakedLogTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/UnbakedLogTableModel.java @@ -2,6 +2,8 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -57,23 +59,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(TABLE_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(TABLE_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : LOG_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(TABLE_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/UnbakedModernCoffeeTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/UnbakedModernCoffeeTableModel.java index f0cd655a4..78a2b602c 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/UnbakedModernCoffeeTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/UnbakedModernCoffeeTableModel.java @@ -2,6 +2,8 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -55,23 +57,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(TABLE_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(TABLE_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : MODERN_COFFEE_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(TABLE_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/UnbakedModernDinnerTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/UnbakedModernDinnerTableModel.java index fc94fbfde..9cb989d6e 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/UnbakedModernDinnerTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/UnbakedModernDinnerTableModel.java @@ -2,6 +2,8 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -55,23 +57,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(TABLE_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(TABLE_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(TABLE_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : MODERN_DINNER_MODEL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(TABLE_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(TABLE_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/UnbakedModernStoolModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/UnbakedModernStoolModel.java index 840a79a52..8f59d65db 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/UnbakedModernStoolModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/UnbakedModernStoolModel.java @@ -3,6 +3,8 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -51,23 +53,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(STOOL_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(STOOL_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(STOOL_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(STOOL_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(STOOL_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(STOOL_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : MODERN_STOOL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(STOOL_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(STOOL_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/UnbakedSimpleStoolModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/UnbakedSimpleStoolModel.java index 035933902..45d823298 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/UnbakedSimpleStoolModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/UnbakedSimpleStoolModel.java @@ -3,6 +3,8 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; +import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -50,23 +52,26 @@ public Collection getTextureDependencies(Function> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - if (CACHED_MODELS.containsKey(rotationContainer)) - return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + if (PFMRuntimeResources.modelCacheMap.containsKey(STOOL_MODEL_ID) && PFMRuntimeResources.modelCacheMap.get(STOOL_MODEL_ID).getCachedModelParts().containsKey(rotationContainer)) + return getBakedModel(STOOL_MODEL_ID, rotationContainer, PFMRuntimeResources.modelCacheMap.get(STOOL_MODEL_ID).getCachedModelParts().get(rotationContainer)); + + if (!PFMRuntimeResources.modelCacheMap.containsKey(STOOL_MODEL_ID)) + PFMRuntimeResources.modelCacheMap.put(STOOL_MODEL_ID, new PFMBakedModelContainer()); List bakedModelList = new ArrayList<>(); for (Identifier modelPart : SIMPLE_STOOL_PARTS_BASE) { bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - CACHED_MODELS.put(rotationContainer, bakedModelList); - return getBakedModel(rotationContainer, bakedModelList); + + PFMRuntimeResources.modelCacheMap.get(STOOL_MODEL_ID).getCachedModelParts().put(rotationContainer, bakedModelList); + return getBakedModel(STOOL_MODEL_ID, rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/client/screens/PFMBookScreen.java b/common/src/main/java/com/unlikepaladin/pfm/client/screens/PFMBookScreen.java new file mode 100644 index 000000000..fa6535b85 --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/client/screens/PFMBookScreen.java @@ -0,0 +1,28 @@ +package com.unlikepaladin.pfm.client.screens; + +import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.render.GameRenderer; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.text.Text; +import net.minecraft.util.Identifier; + +public class PFMBookScreen extends Screen { + public PFMBookScreen(Text title) { + super(title); + } + + public static final Identifier BOOK_TEXTURE = new Identifier("pfm", "textures/gui/book_orange.png"); + @Override + public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + this.renderBackground(matrices); + RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderTexture(0, BOOK_TEXTURE); + + super.render(matrices, mouseX, mouseY, delta); + } + + + +} diff --git a/common/src/main/java/com/unlikepaladin/pfm/client/screens/PFMGeneratingOverlay.java b/common/src/main/java/com/unlikepaladin/pfm/client/screens/PFMGeneratingOverlay.java new file mode 100644 index 000000000..27970a0ab --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/client/screens/PFMGeneratingOverlay.java @@ -0,0 +1,26 @@ +package com.unlikepaladin.pfm.client.screens; + +import com.unlikepaladin.pfm.runtime.PFMResourceProgress; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Overlay; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.util.Util; + +public class PFMGeneratingOverlay extends Overlay { + private long reloadCompleteTime = -1L; + private long reloadStartTime = -1L; + private final boolean reloading; + + PFMGeneratingOverlay(Overlay parent, PFMResourceProgress resourceProgress, MinecraftClient client, boolean reloading) { + this.reloading = reloading; + } + + @Override + public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + long l = Util.getMeasuringTimeMs(); + if (this.reloading && this.reloadStartTime == -1L) { + this.reloadStartTime = l; + } + } +} diff --git a/common/src/main/java/com/unlikepaladin/pfm/client/screens/book/PFMPage.java b/common/src/main/java/com/unlikepaladin/pfm/client/screens/book/PFMPage.java new file mode 100644 index 000000000..07c06b49c --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/client/screens/book/PFMPage.java @@ -0,0 +1,5 @@ +package com.unlikepaladin.pfm.client.screens.book; + +public class PFMPage { + +} diff --git a/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java new file mode 100644 index 000000000..adf198713 --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java @@ -0,0 +1,22 @@ +package com.unlikepaladin.pfm.mixin; + +import com.unlikepaladin.pfm.client.PathPackRPWrapper; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; +import net.minecraft.resource.ReloadableResourceManagerImpl; +import net.minecraft.resource.ResourcePack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +import java.util.ArrayList; +import java.util.List; + +@Mixin(value = ReloadableResourceManagerImpl.class) +public class PFMReloadableResourceManagerImplMixin { + + @ModifyVariable(at = @At(value = "HEAD"), method = "reload", argsOnly = true) + private List createReload(List packs) { + PFMRuntimeResources.modelCacheMap.clear(); + return packs; + } +} \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMAssetGenerator.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMAssetGenerator.java index cfebd3381..896a499e5 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMAssetGenerator.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMAssetGenerator.java @@ -21,8 +21,12 @@ public class PFMAssetGenerator extends PFMGenerator { public static boolean FROZEN = false; + private int count; + private String progress; + public PFMAssetGenerator(Path output, boolean logOrDebug) { super(output, logOrDebug, LogManager.getLogger("PFM-Asset-Generation")); + count = 0; } public void run() throws IOException { @@ -62,12 +66,14 @@ public void run() throws IOException { log("Starting provider: {}", "PFM Asset MC Meta"); stopwatch2.start(); new PFMMCMetaProvider(this).run(PackType.RESOURCE, "PFM-Assets"); + count++; stopwatch2.stop(); log("{} finished after {} ms", "PFM Asset MC Meta", stopwatch2.elapsed(TimeUnit.MILLISECONDS)); log("Starting provider: {}", "PFM Blockstates and Models"); stopwatch2.start(); new PFMBlockstateModelProvider(this).run(dataCache); + count++; stopwatch2.stop(); log("{} finished after {} ms", "PFM Blockstates and Models", stopwatch2.elapsed(TimeUnit.MILLISECONDS)); stopwatch2.reset(); @@ -75,6 +81,7 @@ public void run() throws IOException { log("Starting provider: {}", "PFM Lang"); stopwatch2.start(); new PFMLangProvider(this).run(); + count++; stopwatch2.stop(); log("{} finished after {} ms", "PFM Lang", stopwatch2.elapsed(TimeUnit.MILLISECONDS)); stopwatch2.reset(); @@ -96,4 +103,19 @@ public void run() throws IOException { setAssetsRunning(false); } } + + @Override + public int getProgress() { + return count / 3; + } + + @Override + public void setProgress(String progress) { + this.progress = progress; + } + + @Override + public String getProgressString() { + return progress; + } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMBakedModelContainer.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMBakedModelContainer.java new file mode 100644 index 000000000..9ec68a4c0 --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMBakedModelContainer.java @@ -0,0 +1,35 @@ +package com.unlikepaladin.pfm.runtime; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; + +public class PFMBakedModelContainer { + public Map getBakedModels() { + return bakedModels; + } + + final Map bakedModels = new ConcurrentHashMap<>(); + + final Map> cachedModelParts = new ConcurrentHashMap<>(); + + public Map> getCachedModelParts() { + return cachedModelParts; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof PFMBakedModelContainer that)) return false; + return Objects.equals(bakedModels, that.bakedModels) && Objects.equals(cachedModelParts, that.cachedModelParts); + } + + @Override + public int hashCode() { + return Objects.hash(bakedModels, cachedModelParts); + } +} diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGenerator.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGenerator.java index eb5f99eda..7f19c718d 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGenerator.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGenerator.java @@ -24,6 +24,9 @@ public class PFMDataGenerator extends PFMGenerator { public static boolean FROZEN = false; + private int count; + private String progress; + public PFMDataGenerator(Path output, boolean logOrDebug) { super(output, logOrDebug, LogManager.getLogger("PFM-DataGen")); } @@ -62,6 +65,7 @@ public void run() throws IOException { log("Starting provider: {}", "PFM PFMTags"); stopwatch2.start(); new PFMTagProvider(this).run(dataCache); + count++; stopwatch2.stop(); log("{} finished after {} ms", "PFM PFMTags", stopwatch2.elapsed(TimeUnit.MILLISECONDS)); stopwatch2.reset(); @@ -69,6 +73,7 @@ public void run() throws IOException { log("Starting provider: {}", "PFM Drops"); stopwatch2.start(); new PFMLootTableProvider(this).run(dataCache); + count++; stopwatch2.stop(); log("{} finished after {} ms", "PFM Drops", stopwatch2.elapsed(TimeUnit.MILLISECONDS)); stopwatch2.reset(); @@ -76,6 +81,7 @@ public void run() throws IOException { log("Starting provider: {}", "PFM Recipes"); stopwatch2.start(); new PFMRecipeProvider(this).run(dataCache); + count++; stopwatch2.stop(); log("{} finished after {} ms", "PFM Recipes", stopwatch2.elapsed(TimeUnit.MILLISECONDS)); stopwatch2.reset(); @@ -83,6 +89,7 @@ public void run() throws IOException { log("Starting provider: {}", "PFM MC Meta"); stopwatch2.start(); new PFMMCMetaProvider(this).run(PackType.DATA, "PFM-Data"); + count++; stopwatch2.stop(); log("{} finished after {} ms", "PFM MC Meta", stopwatch2.elapsed(TimeUnit.MILLISECONDS)); @@ -104,4 +111,19 @@ public void run() throws IOException { setDataRunning(false); } } + + @Override + public int getProgress() { + return count / 4; + } + + @Override + public void setProgress(String progress) { + this.progress = progress; + } + + @Override + public String getProgressString() { + return progress; + } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMGenerator.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMGenerator.java index 53e16a0ae..271ecf866 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMGenerator.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMGenerator.java @@ -14,7 +14,7 @@ import java.nio.file.Path; import java.util.*; -public abstract class PFMGenerator { +public abstract class PFMGenerator implements PFMResourceProgress { protected final Path output; private final boolean logOrDebug; private final Logger logger; @@ -122,4 +122,6 @@ private void collectFiles(File directory, List hashList, } } } + + abstract public void setProgress(String message); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMResourceProgress.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMResourceProgress.java new file mode 100644 index 000000000..4d5f33bbf --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMResourceProgress.java @@ -0,0 +1,7 @@ +package com.unlikepaladin.pfm.runtime; + +public interface PFMResourceProgress { + int getProgress(); + + String getProgressString(); +} diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMRuntimeResources.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMRuntimeResources.java index c9db54abe..c5713dd10 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMRuntimeResources.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMRuntimeResources.java @@ -2,8 +2,11 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.utilities.PFMFileUtil; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; import net.minecraft.resource.DirectoryResourcePack; import net.minecraft.resource.ResourcePack; +import net.minecraft.util.Identifier; import java.io.IOException; import java.nio.file.FileAlreadyExistsException; @@ -11,7 +14,10 @@ import java.nio.file.Path; import java.util.Base64; import java.util.List; +import java.util.Map; +import java.util.Objects; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; public class PFMRuntimeResources { public static final String base64Icon = "/9j/4AAQSkZJRgABAQAASABIAAD/2wBDABwcHBwcHDAcHDBEMDAwRFxEREREXHRcXFxcXHSMdHR0dHR0jIyMjIyMjIyoqKioqKjExMTExNzc3Nzc3Nzc3Nz/2wBDASIkJDg0OGA0NGDmnICc5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubm5ub/wAARCAEAAQADASIAAhEBAxEB/8QAGQABAAMBAQAAAAAAAAAAAAAAAAEDBAUC/8QAKBABAQABAwQBBAIDAQAAAAAAAAECAxExBCEycVESIjNBYYETkaGx/8QAGAEBAAMBAAAAAAAAAAAAAAAAAAEDBAL/xAAcEQEBAAMBAQEBAAAAAAAAAAAAAQIDETEhUUH/2gAMAwEAAhEDEQA/ANADG2gAAAAAAAAAAAAAAt/w6n0/V9NVFliJZfAASAAAAAAAAAAAAAAAAAAAAAAAADRp9Nnn3y+2Nuno4afE7/LvHXary2SMWn02effL7Y26ejhp8Tv8rkWxdjhIpyztSo1NLTz5ndbvUOrHMci9rshN5qGRrABIAAAAAAAAAAAAAAAAAANGn02efe/bG3DRw0+J3+XeOu1XlskYsOmzz737Y26ejhp8Tv8AK5FsXY4SKcs7UotkRah05TbUAkAEJci81CbzUMjUACQAAAAAAAAAAAAAAABM5iEzmEQ6szs/l7mUsUveLWy2PdqASgAAAAAQlyLzUJvNQyNQAJAAAAAAAAAAAAAAAAEzmITOYRDpPeLw94tbNXoBLkAAAAAQlyLzUJvNQyNQAJAAAAAAAAAAAAAAAAEzmITOYRDpPeLw94tbNXoBLkAAAAAQlyLzUJvNQyNQAJAAAAAAAAAAAAAAAAEzmITOYRDpPeLw94tbNXoBLkAAAAAQlyLzULM8MsLfqn9q2SzjVKACQAAAAAAAAAAAAAAABM5iEzmEQ6T3i8PeLWzV6AS5AAASCEiQRtLNqzanTY3vh2v/ABqEWS+pmVnjkZ6eeF+6f28O1tLNqy6nS45d8O3/AIpy1/i3Hb+uePeennp37p/bwqs4tl6ACQAAAAAAAAAAABM5iEzmEQ6T3i8PeLWzV6BKXKEiQQkABIAAAACLJZtWXU6XHLvh2/j9NYi4y+pmVnjj56eendsps8O1ZLNqwdRo4YT6se3dRlr59i7HZ35WQBWtAAAAAAAAAAEzmIBDpnDLhr2ds/8AbTLvN40zKVRZxZMvl7m14Upls4dOeLh4mfy9zvwlykAAAAAQAi0SlFrzvuIDfdm6n8f9tFsnesfUauOWP049+7nO/HeE+sgDM0gAAAAAAAAAAADo4+M9Oc6OPjPS3Ur2Pcm6LNk48rFynqpMtnCvU1MdPKS8WPUsym8u6OxPFsz+VnLOmWzhLmxePEz+XrdKOJRa827iA33EW7cvE1ccrZj32Op4sFdtr3OA48av48vTlupq/jy9OWp2rtYAqWgAAAAAAAAAAADo4+M9Oc6OPjPS3Ur2PePKxXjysXKKw9V5z0zTK43eXZp6rznplZsvWjDxqw1/1n/tollm87ua0dP5X07wzvjnLD+taxWsnC5VUs2fUY49se9/4vy8b6clXsys8d4Yy+rM9TPPyv8AS3p/2zNPT/tXhe5fVmU5GpZOFaycNCivGr+PL05bqav48vTlqdq3WAKloAAAAAAAAAAAA6OPjPTnNenrY2THLss12Sq851px5WK8eU56mOE3yq/qmxk6rznplW6up/ky3k22VM2V7WjGcg0dP530ztHT+d9GHpl41rJwrWThpZ6jLxvpyXWy8b6clTtWahp6f9szR09ktlvLjD1Zl41rJwrWThpZ68av48vTlunrWTTu95jmKNvq3X4AK1oAAAAAAAAAAAAAD3jnnj43Z5ttu97oDqOAAkaOn876Z2jp/O+nWHrnLxrWThWsnDSz1GXjfTkutl4305Knas1ACpctw1sse17xbl1N22wm381lHUzrm4yptuV3t3qAcpABIAAAAAAAAAAAAAAAAAAu0LJld7tvFImXl6izs46aycOZjqZYcXt8Lr1N22xm1XTZFNwrVqZTHG73bs5ablcrvld0Ks8urMMeADl2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//2Q=="; @@ -19,6 +25,7 @@ public class PFMRuntimeResources { public static final DirectoryResourcePack DATA_PACK = new DirectoryResourcePack(getDataPackDirectory().toFile()); public static volatile List RESOURCE_PACK_LIST; + public static Map modelCacheMap = new ConcurrentHashMap<>(); public static byte[] getImageData() { return Base64.getDecoder().decode(base64Icon); @@ -97,5 +104,4 @@ public static void runAsyncResourceGen() { if (future != null && !future.isDone()) future.join(); } - } diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMBlockstateModelProvider.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMBlockstateModelProvider.java index 8bc8dd96a..cc2a4ff5e 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMBlockstateModelProvider.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMBlockstateModelProvider.java @@ -39,6 +39,7 @@ public class PFMBlockstateModelProvider extends PFMProvider { public PFMBlockstateModelProvider(PFMGenerator parent) { super(parent); + parent.setProgress("Generating Blockstates and Models"); } public void run(DataCache cache) { diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMLangProvider.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMLangProvider.java index 15a537c11..e0c7924c4 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMLangProvider.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMLangProvider.java @@ -37,6 +37,7 @@ public class PFMLangProvider extends PFMProvider { public PFMLangProvider(PFMGenerator parent) { super(parent); + parent.setProgress("Generating Language Resources"); } public void run() { diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMLootTableProvider.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMLootTableProvider.java index 24c9843c9..54fc7a294 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMLootTableProvider.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMLootTableProvider.java @@ -39,6 +39,7 @@ public class PFMLootTableProvider extends PFMProvider { public PFMLootTableProvider(PFMGenerator parent) { super(parent); + parent.setProgress("Generating Loot Tables"); } public void run(DataCache cache) { diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMMCMetaProvider.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMMCMetaProvider.java index c1806c53d..7efd01155 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMMCMetaProvider.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMMCMetaProvider.java @@ -17,6 +17,7 @@ public class PFMMCMetaProvider extends PFMProvider { public PFMMCMetaProvider(PFMGenerator parent) { super(parent); + parent.setProgress("Generating Minecraft Metadata"); } public void run(PackType type, String description) { diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMRecipeProvider.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMRecipeProvider.java index a1647f822..29c971cb9 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMRecipeProvider.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMRecipeProvider.java @@ -50,6 +50,7 @@ public class PFMRecipeProvider extends PFMProvider { public PFMRecipeProvider(PFMGenerator parent) { super(parent); + parent.setProgress("Generating Recipes"); } public void run(DataCache cache) { diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMTagProvider.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMTagProvider.java index 8d82126b6..56a404dd7 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMTagProvider.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMTagProvider.java @@ -36,6 +36,7 @@ public class PFMTagProvider extends PFMProvider { public PFMTagProvider(PFMGenerator parent) { super(parent); + parent.setProgress("Generating Tags"); } protected void generateTags() { diff --git a/common/src/main/resources/assets/pfm/models/block/mesh_trashcan.json b/common/src/main/resources/assets/pfm/models/block/mesh_trashcan.json index 0b3a15e95..452fd854f 100644 --- a/common/src/main/resources/assets/pfm/models/block/mesh_trashcan.json +++ b/common/src/main/resources/assets/pfm/models/block/mesh_trashcan.json @@ -6,8 +6,8 @@ }, "elements": [ { - "from": [12, 11, 3.25], - "to": [12.5, 11.5, 12.75], + "from": [12, 11, 3], + "to": [13, 12, 13], "rotation": {"angle": 0, "axis": "y", "origin": [8, 11.25, 2]}, "faces": { "north": {"uv": [1, 0, 1.5, 0.5], "texture": "#2"}, @@ -19,19 +19,9 @@ } }, { - "from": [12.5, 0, 3.5], - "to": [12.5, 11, 12.5], - "faces": { - "east": {"uv": [1, 0, 10, 11], "texture": "#2"}, - "west": {"uv": [0, 1, 9, 12], "texture": "#2"}, - "up": {"uv": [2, 0, 2, 9], "texture": "#2"}, - "down": {"uv": [0, 1, 0, 10], "texture": "#2"} - } - }, - { - "from": [3.5, 11, 3.75], - "to": [4, 11.5, 12.25], - "rotation": {"angle": 0, "axis": "y", "origin": [8, 11.25, 2]}, + "from": [3, 11, 4], + "to": [4, 12, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [7.5, 11.25, 2]}, "faces": { "north": {"uv": [1, 0, 1.5, 0.5], "texture": "#2"}, "east": {"uv": [1, 0, 1.5, 0.5], "texture": "#2"}, @@ -42,29 +32,30 @@ } }, { - "from": [3.5, 0, 3.5], - "to": [3.5, 11, 12.5], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 5.5, 8]}, + "from": [3, 0, 3], + "to": [13, 11, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [4.5, 5.5, 8.5]}, "faces": { + "north": {"uv": [0, 1, 10, 12], "texture": "#2"}, "east": {"uv": [0, 1, 9, 12], "texture": "#2"}, - "west": {"uv": [0, 2, 9, 13], "texture": "#2"}, - "up": {"uv": [2, 0, 2, 9], "texture": "#2"}, - "down": {"uv": [1, 0, 1, 9], "texture": "#2"} + "south": {"uv": [0, 1, 10, 12], "texture": "#2"}, + "west": {"uv": [0, 2, 10, 13], "texture": "#2"} } }, { - "from": [3.5, 0, 12.5], - "to": [12.5, 11, 12.5], + "from": [13, 11, 13], + "to": [3, 0, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [14.5, 16.5, 18.5]}, "faces": { - "north": {"uv": [0, 1, 9, 12], "texture": "#2"}, - "south": {"uv": [0, 0, 9, 11], "texture": "#2"}, - "up": {"uv": [0, 1, 9, 1], "texture": "#2"}, - "down": {"uv": [1, 0, 10, 0], "texture": "#2"} + "north": {"uv": [0, 1, 10, 12], "texture": "#2"}, + "east": {"uv": [0, 1, 9, 12], "texture": "#2"}, + "south": {"uv": [0, 1, 10, 12], "texture": "#2"}, + "west": {"uv": [0, 2, 10, 13], "texture": "#2"} } }, { - "from": [3.5, 11, 12.25], - "to": [12, 11.5, 12.75], + "from": [4, 11, 12], + "to": [12, 12, 13], "faces": { "north": {"uv": [1, 0, 1.5, 0.5], "texture": "#2"}, "east": {"uv": [1, 0, 1.5, 0.5], "texture": "#2"}, @@ -75,8 +66,9 @@ } }, { - "from": [3.5, 11, 3.25], - "to": [12, 11.5, 3.75], + "from": [3, 11, 3], + "to": [12, 12, 4], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 0, -0.2]}, "faces": { "north": {"uv": [1, 0, 1.5, 0.5], "texture": "#2"}, "east": {"uv": [1, 0, 1.5, 0.5], "texture": "#2"}, @@ -87,18 +79,8 @@ } }, { - "from": [3.5, 0, 3.5], - "to": [12.5, 11, 3.5], - "faces": { - "north": {"uv": [0, 0, 9, 11], "texture": "#2"}, - "south": {"uv": [0, 0, 9, 11], "texture": "#2"}, - "up": {"uv": [1, 1, 10, 1], "texture": "#2"}, - "down": {"uv": [0, 0, 9, 0], "texture": "#2"} - } - }, - { - "from": [3.46875, 0, 3.48438], - "to": [12.52344, 0.3, 12.53906], + "from": [3.01, 0, 3.01], + "to": [12.99, 0.3, 12.99], "faces": { "north": {"uv": [14, 15, 14.5, 15.5], "texture": "#2"}, "east": {"uv": [14, 15, 14.5, 15.5], "texture": "#2"}, @@ -160,27 +142,27 @@ "name": "group", "origin": [0, 0, 0], "color": 0, - "children": [0, 1] + "children": [0] }, { "name": "group", "origin": [5, 5.5, 8], "color": 0, - "children": [2, 3] + "children": [1, 2, 3] }, { "name": "group", "origin": [0, 0, 0], "color": 0, - "children": [4, 5] + "children": [4] }, { "name": "group", "origin": [0, 0, 0], "color": 0, - "children": [6, 7] + "children": [5] }, - 8 + 6 ] } ] diff --git a/common/src/main/resources/assets/pfm/models/block/trashcan/trashcan.json b/common/src/main/resources/assets/pfm/models/block/trashcan/trashcan.json index bd3a25781..a0f2399f4 100644 --- a/common/src/main/resources/assets/pfm/models/block/trashcan/trashcan.json +++ b/common/src/main/resources/assets/pfm/models/block/trashcan/trashcan.json @@ -21,10 +21,10 @@ }, { "from": [1, 12, 1], - "to": [14, 16, 14], + "to": [14, 15, 14], "rotation": {"angle": 0, "axis": "y", "origin": [7.5, 15.75, 7.5]}, "faces": { - "north": {"uv": [13, 0, 6.5, 2], "texture": "#3"}, + "north": {"uv": [13, 0, 6.5, 1.5], "texture": "#3"}, "east": {"uv": [13, 0, 6.5, 2], "texture": "#3"}, "south": {"uv": [13, 0, 6.5, 2], "texture": "#3"}, "west": {"uv": [6.5, 0, 13, 2], "texture": "#3"}, @@ -33,9 +33,9 @@ } }, { - "from": [10.5, 16, 6.5], - "to": [11.5, 17, 8.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7.5, 15.75, 7.5]}, + "from": [11.5, 15, 6.5], + "to": [11.5, 16, 8.5], + "rotation": {"angle": 0, "axis": "y", "origin": [7.5, 14.75, 7.5]}, "faces": { "north": {"uv": [7, 2, 7.5, 2.5], "texture": "#3"}, "east": {"uv": [7, 2, 8, 2.5], "texture": "#3"}, @@ -46,9 +46,9 @@ } }, { - "from": [3.5, 16, 6.5], - "to": [4.5, 17, 8.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7.5, 15.75, 7.5]}, + "from": [3.5, 15, 6.5], + "to": [3.5, 16, 8.5], + "rotation": {"angle": 0, "axis": "y", "origin": [7.5, 14.75, 7.5]}, "faces": { "north": {"uv": [7, 2, 7.5, 2.5], "texture": "#3"}, "east": {"uv": [7, 2, 8, 2.5], "texture": "#3"}, @@ -59,9 +59,9 @@ } }, { - "from": [3.5, 17, 6.5], - "to": [11.5, 18, 8.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7.5, 15.75, 7.5]}, + "from": [3.5, 16, 6.5], + "to": [11.5, 16, 8.5], + "rotation": {"angle": 0, "axis": "y", "origin": [7.5, 14.75, 7.5]}, "faces": { "north": {"uv": [7, 2, 11, 2.5], "texture": "#3"}, "east": {"uv": [9.5, 2, 10.5, 2.5], "texture": "#3"}, diff --git a/common/src/main/resources/pfm-common.mixins.json b/common/src/main/resources/pfm-common.mixins.json index 713eaa5e8..435b0d8dc 100644 --- a/common/src/main/resources/pfm-common.mixins.json +++ b/common/src/main/resources/pfm-common.mixins.json @@ -17,7 +17,8 @@ "PFMItemRendererMixin", "PFMLanguageManagerAccessor", "PFMMixinClientPacketListener", - "PFMRenderLayersMixin" + "PFMRenderLayersMixin", + "PFMReloadableResourceManagerImplMixin" ], "injectors": { "defaultRequire": 1 diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/fabric/UnbakedCoffeeBasicTableModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/fabric/UnbakedCoffeeBasicTableModelImpl.java index 4ad9b76f3..c5bf17aa0 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/fabric/UnbakedCoffeeBasicTableModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/fabric/UnbakedCoffeeBasicTableModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.basicCoffeeTable.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedCoffeeBasicTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricCoffeeBasicTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/UnbakedBasicLampModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/UnbakedBasicLampModelImpl.java index 3a7677f7e..66405fa86 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/UnbakedBasicLampModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/UnbakedBasicLampModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.basicLamp.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedBasicLampModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricBasicLampModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/fabric/UnbakedBasicTableModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/fabric/UnbakedBasicTableModelImpl.java index 7d4142fe1..c0cb1deaf 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/fabric/UnbakedBasicTableModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/fabric/UnbakedBasicTableModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.basicTable.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedBasicTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricBasicTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/UnbakedBedModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/UnbakedBedModelImpl.java index 95dae06bb..7b9a1d85a 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/UnbakedBedModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/UnbakedBedModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.bed.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedBedModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricBedModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/fabric/UnbakedChairModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/fabric/UnbakedChairModelImpl.java index 8cfc302dc..1156e8d99 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/fabric/UnbakedChairModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/fabric/UnbakedChairModelImpl.java @@ -1,20 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.chair.fabric; -import com.unlikepaladin.pfm.blocks.models.classicNightstand.fabric.FabricClassicNightstandModel; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedChairModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricChairModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/fabric/UnbakedChairClassicModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/fabric/UnbakedChairClassicModelImpl.java index c6d3065cb..4ce734c1b 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/fabric/UnbakedChairClassicModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/fabric/UnbakedChairClassicModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.chairClassic.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedChairClassicModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricChairClassicModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/fabric/UnbakedChairDinnerModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/fabric/UnbakedChairDinnerModelImpl.java index 31ca1a653..ecd5be5d2 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/fabric/UnbakedChairDinnerModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/fabric/UnbakedChairDinnerModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.chairDinner.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedChairDinnerModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricChairDinnerModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/fabric/UnbakedChairModernModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/fabric/UnbakedChairModernModelImpl.java index 358e63747..80a39a7ad 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/fabric/UnbakedChairModernModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/fabric/UnbakedChairModernModelImpl.java @@ -1,20 +1,22 @@ package com.unlikepaladin.pfm.blocks.models.chairModern.fabric; import com.unlikepaladin.pfm.blocks.models.chairDinner.fabric.FabricChairDinnerModel; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedChairModernModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricChairModernModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/fabric/UnbakedClassicCoffeeTableModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/fabric/UnbakedClassicCoffeeTableModelImpl.java index 712438809..2b3b01f61 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/fabric/UnbakedClassicCoffeeTableModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/fabric/UnbakedClassicCoffeeTableModelImpl.java @@ -1,20 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.classicCoffeeTable.fabric; -import com.unlikepaladin.pfm.blocks.models.classicTable.fabric.FabricClassicTableModel; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedClassicCoffeeTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricClassicCoffeeTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/UnbakedClassicNightstandModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/UnbakedClassicNightstandModelImpl.java index 7a9e93e7f..761df57a5 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/UnbakedClassicNightstandModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/UnbakedClassicNightstandModelImpl.java @@ -1,20 +1,22 @@ package com.unlikepaladin.pfm.blocks.models.classicNightstand.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; import net.minecraft.client.texture.Sprite; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedClassicNightstandModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricClassicNightstandModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/fabric/UnbakedClassicStoolModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/fabric/UnbakedClassicStoolModelImpl.java index fba7cebfc..134cd4da8 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/fabric/UnbakedClassicStoolModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/fabric/UnbakedClassicStoolModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.classicStool.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedClassicStoolModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricClassicStoolModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/fabric/UnbakedClassicTableModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/fabric/UnbakedClassicTableModelImpl.java index 63aef9372..9890d9397 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/fabric/UnbakedClassicTableModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/fabric/UnbakedClassicTableModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.classicTable.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedClassicTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricClassicTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/fabric/UnbakedDinnerTableModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/fabric/UnbakedDinnerTableModelImpl.java index 32e7db85e..182ba6675 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/fabric/UnbakedDinnerTableModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/fabric/UnbakedDinnerTableModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.dinnerTable.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedDinnerTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricDinnerTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/UnbakedKitchenCabinetModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/UnbakedKitchenCabinetModelImpl.java index 61ff40ca6..9917f4c8e 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/UnbakedKitchenCabinetModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/UnbakedKitchenCabinetModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.kitchenCabinet.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenCabinetModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricKitchenCabinetModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/UnbakedKitchenCounterModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/UnbakedKitchenCounterModelImpl.java index bf87ed32a..16ee8d7a6 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/UnbakedKitchenCounterModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/UnbakedKitchenCounterModelImpl.java @@ -1,20 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.kitchenCounter.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenCounterModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricKitchenCounterModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/UnbakedKitchenCounterOvenModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/UnbakedKitchenCounterOvenModelImpl.java index ea802ced7..e1bea6ec8 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/UnbakedKitchenCounterOvenModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/UnbakedKitchenCounterOvenModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.kitchenCounterOven.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenCounterOvenModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricKitchenCounterOvenModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/UnbakedKitchenDrawerModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/UnbakedKitchenDrawerModelImpl.java index 7a3ced25c..a03545378 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/UnbakedKitchenDrawerModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/UnbakedKitchenDrawerModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.kitchenDrawer.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenDrawerModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricKitchenDrawerModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/fabric/UnbakedKitchenSinkModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/fabric/UnbakedKitchenSinkModelImpl.java index ed2b65c88..762374765 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/fabric/UnbakedKitchenSinkModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/fabric/UnbakedKitchenSinkModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.kitchenSink.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenSinkModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricKitchenSinkModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/UnbakedKitchenWallCounterModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/UnbakedKitchenWallCounterModelImpl.java index 009e18d60..ffa4d9283 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/UnbakedKitchenWallCounterModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/UnbakedKitchenWallCounterModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.kitchenWallCounter.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenWallCounterModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricKitchenWallCounterModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/UnbakedKitchenWallDrawerModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/UnbakedKitchenWallDrawerModelImpl.java index b286608bb..704682a35 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/UnbakedKitchenWallDrawerModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/UnbakedKitchenWallDrawerModelImpl.java @@ -1,21 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.kitchenWallDrawer.fabric; -import com.unlikepaladin.pfm.blocks.models.kitchenDrawer.fabric.FabricKitchenDrawerModel; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenWallDrawerModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricKitchenWallDrawerModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/fabric/UnbakedKitchenWallDrawerSmallModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/fabric/UnbakedKitchenWallDrawerSmallModelImpl.java index 1e4678f42..722beaf8d 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/fabric/UnbakedKitchenWallDrawerSmallModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/fabric/UnbakedKitchenWallDrawerSmallModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.kitchenWallDrawerSmall.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenWallDrawerSmallModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricKitchenWallDrawerSmallModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/fabric/UnbakedLadderModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/fabric/UnbakedLadderModelImpl.java index 0f30d9109..e7db91d66 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/fabric/UnbakedLadderModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/fabric/UnbakedLadderModelImpl.java @@ -1,12 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.ladder.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; public class UnbakedLadderModelImpl { - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - return new FabricLadderModel(settings, modelParts); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + + BakedModel model = new FabricLadderModel(settings, modelParts); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); + return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/fabric/UnbakedLogStoolModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/fabric/UnbakedLogStoolModelImpl.java index 7534d914a..ded919355 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/fabric/UnbakedLogStoolModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/fabric/UnbakedLogStoolModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.logStool.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedLogStoolModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricLogStoolModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/fabric/UnbakedLogTableModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/fabric/UnbakedLogTableModelImpl.java index d900e3f12..28dfd9f93 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/fabric/UnbakedLogTableModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/fabric/UnbakedLogTableModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.logTable.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedLogTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricLogTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/fabric/UnbakedModernCoffeeTableModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/fabric/UnbakedModernCoffeeTableModelImpl.java index 24e4d7472..2d95ec49a 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/fabric/UnbakedModernCoffeeTableModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/fabric/UnbakedModernCoffeeTableModelImpl.java @@ -1,20 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.modernCoffeeTable.fabric; -import com.unlikepaladin.pfm.blocks.models.modernDinnerTable.fabric.FabricModernDinnerTableModel; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedModernCoffeeTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricModernCoffeeTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/fabric/UnbakedModernDinnerTableModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/fabric/UnbakedModernDinnerTableModelImpl.java index 2461ce18e..1680ff638 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/fabric/UnbakedModernDinnerTableModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/fabric/UnbakedModernDinnerTableModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.modernDinnerTable.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedModernDinnerTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricModernDinnerTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/fabric/UnbakedModernStoolModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/fabric/UnbakedModernStoolModelImpl.java index ebe4a2307..9be954ba9 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/fabric/UnbakedModernStoolModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/fabric/UnbakedModernStoolModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.modernStool.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedModernStoolModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricModernStoolModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/fabric/UnbakedSimpleStoolModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/fabric/UnbakedSimpleStoolModelImpl.java index 2b8c1df81..d60cf77f2 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/fabric/UnbakedSimpleStoolModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/fabric/UnbakedSimpleStoolModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.simpleStool.fabric; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedSimpleStoolModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new FabricSimpleStoolModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PaladinFurnitureModClientFabric.java b/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PaladinFurnitureModClientFabric.java index fe5699185..a28ddb8c3 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PaladinFurnitureModClientFabric.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PaladinFurnitureModClientFabric.java @@ -12,6 +12,7 @@ import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; +import net.fabricmc.fabric.api.resource.ResourceManagerHelper; import net.minecraft.client.option.KeyBinding; import net.minecraft.client.util.InputUtil; import org.apache.logging.log4j.LogManager; diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMModResourcePackCreatorMixin.java b/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMModResourcePackCreatorMixin.java index b8a58acc0..bd8e4d875 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMModResourcePackCreatorMixin.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMModResourcePackCreatorMixin.java @@ -2,6 +2,7 @@ import com.google.common.base.Suppliers; import com.mojang.bridge.game.PackType; +import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.client.PathPackRPWrapper; import com.unlikepaladin.pfm.runtime.PFMDataGenerator; import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; @@ -30,6 +31,7 @@ public class PFMModResourcePackCreatorMixin { @Inject(method = "register(Ljava/util/function/Consumer;Lnet/minecraft/resource/ResourcePackProfile$Factory;)V", at = @At("TAIL")) private void addPFMResources(Consumer consumer, ResourcePackProfile.Factory factory, CallbackInfo ci) { if (type == ResourceType.CLIENT_RESOURCES) { + AbstractBakedModel.reloading = true; PackResourceMetadata packResourceMetadata = new PackResourceMetadata(new LiteralText("Runtime Generated Assets for PFM"), SharedConstants.getGameVersion().getPackVersion(PackType.RESOURCE)); consumer.accept(factory.create("pfm-asset-resources", new LiteralText("PFM Assets"), true, () -> new PathPackRPWrapper(Suppliers.memoize(() -> { diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/forge/ForgeCoffeeBasicTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/forge/ForgeCoffeeBasicTableModel.java index d95dd4010..031f29d9f 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/forge/ForgeCoffeeBasicTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/forge/ForgeCoffeeBasicTableModel.java @@ -198,8 +198,8 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction } } List spriteList = getSpriteList(state); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } return Collections.emptyList(); @@ -222,8 +222,8 @@ public List getQuads(ItemStack stack, @Nullable BlockState state, @Nu secondaryQuads.addAll(getTemplateBakedModels().get(7).getQuads(state, face, random)); List spriteList = getSpriteList(stack); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/forge/UnbakedCoffeeBasicTableModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/forge/UnbakedCoffeeBasicTableModelImpl.java index 55dd8aac0..f7655a27f 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/forge/UnbakedCoffeeBasicTableModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/forge/UnbakedCoffeeBasicTableModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.basicCoffeeTable.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedCoffeeBasicTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeCoffeeBasicTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/UnbakedBasicLampModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/UnbakedBasicLampModelImpl.java index 3412042b3..165efe90a 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/UnbakedBasicLampModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/UnbakedBasicLampModelImpl.java @@ -1,15 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.basicLamp.forge; -import com.unlikepaladin.pfm.data.materials.WoodVariant; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; public class UnbakedBasicLampModelImpl { - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - return new ForgeBasicLampModel(settings, modelParts); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + + BakedModel model = new ForgeBasicLampModel(settings, modelParts); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); + return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/ForgeBasicTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/ForgeBasicTableModel.java index b251cc287..1feba20a8 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/ForgeBasicTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/ForgeBasicTableModel.java @@ -199,8 +199,8 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction } } List spriteList = getSpriteList(state); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } return Collections.emptyList(); @@ -223,8 +223,8 @@ public List getQuads(ItemStack stack, @Nullable BlockState state, @Nu secondaryQuads.addAll(getTemplateBakedModels().get(7).getQuads(state, face, random)); List spriteList = getSpriteList(stack); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/UnbakedBasicTableModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/UnbakedBasicTableModelImpl.java index c31845be0..57f19280c 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/UnbakedBasicTableModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/UnbakedBasicTableModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.basicTable.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedBasicTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeBasicTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/UnbakedBedModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/UnbakedBedModelImpl.java index b08c211e8..7582f4bba 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/UnbakedBedModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/UnbakedBedModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.bed.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedBedModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeBedModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/forge/UnbakedChairModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/forge/UnbakedChairModelImpl.java index 0de1596ad..4bce34d44 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/forge/UnbakedChairModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/forge/UnbakedChairModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.chair.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedChairModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeChairModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/forge/UnbakedChairClassicModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/forge/UnbakedChairClassicModelImpl.java index 66a6f7447..acecc8da4 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/forge/UnbakedChairClassicModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/forge/UnbakedChairClassicModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.chairClassic.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedChairClassicModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeChairClassicModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/forge/UnbakedChairDinnerModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/forge/UnbakedChairDinnerModelImpl.java index 8dd579ee0..d473d9ff5 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/forge/UnbakedChairDinnerModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/forge/UnbakedChairDinnerModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.chairDinner.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedChairDinnerModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeChairDinnerModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/forge/UnbakedChairModernModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/forge/UnbakedChairModernModelImpl.java index 57c7f19c2..c6a2d1b31 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/forge/UnbakedChairModernModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/forge/UnbakedChairModernModelImpl.java @@ -1,20 +1,22 @@ package com.unlikepaladin.pfm.blocks.models.chairModern.forge; import com.unlikepaladin.pfm.blocks.models.chairDinner.forge.ForgeChairDinnerModel; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedChairModernModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeChairModernModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/forge/ForgeClassicCoffeeTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/forge/ForgeClassicCoffeeTableModel.java index b2fbd82ca..160e2edd1 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/forge/ForgeClassicCoffeeTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/forge/ForgeClassicCoffeeTableModel.java @@ -84,8 +84,8 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction } List spriteList = getSpriteList(state); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } return Collections.emptyList(); @@ -104,8 +104,8 @@ public List getQuads(ItemStack stack, @Nullable BlockState state, @Nu secondaryQuads.addAll(getTemplateBakedModels().get(4).getQuads(state, face, random)); List spriteList = getSpriteList(stack); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/forge/UnbakedClassicCoffeeTableModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/forge/UnbakedClassicCoffeeTableModelImpl.java index 309cf0373..9b4c81ee8 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/forge/UnbakedClassicCoffeeTableModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/forge/UnbakedClassicCoffeeTableModelImpl.java @@ -1,20 +1,20 @@ package com.unlikepaladin.pfm.blocks.models.classicCoffeeTable.forge; -import com.unlikepaladin.pfm.blocks.models.classicTable.forge.ForgeClassicTableModel; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedClassicCoffeeTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeClassicCoffeeTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/UnbakedClassicNightstandModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/UnbakedClassicNightstandModelImpl.java index 0e66b54cd..16ce49883 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/UnbakedClassicNightstandModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/UnbakedClassicNightstandModelImpl.java @@ -1,21 +1,24 @@ package com.unlikepaladin.pfm.blocks.models.classicNightstand.forge; +import com.unlikepaladin.pfm.blocks.models.classicCoffeeTable.forge.ForgeClassicCoffeeTableModel; import com.unlikepaladin.pfm.blocks.models.classicTable.forge.ForgeClassicTableModel; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; import net.minecraft.client.texture.Sprite; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedClassicNightstandModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeClassicNightstandModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/forge/UnbakedClassicStoolModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/forge/UnbakedClassicStoolModelImpl.java index dd8269033..fd1b7eec8 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/forge/UnbakedClassicStoolModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/forge/UnbakedClassicStoolModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.classicStool.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedClassicStoolModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeClassicStoolModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/ForgeClassicTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/ForgeClassicTableModel.java index 4d4b74f00..3aeb2ba86 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/ForgeClassicTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/ForgeClassicTableModel.java @@ -85,8 +85,8 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction } List spriteList = getSpriteList(state); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } return Collections.emptyList(); @@ -105,8 +105,8 @@ public List getQuads(ItemStack stack, @Nullable BlockState state, @Nu secondaryQuads.addAll(getTemplateBakedModels().get(4).getQuads(state, face, random)); List spriteList = getSpriteList(stack); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/UnbakedClassicTableModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/UnbakedClassicTableModelImpl.java index 53d30cf77..0962eafa0 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/UnbakedClassicTableModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/UnbakedClassicTableModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.classicTable.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedClassicTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeClassicTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/ForgeDinnerTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/ForgeDinnerTableModel.java index e379f3699..11ce0438f 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/ForgeDinnerTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/ForgeDinnerTableModel.java @@ -79,8 +79,8 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction secondaryQuads.addAll(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData)); } List spriteList = getSpriteList(state); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } return Collections.emptyList(); @@ -94,8 +94,8 @@ public List getQuads(ItemStack stack, @Nullable BlockState state, @Nu List secondaryQuads = new ArrayList<>(getTemplateBakedModels().get(3).getQuads(state, face, random)); List spriteList = getSpriteList(stack); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/UnbakedDinnerTableModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/UnbakedDinnerTableModelImpl.java index 68347ffb3..e2ec3fc5b 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/UnbakedDinnerTableModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/UnbakedDinnerTableModelImpl.java @@ -1,19 +1,22 @@ package com.unlikepaladin.pfm.blocks.models.dinnerTable.forge; +import com.unlikepaladin.pfm.blocks.models.classicTable.forge.ForgeClassicTableModel; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedDinnerTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeDinnerTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java index e53c9a872..293d8df0f 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java @@ -1,6 +1,5 @@ package com.unlikepaladin.pfm.blocks.models.forge; -import com.google.common.collect.Iterables; import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; @@ -26,6 +25,7 @@ import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicReference; import java.util.stream.IntStream; public abstract class PFMForgeBakedModel extends AbstractBakedModel implements PFMBakedModelGetQuadsExtension { @@ -48,7 +48,7 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos return tileData; } - Map> separatedQuads = new ConcurrentHashMap<>(); + Map, List> separatedQuads = new ConcurrentHashMap<>(); public List getQuadsWithTexture(List quads, List toReplace, List replacements) { if (quads == null) return Collections.emptyList(); @@ -65,31 +65,41 @@ public List getQuadsWithTexture(List quads, List t if (toReplace.equals(replacements)) return quads; - for (BakedQuad quad : quads) { - Identifier sprite = quad.getSprite().getId(); - if (separatedQuads.containsKey(sprite)) { - if (!separatedQuads.get(sprite).contains(quad)) { - List newQuadList = new ArrayList<>(separatedQuads.get(sprite)); + for (BakedQuad quad : quads) { + SpriteData sprite = new SpriteData(quad.getSprite()); + Pair pair = new Pair<>(sprite.getId(), sprite); + if (separatedQuads.containsKey(pair)) { + if (!separatedQuads.get(pair).contains(quad)) { + List newQuadList = new ArrayList<>(separatedQuads.get(pair)); newQuadList.add(quad); - separatedQuads.put(sprite, newQuadList); + separatedQuads.put(pair, newQuadList); } continue; + } else if (!separatedQuads.isEmpty()) { + AtomicReference> del = new AtomicReference<>(null); + separatedQuads.keySet().forEach(identifierSpriteDataPair -> { + if (identifierSpriteDataPair != null && sprite.getId().equals(identifierSpriteDataPair.getFirst())){ + del.set(identifierSpriteDataPair); + } + }); + if (del.get() != null) + separatedQuads.remove(del.get()); } List list = new ArrayList<>(); list.add(quad); - separatedQuads.put(sprite, list); + separatedQuads.put(pair, list); } List transformedQuads = new ArrayList<>(quads.size()); - for (Map.Entry> entry : separatedQuads.entrySet()) { - Identifier keyId = entry.getKey(); + for (Map.Entry, List> entry : separatedQuads.entrySet()) { + Identifier keyId = entry.getKey().getFirst(); int index = IntStream.range(0, toReplace.size()) .filter(i -> keyId.equals(toReplace.get(i).getId())) .findFirst() .orElse(-1); if (index != -1) { - Sprite replacement = Iterables.get(replacements, index, toReplace.get(index)); + SpriteData replacement = new SpriteData(replacements.get(index)); transformedQuads.addAll(getQuadsWithTexture(entry.getValue().stream().filter(quads::contains).toList(), replacement)); } else { transformedQuads.addAll(entry.getValue().stream().filter(quads::contains).toList()); @@ -98,8 +108,8 @@ public List getQuadsWithTexture(List quads, List t return transformedQuads; } - Map, BakedQuad> quadToTransformedQuad = new ConcurrentHashMap<>(); - public List getQuadsWithTexture(List quads, Sprite sprite) { + Map, BakedQuad> quadToTransformedQuad = new ConcurrentHashMap<>(); + public List getQuadsWithTexture(List quads, SpriteData spriteData) { List transformedQuads = new ArrayList<>(quads.size()); // UV Element index @@ -107,15 +117,17 @@ public List getQuadsWithTexture(List quads, Sprite sprite) // I basically have to disable caching if Optifine is present, otherwise it breaks uvs quads.forEach(quad -> { - Pair quadKey = new Pair<>(sprite.getId(), quad); - if (quad.getSprite().getId() == sprite.getId() && !quadToTransformedQuad.containsKey(quadKey) && !PaladinFurnitureMod.isOptifineLoaded()) { + Pair quadKey = new Pair<>(spriteData, quad); + + if (quad.getSprite().getId() == spriteData.getId() && !quadToTransformedQuad.containsKey(quadKey)) { quadToTransformedQuad.put(quadKey, quad); transformedQuads.add(quad); } - else if (quadToTransformedQuad.containsKey(quadKey) && !PaladinFurnitureMod.isOptifineLoaded()) { + else if (quadToTransformedQuad.containsKey(quadKey)) { transformedQuads.add(quadToTransformedQuad.get(quadKey)); } else { + Sprite sprite = spriteData.getSprite(); int[] vertexData = new int[quad.getVertexData().length]; System.arraycopy(quad.getVertexData(), 0, vertexData, 0, vertexData.length); @@ -169,4 +181,42 @@ public Sprite getParticleSprite() { public void appendProperties(ModelDataMap.Builder builder) { builder.withProperty(STATE); } + + + + public static class SpriteData { + float minU, maxU, minV, maxV; + int x, y; + Identifier id; + Sprite sprite; + + public SpriteData(Sprite sprite) { + this.sprite = sprite; + this.minU = sprite.getMinU(); + this.maxU = sprite.getMaxU(); + this.minV = sprite.getMinV(); + this.maxV = sprite.getMaxV(); + this.x = sprite.getX(); + this.y = sprite.getY(); + this.id = sprite.getId(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof SpriteData && ((SpriteData) obj).id == id && ((SpriteData) obj).minV == minV && ((SpriteData) obj).maxV == maxV && ((SpriteData) obj).minU == minU && ((SpriteData) obj).maxU == maxU && ((SpriteData) obj).x == x && ((SpriteData) obj).y == y; + } + + public Sprite getSprite() { + return sprite; + } + + public Identifier getId() { + return id; + } + + @Override + public int hashCode() { + return Objects.hash(minU, maxU, minV, maxV, x, y, id); + } + } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/UnbakedKitchenCabinetModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/UnbakedKitchenCabinetModelImpl.java index d3321462f..d28b139ca 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/UnbakedKitchenCabinetModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/UnbakedKitchenCabinetModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.kitchenCabinet.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenCabinetModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeKitchenCabinetModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/UnbakedKitchenCounterModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/UnbakedKitchenCounterModelImpl.java index b1446b9de..170a6e781 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/UnbakedKitchenCounterModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/UnbakedKitchenCounterModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.kitchenCounter.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenCounterModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeKitchenCounterModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/UnbakedKitchenCounterOvenModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/UnbakedKitchenCounterOvenModelImpl.java index 78ba420da..6d2e556f3 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/UnbakedKitchenCounterOvenModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/UnbakedKitchenCounterOvenModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.kitchenCounterOven.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenCounterOvenModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeKitchenCounterOvenModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/UnbakedKitchenDrawerModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/UnbakedKitchenDrawerModelImpl.java index bbe97353a..db4c45a19 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/UnbakedKitchenDrawerModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/UnbakedKitchenDrawerModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.kitchenDrawer.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenDrawerModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeKitchenDrawerModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/forge/UnbakedKitchenSinkModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/forge/UnbakedKitchenSinkModelImpl.java index bb7d87d9b..e5eca30e1 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/forge/UnbakedKitchenSinkModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/forge/UnbakedKitchenSinkModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.kitchenSink.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenSinkModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeKitchenSinkModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/UnbakedKitchenWallCounterModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/UnbakedKitchenWallCounterModelImpl.java index 9b559f013..99da9d449 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/UnbakedKitchenWallCounterModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/UnbakedKitchenWallCounterModelImpl.java @@ -1,21 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.kitchenWallCounter.forge; -import com.unlikepaladin.pfm.blocks.models.kitchenDrawer.forge.ForgeKitchenDrawerModel; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenWallCounterModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeKitchenWallCounterModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/UnbakedKitchenWallDrawerModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/UnbakedKitchenWallDrawerModelImpl.java index 33c483354..60842eea9 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/UnbakedKitchenWallDrawerModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/UnbakedKitchenWallDrawerModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.kitchenWallDrawer.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenWallDrawerModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeKitchenWallDrawerModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/forge/UnbakedKitchenWallDrawerSmallModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/forge/UnbakedKitchenWallDrawerSmallModelImpl.java index 5d4a5d2a1..e1dacb705 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/forge/UnbakedKitchenWallDrawerSmallModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/forge/UnbakedKitchenWallDrawerSmallModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.kitchenWallDrawerSmall.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenWallDrawerSmallModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeKitchenWallDrawerSmallModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/ForgeLadderModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/ForgeLadderModel.java index 523cfefa9..4b1a29973 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/ForgeLadderModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/ForgeLadderModel.java @@ -33,7 +33,7 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction if (state != null && state.getBlock() instanceof SimpleBunkLadderBlock) { int offset = state.get(SimpleBunkLadderBlock.UP) ? 1 : 0; Sprite sprite = getSpriteList(state).get(0); - return getQuadsWithTexture(getTemplateBakedModels().get(offset).getQuads(state, side, rand, extraData), sprite); + return getQuadsWithTexture(getTemplateBakedModels().get(offset).getQuads(state, side, rand, extraData), new SpriteData(sprite)); } return Collections.emptyList(); } @@ -46,6 +46,6 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction @Override public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { Sprite sprite = getSpriteList(stack).get(0); - return getQuadsWithTexture(getTemplateBakedModels().get(0).getQuads(state, face, random), sprite); + return getQuadsWithTexture(getTemplateBakedModels().get(0).getQuads(state, face, random), new SpriteData(sprite)); } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/UnbakedLadderModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/UnbakedLadderModelImpl.java index d61375a67..08dc7f5bf 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/UnbakedLadderModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/UnbakedLadderModelImpl.java @@ -1,12 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.ladder.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; public class UnbakedLadderModelImpl { - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - return new ForgeLadderModel(settings, modelParts); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + + BakedModel model = new ForgeLadderModel(settings, modelParts); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); + return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/forge/UnbakedLogStoolModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/forge/UnbakedLogStoolModelImpl.java index bc6e1b9c2..946266d5e 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/forge/UnbakedLogStoolModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/forge/UnbakedLogStoolModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.logStool.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedLogStoolModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeLogStoolModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/ForgeLogTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/ForgeLogTableModel.java index 64724b3bb..b06738a2a 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/ForgeLogTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/ForgeLogTableModel.java @@ -78,8 +78,8 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction secondaryQuads.addAll(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData)); } List spriteList = getSpriteList(state); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } return Collections.emptyList(); @@ -93,8 +93,8 @@ public List getQuads(ItemStack stack, @Nullable BlockState state, @Nu List secondaryQuads = new ArrayList<>(getTemplateBakedModels().get(3).getQuads(state, face, random)); List spriteList = getSpriteList(stack); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/UnbakedLogTableModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/UnbakedLogTableModelImpl.java index 9cc756c27..d3f71cba6 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/UnbakedLogTableModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/UnbakedLogTableModelImpl.java @@ -1,19 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.logTable.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class UnbakedLogTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeLogTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/forge/ForgeModernCoffeeTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/forge/ForgeModernCoffeeTableModel.java index 823778e32..da3f497d4 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/forge/ForgeModernCoffeeTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/forge/ForgeModernCoffeeTableModel.java @@ -78,8 +78,8 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction secondaryQuads.addAll(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData)); } List spriteList = getSpriteList(state); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } return Collections.emptyList(); @@ -93,8 +93,8 @@ public List getQuads(ItemStack stack, @Nullable BlockState state, @Nu List secondaryQuads = new ArrayList<>(getTemplateBakedModels().get(3).getQuads(state, face, random)); List spriteList = getSpriteList(stack); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/forge/UnbakedModernCoffeeTableModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/forge/UnbakedModernCoffeeTableModelImpl.java index b14b7858e..5d1d884e1 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/forge/UnbakedModernCoffeeTableModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/forge/UnbakedModernCoffeeTableModelImpl.java @@ -1,20 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.modernCoffeeTable.forge; -import com.unlikepaladin.pfm.blocks.models.modernDinnerTable.forge.ForgeModernDinnerTableModel; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedModernCoffeeTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeModernCoffeeTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/ForgeModernDinnerTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/ForgeModernDinnerTableModel.java index 2e8737418..6fcfb2d95 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/ForgeModernDinnerTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/ForgeModernDinnerTableModel.java @@ -79,8 +79,8 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction secondaryQuads.addAll(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData)); } List spriteList = getSpriteList(state); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } return Collections.emptyList(); @@ -94,8 +94,8 @@ public List getQuads(ItemStack stack, @Nullable BlockState state, @Nu List secondaryQuads = new ArrayList<>(getTemplateBakedModels().get(3).getQuads(state, face, random)); List spriteList = getSpriteList(stack); - List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); - quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + List quads = getQuadsWithTexture(baseQuads, new SpriteData(spriteList.get(0))); + quads.addAll(getQuadsWithTexture(secondaryQuads, new SpriteData(spriteList.get(1)))); return quads; } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/UnbakedModernDinnerTableModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/UnbakedModernDinnerTableModelImpl.java index 053ecafbe..de81d8bb2 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/UnbakedModernDinnerTableModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/UnbakedModernDinnerTableModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.modernDinnerTable.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedModernDinnerTableModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeModernDinnerTableModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/forge/UnbakedModernStoolModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/forge/UnbakedModernStoolModelImpl.java index 252689923..7b2bd4482 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/forge/UnbakedModernStoolModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/forge/UnbakedModernStoolModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.modernStool.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedModernStoolModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeModernStoolModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/forge/UnbakedSimpleStoolModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/forge/UnbakedSimpleStoolModelImpl.java index 93547a119..6354fd096 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/forge/UnbakedSimpleStoolModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/forge/UnbakedSimpleStoolModelImpl.java @@ -1,19 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.simpleStool.forge; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.util.Identifier; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; public class UnbakedSimpleStoolModelImpl { - static Map modelMap = new ConcurrentHashMap<>(); - public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { - if (modelMap.containsKey(settings)) - return modelMap.get(settings); + public static BakedModel getBakedModel(Identifier modelId, ModelBakeSettings settings, List modelParts) { + if (PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().containsKey(settings)) + return PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().get(settings); + BakedModel model = new ForgeSimpleStoolModel(settings, modelParts); - modelMap.put(settings, model); + PFMRuntimeResources.modelCacheMap.get(modelId).getBakedModels().put(settings,model); return model; } }