From 818cfae63f7c150ac601b5f5be4111e7b62b0810 Mon Sep 17 00:00:00 2001 From: covers1624 Date: Mon, 13 Nov 2023 04:26:18 +1030 Subject: [PATCH] Use ClassModelLoader for Chest/Tank item models. --- .../.cache/282910bf22b00ad347f56cc1dfb6815b78e846d9 | 6 +++--- .../assets/enderstorage/models/item/ender_chest.json | 4 +++- .../assets/enderstorage/models/item/ender_tank.json | 4 +++- .../codechicken/enderstorage/init/ClientInit.java | 12 ------------ .../enderstorage/init/DataGenerators.java | 6 ++++-- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/main/generated/.cache/282910bf22b00ad347f56cc1dfb6815b78e846d9 b/src/main/generated/.cache/282910bf22b00ad347f56cc1dfb6815b78e846d9 index 22af882..b3d6e1a 100644 --- a/src/main/generated/.cache/282910bf22b00ad347f56cc1dfb6815b78e846d9 +++ b/src/main/generated/.cache/282910bf22b00ad347f56cc1dfb6815b78e846d9 @@ -1,5 +1,5 @@ -// 1.20.1 2023-09-08T23:52:29.3559643 EnderStorage Item models -a163c9ce1e63e428f3fa804b66e491b455f18540 assets/enderstorage/models/item/ender_chest.json +// 1.20.1 2023-11-13T04:01:20.744430711 EnderStorage Item models +acba8f17e2d7962b4f284bd0141fb59b507bce0a assets/enderstorage/models/item/ender_chest.json e56e5f4371f82507db4f3edcd5514ff7a7c9b91c assets/enderstorage/models/item/ender_pouch.json d85340997885467c20e49061f74a4858f9a276fd assets/enderstorage/models/item/ender_pouch_button_left_black.json 7e07a5bb75528acb4596870d5e8420545f848888 assets/enderstorage/models/item/ender_pouch_button_left_blue.json @@ -53,4 +53,4 @@ c23266a51bb6eb50d6ee13cb45658690466b7b29 assets/enderstorage/models/item/ender_p 4f79a4c9572e3d1f01b41505c777038ea2c72b85 assets/enderstorage/models/item/ender_pouch_open.json bca93d7cdab91d358aa60130acba6f555663a3b2 assets/enderstorage/models/item/ender_pouch_owned_closed.json 9cc9edaa2b3e3572f77a34d3ec878c8e0ebd4f75 assets/enderstorage/models/item/ender_pouch_owned_open.json -a163c9ce1e63e428f3fa804b66e491b455f18540 assets/enderstorage/models/item/ender_tank.json +e27ce04e6f2a4fc9cfe7f7816f9e5c7081b91958 assets/enderstorage/models/item/ender_tank.json diff --git a/src/main/generated/assets/enderstorage/models/item/ender_chest.json b/src/main/generated/assets/enderstorage/models/item/ender_chest.json index 1bcbb31..807d481 100644 --- a/src/main/generated/assets/enderstorage/models/item/ender_chest.json +++ b/src/main/generated/assets/enderstorage/models/item/ender_chest.json @@ -1,3 +1,5 @@ { - "parent": "minecraft:item/generated" + "parent": "minecraft:item/generated", + "class": "codechicken.enderstorage.client.render.item.EnderChestItemRender", + "loader": "codechickenlib:class" } \ No newline at end of file diff --git a/src/main/generated/assets/enderstorage/models/item/ender_tank.json b/src/main/generated/assets/enderstorage/models/item/ender_tank.json index 1bcbb31..c0ed205 100644 --- a/src/main/generated/assets/enderstorage/models/item/ender_tank.json +++ b/src/main/generated/assets/enderstorage/models/item/ender_tank.json @@ -1,3 +1,5 @@ { - "parent": "minecraft:item/generated" + "parent": "minecraft:item/generated", + "class": "codechicken.enderstorage.client.render.item.EnderTankItemRender", + "loader": "codechickenlib:class" } \ No newline at end of file diff --git a/src/main/java/codechicken/enderstorage/init/ClientInit.java b/src/main/java/codechicken/enderstorage/init/ClientInit.java index 924d930..77976a3 100644 --- a/src/main/java/codechicken/enderstorage/init/ClientInit.java +++ b/src/main/java/codechicken/enderstorage/init/ClientInit.java @@ -4,25 +4,19 @@ import codechicken.enderstorage.client.Shaders; import codechicken.enderstorage.client.gui.GuiEnderItemStorage; import codechicken.enderstorage.client.render.entity.TankLayerRenderer; -import codechicken.enderstorage.client.render.item.EnderChestItemRender; -import codechicken.enderstorage.client.render.item.EnderTankItemRender; import codechicken.enderstorage.client.render.tile.RenderTileEnderChest; import codechicken.enderstorage.client.render.tile.RenderTileEnderTank; import codechicken.enderstorage.config.EnderStorageConfig; import codechicken.enderstorage.manager.EnderStorageManager; import codechicken.enderstorage.storage.EnderItemStorage; -import codechicken.lib.model.ModelRegistryHelper; import net.covers1624.quack.util.CrashLock; import net.minecraft.client.gui.screens.MenuScreens; import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.item.ClampedItemPropertyFunction; import net.minecraft.client.renderer.item.ItemProperties; -import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.client.event.EntityRenderersEvent; -import net.minecraftforge.client.event.ModelEvent; -import net.minecraftforge.client.event.RegisterColorHandlersEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -37,8 +31,6 @@ public class ClientInit { private static final CrashLock LOCK = new CrashLock("Already Initialized."); - public static final ModelRegistryHelper modelHelper = new ModelRegistryHelper(); - public static void init() { LOCK.lock(); IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); @@ -69,9 +61,6 @@ private static void onClientSetupEvent(FMLClientSetupEvent event) { MenuScreens.register(ENDER_ITEM_STORAGE.get(), GuiEnderItemStorage::new); event.enqueueWork(ClientInit::registerPredicates); - - modelHelper.register(new ModelResourceLocation(ENDER_CHEST_ITEM.getId(), "inventory"), new EnderChestItemRender()); - modelHelper.register(new ModelResourceLocation(ENDER_TANK_ITEM.getId(), "inventory"), new EnderTankItemRender()); } private static void registerPredicates() { @@ -102,5 +91,4 @@ private static void registerPredicates() { ); } - } diff --git a/src/main/java/codechicken/enderstorage/init/DataGenerators.java b/src/main/java/codechicken/enderstorage/init/DataGenerators.java index 217835c..d18444a 100644 --- a/src/main/java/codechicken/enderstorage/init/DataGenerators.java +++ b/src/main/java/codechicken/enderstorage/init/DataGenerators.java @@ -1,5 +1,7 @@ package codechicken.enderstorage.init; +import codechicken.enderstorage.client.render.item.EnderChestItemRender; +import codechicken.enderstorage.client.render.item.EnderTankItemRender; import codechicken.lib.colour.EnumColour; import codechicken.lib.datagen.ItemModelProvider; import net.minecraft.core.HolderLookup; @@ -47,8 +49,8 @@ public ItemModels(PackOutput output, ExistingFileHelper existingFileHelper) { @Override protected void registerModels() { - generated(ENDER_CHEST_ITEM).noTexture(); - generated(ENDER_TANK_ITEM).noTexture(); + clazz(ENDER_CHEST_ITEM, EnderChestItemRender.class); + clazz(ENDER_TANK_ITEM, EnderTankItemRender.class); CompositeLoaderBuilder bag = generated(ENDER_POUCH) .noTexture()