diff --git a/patches/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches/net/minecraft/client/resources/model/ModelBakery.java.patch index c23ef8e93e5..6bf9e89377c 100644 --- a/patches/net/minecraft/client/resources/model/ModelBakery.java.patch +++ b/patches/net/minecraft/client/resources/model/ModelBakery.java.patch @@ -1,16 +1,15 @@ --- a/net/minecraft/client/resources/model/ModelBakery.java +++ b/net/minecraft/client/resources/model/ModelBakery.java -@@ -117,6 +_,14 @@ +@@ -117,6 +_,13 @@ p_252014_.popPush("special"); this.loadSpecialItemModelAndDependencies(ItemRenderer.TRIDENT_IN_HAND_MODEL); this.loadSpecialItemModelAndDependencies(ItemRenderer.SPYGLASS_IN_HAND_MODEL); -+ Set additionalModels = new HashSet<>(); ++ Set additionalModels = new HashSet<>(); + net.neoforged.neoforge.client.ClientHooks.onRegisterAdditionalModels(additionalModels); -+ for (ResourceLocation rl : additionalModels) { -+ UnbakedModel unbakedmodel = this.getModel(rl); // loadTopLevel(...), but w/o ModelResourceLocation limitation -+ this.unbakedCache.put(rl, unbakedmodel); -+ // TODO 1.21 - Port model loading to handle MRLs -+ //this.topLevelModels.put(rl, unbakedmodel); ++ for (ModelResourceLocation rl : additionalModels) { ++ UnbakedModel unbakedmodel = this.getModel(rl.id()); ++ this.unbakedCache.put(rl.id(), unbakedmodel); ++ this.topLevelModels.put(rl, unbakedmodel); + } this.topLevelModels.values().forEach(p_247954_ -> p_247954_.resolveParents(this::getModel)); p_252014_.pop(); diff --git a/patches/net/minecraft/client/resources/model/ModelManager.java.patch b/patches/net/minecraft/client/resources/model/ModelManager.java.patch index b94636414e7..dd6edb6544f 100644 --- a/patches/net/minecraft/client/resources/model/ModelManager.java.patch +++ b/patches/net/minecraft/client/resources/model/ModelManager.java.patch @@ -16,17 +16,6 @@ public ModelManager(TextureManager p_119406_, BlockColors p_119407_, int p_119408_) { this.blockColors = p_119407_; -@@ -78,6 +_,10 @@ - this.atlases = new AtlasSet(VANILLA_ATLASES, p_119406_); - } - -+ public BakedModel getModel(ResourceLocation modelLocation) { -+ return this.bakedRegistry.getOrDefault(modelLocation, this.missingModel); -+ } -+ - public BakedModel getModel(ModelResourceLocation p_119423_) { - return this.bakedRegistry.getOrDefault(p_119423_, this.missingModel); - } @@ -100,6 +_,7 @@ Executor p_249221_ ) { diff --git a/src/main/java/net/neoforged/neoforge/client/ClientHooks.java b/src/main/java/net/neoforged/neoforge/client/ClientHooks.java index 806eeb1d768..1f56c480e91 100644 --- a/src/main/java/net/neoforged/neoforge/client/ClientHooks.java +++ b/src/main/java/net/neoforged/neoforge/client/ClientHooks.java @@ -719,7 +719,7 @@ public static void onRegisterKeyMappings(Options options) { ModLoader.postEvent(new RegisterKeyMappingsEvent(options)); } - public static void onRegisterAdditionalModels(Set additionalModels) { + public static void onRegisterAdditionalModels(Set additionalModels) { ModLoader.postEvent(new ModelEvent.RegisterAdditional(additionalModels)); } diff --git a/src/main/java/net/neoforged/neoforge/client/event/ModelEvent.java b/src/main/java/net/neoforged/neoforge/client/event/ModelEvent.java index 33b5fdde455..6f1bfe492ca 100644 --- a/src/main/java/net/neoforged/neoforge/client/event/ModelEvent.java +++ b/src/main/java/net/neoforged/neoforge/client/event/ModelEvent.java @@ -136,17 +136,17 @@ public ModelBakery getModelBakery() { *

This event is fired on the mod-specific event bus, only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public static class RegisterAdditional extends ModelEvent implements IModBusEvent { - private final Set models; + private final Set models; @ApiStatus.Internal - public RegisterAdditional(Set models) { + public RegisterAdditional(Set models) { this.models = models; } /** * Registers a model to be loaded, along with its dependencies. */ - public void register(ResourceLocation model) { + public void register(ModelResourceLocation model) { models.add(model); } } diff --git a/src/main/java/net/neoforged/neoforge/client/model/renderable/BakedModelRenderable.java b/src/main/java/net/neoforged/neoforge/client/model/renderable/BakedModelRenderable.java index f31f6fa4fae..ec17ba246e7 100644 --- a/src/main/java/net/neoforged/neoforge/client/model/renderable/BakedModelRenderable.java +++ b/src/main/java/net/neoforged/neoforge/client/model/renderable/BakedModelRenderable.java @@ -11,8 +11,8 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; import net.minecraft.world.inventory.InventoryMenu; @@ -37,7 +37,7 @@ public class BakedModelRenderable implements IRenderable renderable; private static IRenderable bakedRenderable;