Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add musicDiscItem Method to ItemModelProvider #1588

Open
wants to merge 1 commit into
base: 1.21.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/template_music_disc",
"textures": {
"layer0": "minecraft:item/music_disc_13"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ protected void registerModels() {

spawnEggItem(Items.SHEEP_SPAWN_EGG);

musicDiscItem(Items.MUSIC_DISC_13);

simpleBlockItem(Blocks.ACACIA_PLANKS);
}
}
Expand Down