diff --git a/src/main/java/net/neoforged/neoforge/client/model/generators/ItemModelProvider.java b/src/main/java/net/neoforged/neoforge/client/model/generators/ItemModelProvider.java index 046ef31566..2553917d82 100644 --- a/src/main/java/net/neoforged/neoforge/client/model/generators/ItemModelProvider.java +++ b/src/main/java/net/neoforged/neoforge/client/model/generators/ItemModelProvider.java @@ -51,6 +51,16 @@ public ItemModelBuilder spawnEggItem(ResourceLocation item) { .parent(new ModelFile.UncheckedModelFile("item/template_spawn_egg")); } + public ItemModelBuilder musicDiscItem(Item item) { + return musicDiscItem(Objects.requireNonNull(BuiltInRegistries.ITEM.getKey(item))); + } + + public ItemModelBuilder musicDiscItem(ResourceLocation item) { + return getBuilder(item.toString()) + .parent(new ModelFile.UncheckedModelFile("item/template_music_disc")) + .texture("layer0", ResourceLocation.fromNamespaceAndPath(item.getNamespace(), "item/" + item.getPath())); + } + public ItemModelBuilder simpleBlockItem(Block block) { return simpleBlockItem(Objects.requireNonNull(BuiltInRegistries.BLOCK.getKey(block))); } diff --git a/tests/src/generated/resources/assets/minecraft/models/item/music_disc_13.json b/tests/src/generated/resources/assets/minecraft/models/item/music_disc_13.json new file mode 100644 index 0000000000..eb7eee8b77 --- /dev/null +++ b/tests/src/generated/resources/assets/minecraft/models/item/music_disc_13.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/template_music_disc", + "textures": { + "layer0": "minecraft:item/music_disc_13" + } +} \ No newline at end of file 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 c281cc6ee4..47c596a638 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 @@ -173,6 +173,8 @@ protected void registerModels() { spawnEggItem(Items.SHEEP_SPAWN_EGG); + musicDiscItem(Items.MUSIC_DISC_13); + simpleBlockItem(Blocks.ACACIA_PLANKS); } }