diff --git a/patches/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches/net/minecraft/client/resources/model/ModelBakery.java.patch index 71cd42db56..17e954dd06 100644 --- a/patches/net/minecraft/client/resources/model/ModelBakery.java.patch +++ b/patches/net/minecraft/client/resources/model/ModelBakery.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/resources/model/ModelBakery.java +++ b/net/minecraft/client/resources/model/ModelBakery.java -@@ -117,6 +_,13 @@ +@@ -117,6 +_,12 @@ p_252014_.popPush("special"); this.loadSpecialItemModelAndDependencies(ItemRenderer.TRIDENT_IN_HAND_MODEL); this.loadSpecialItemModelAndDependencies(ItemRenderer.SPYGLASS_IN_HAND_MODEL); @@ -8,7 +8,6 @@ + net.neoforged.neoforge.client.ClientHooks.onRegisterAdditionalModels(additionalModels); + for (ModelResourceLocation rl : additionalModels) { + UnbakedModel unbakedmodel = this.getModel(rl.id()); -+ this.unbakedCache.put(rl.id(), unbakedmodel); + this.registerModelAndLoadDependencies(rl, unbakedmodel); + } this.topLevelModels.values().forEach(p_247954_ -> p_247954_.resolveParents(this::getModel)); diff --git a/patches/net/minecraft/client/resources/model/ModelResourceLocation.java.patch b/patches/net/minecraft/client/resources/model/ModelResourceLocation.java.patch index ec200edc69..de31fc2069 100644 --- a/patches/net/minecraft/client/resources/model/ModelResourceLocation.java.patch +++ b/patches/net/minecraft/client/resources/model/ModelResourceLocation.java.patch @@ -4,18 +4,21 @@ @OnlyIn(Dist.CLIENT) public record ModelResourceLocation(ResourceLocation id, String variant) { public static final String INVENTORY_VARIANT = "inventory"; -+ public static final String NEOFORGE_SPECIAL_VARIANT = "neoforge_special"; ++ public static final String NEOFORGE_STANDALONE_VARIANT = "neoforge_standalone"; public ModelResourceLocation(ResourceLocation id, String variant) { variant = lowercaseVariant(variant); -@@ -21,6 +_,10 @@ +@@ -21,6 +_,13 @@ public static ModelResourceLocation inventory(ResourceLocation p_352141_) { return new ModelResourceLocation(p_352141_, "inventory"); + } + -+ public static ModelResourceLocation neoforgeSpecial(ResourceLocation id) { -+ return new ModelResourceLocation(id, NEOFORGE_SPECIAL_VARIANT); ++ /** ++ * Construct a {@code ModelResourceLocation} for use in the {@link net.neoforged.neoforge.client.event.ModelEvent.RegisterAdditional} ++ */ ++ public static ModelResourceLocation neoForgeStandalone(ResourceLocation id) { ++ return new ModelResourceLocation(id, NEOFORGE_STANDALONE_VARIANT); } private static String lowercaseVariant(String p_248567_) { 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 eab02b04e1..0a9ecec29d 100644 --- a/src/main/java/net/neoforged/neoforge/client/event/ModelEvent.java +++ b/src/main/java/net/neoforged/neoforge/client/event/ModelEvent.java @@ -129,7 +129,8 @@ public ModelBakery getModelBakery() { /** * Fired when the {@link net.minecraft.client.resources.model.ModelBakery} is notified of the resource manager reloading. - * Allows developers to register models to be loaded, along with their dependencies. + * Allows developers to register models to be loaded, along with their dependencies. Models registered through this + * event must use the {@link ModelResourceLocation#NEOFORGE_STANDALONE_VARIANT} variant * *

This event is not {@linkplain ICancellableEvent cancellable}, and does not {@linkplain HasResult have a result}.

* @@ -148,8 +149,8 @@ public RegisterAdditional(Set models) { */ public void register(ModelResourceLocation model) { Preconditions.checkArgument( - model.getVariant().equals(ModelResourceLocation.NEOFORGE_SPECIAL_VARIANT), - "Side-loaded models must use the '" + ModelResourceLocation.NEOFORGE_SPECIAL_VARIANT + "' variant"); + model.getVariant().equals(ModelResourceLocation.NEOFORGE_STANDALONE_VARIANT), + "Side-loaded models must use the '" + ModelResourceLocation.NEOFORGE_STANDALONE_VARIANT + "' variant"); models.add(model); } } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/rendering/RenderableTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/rendering/RenderableTest.java index 0ebcb4a52a..e748a515ac 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/rendering/RenderableTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/rendering/RenderableTest.java @@ -67,7 +67,7 @@ public RenderableTest(IEventBus modEventBus) { } private static class Client { - private static ModelResourceLocation MODEL_LOC = ModelResourceLocation.neoforgeSpecial( + private static ModelResourceLocation MODEL_LOC = ModelResourceLocation.neoForgeStandalone( ResourceLocation.fromNamespaceAndPath("minecraft", "block/blue_stained_glass")); private static IRenderable renderable;