Skip to content

Commit

Permalink
Add musicDiscItem Method to ItemModelProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
JT122406 committed Oct 14, 2024
1 parent 2297188 commit d345c58
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
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

0 comments on commit d345c58

Please sign in to comment.