diff --git a/patches/net/minecraft/client/renderer/block/model/ItemTransforms.java.patch b/patches/net/minecraft/client/renderer/block/model/ItemTransforms.java.patch index 6356131987..a341611fbb 100644 --- a/patches/net/minecraft/client/renderer/block/model/ItemTransforms.java.patch +++ b/patches/net/minecraft/client/renderer/block/model/ItemTransforms.java.patch @@ -40,7 +40,7 @@ this.thirdPersonLeftHand = p_111798_; this.thirdPersonRightHand = p_111799_; this.firstPersonLeftHand = p_111800_; -@@ -64,6 +_,7 @@ +@@ -64,9 +_,21 @@ this.gui = p_111803_; this.ground = p_111804_; this.fixed = p_111805_; @@ -48,6 +48,20 @@ } public ItemTransform getTransform(ItemDisplayContext p_270619_) { ++ if (p_270619_.isModded()) { ++ ItemTransform moddedTransform = moddedTransforms.get(p_270619_); ++ if (moddedTransform != null) { ++ return moddedTransform; ++ } ++ ItemDisplayContext moddedFallback = p_270619_.fallback(); ++ if (moddedFallback == null) { ++ return ItemTransform.NO_TRANSFORM; ++ } ++ p_270619_ = moddedFallback; ++ } + return switch (p_270619_) { + case THIRD_PERSON_LEFT_HAND -> this.thirdPersonLeftHand; + case THIRD_PERSON_RIGHT_HAND -> this.thirdPersonRightHand; @@ -104,9 +_,23 @@ ItemTransform itemtransform5 = this.getTransform(p_111822_, jsonobject, ItemDisplayContext.GUI); ItemTransform itemtransform6 = this.getTransform(p_111822_, jsonobject, ItemDisplayContext.GROUND); diff --git a/tests/src/generated/resources/assets/minecraft/models/item/stick.json b/tests/src/generated/resources/assets/minecraft/models/item/stick.json index e3c18581e5..4e9498d758 100644 --- a/tests/src/generated/resources/assets/minecraft/models/item/stick.json +++ b/tests/src/generated/resources/assets/minecraft/models/item/stick.json @@ -1,7 +1,7 @@ { "parent": "minecraft:item/generated", "display": { - "custom_transformtype_test:hanging": { + "neotests:hanging": { "rotation": [ 62, 147, diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/model/CustomItemDisplayContextTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/model/CustomItemDisplayContextTest.java index 12302809fb..9c6ce94624 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/model/CustomItemDisplayContextTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/model/CustomItemDisplayContextTest.java @@ -237,10 +237,8 @@ public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt, H @Override protected void saveAdditional(CompoundTag tag, HolderLookup.Provider holderLookup) { super.saveAdditional(tag, holderLookup); - var c = new CompoundTag(); if (heldItem != null) { - heldItem.save(holderLookup, c); - tag.put("item", c); + tag.put("item", heldItem.save(holderLookup, new CompoundTag())); } }