Add textures for "Song Items" (#22)

This commit is contained in:
Benjamin 2023-06-19 23:01:05 -05:00 committed by GitHub
parent 83651896eb
commit 08e8a86b4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 0 deletions

View file

@ -15,8 +15,12 @@ public class SongItemUtils {
public static final String SONG_DATA_KEY = "SongData";
public static final String FILE_NAME_KEY = "FileName";
public static final String DISPLAY_NAME_KEY = "DisplayName";
public static final String MODEL_KEY = "CustomModelData";
public static ItemStack createSongItem(ItemStack stack, byte[] songData, String filename, String displayName) {
NbtCompound songPlayerInitNbt = new NbtCompound();
songPlayerInitNbt.putInt(MODEL_KEY, new Integer("751642938"));
stack.setNbt(songPlayerInitNbt);
NbtCompound songPlayerNbt = new NbtCompound();
stack.setSubNbt(SONG_ITEM_KEY, songPlayerNbt);
songPlayerNbt.putString(SONG_DATA_KEY, Base64.getEncoder().encodeToString(songData));

View file

@ -0,0 +1,13 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/paper"
},
"overrides": [{
"predicate": {
"custom_model_data": 751642938
},
"model": "songplayer:item/song_item"
}
]
}

View file

@ -0,0 +1,7 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/paper",
"layer1": "songplayer:item/song_item"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B