From 08e8a86b4b0f8a61d31bbb4a8e2c44c797f56406 Mon Sep 17 00:00:00 2001 From: Benjamin <76600137+IllagerCaptain@users.noreply.github.com> Date: Mon, 19 Jun 2023 23:01:05 -0500 Subject: [PATCH] Add textures for "Song Items" (#22) --- .../hhhzzzsss/songplayer/item/SongItemUtils.java | 4 ++++ .../assets/minecraft/models/item/paper.json | 13 +++++++++++++ .../assets/songplayer/models/item/song_item.json | 7 +++++++ .../assets/songplayer/textures/item/song_item.png | Bin 0 -> 150 bytes 4 files changed, 24 insertions(+) create mode 100644 src/main/resources/assets/minecraft/models/item/paper.json create mode 100644 src/main/resources/assets/songplayer/models/item/song_item.json create mode 100644 src/main/resources/assets/songplayer/textures/item/song_item.png diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/item/SongItemUtils.java b/src/main/java/com/github/hhhzzzsss/songplayer/item/SongItemUtils.java index 6e2510f..3916706 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/item/SongItemUtils.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/item/SongItemUtils.java @@ -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)); diff --git a/src/main/resources/assets/minecraft/models/item/paper.json b/src/main/resources/assets/minecraft/models/item/paper.json new file mode 100644 index 0000000..3e143a7 --- /dev/null +++ b/src/main/resources/assets/minecraft/models/item/paper.json @@ -0,0 +1,13 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/paper" + }, + "overrides": [{ + "predicate": { + "custom_model_data": 751642938 + }, + "model": "songplayer:item/song_item" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/songplayer/models/item/song_item.json b/src/main/resources/assets/songplayer/models/item/song_item.json new file mode 100644 index 0000000..a76b412 --- /dev/null +++ b/src/main/resources/assets/songplayer/models/item/song_item.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "minecraft:item/paper", + "layer1": "songplayer:item/song_item" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/songplayer/textures/item/song_item.png b/src/main/resources/assets/songplayer/textures/item/song_item.png new file mode 100644 index 0000000000000000000000000000000000000000..a79f51a0c073866f76a6ce2f98db9ef0ebe72799 GIT binary patch literal 150 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL2XYL#}EtuWC_+U%>Nh8$Y}^R7M`LeZQzs{ q!*DZgO;%?qqhhz)K?Wu^HijwdSXgW{+?;^g7(8A5T-G@yGywn_C?)s+ literal 0 HcmV?d00001