From 0ba7607b5be0959211d0355295462f9019ed963e Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Sat, 22 Feb 2025 23:53:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8D=AF=E5=BC=B9=E7=9A=84?= =?UTF-8?q?=E8=B4=B4=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/atsuishio/superbwarfare/ModUtils.java | 10 ++++++++-- .../models/item/potion_mortar_shell.json | 7 +++++++ .../textures/item/potion_mortar_shell_base.png | Bin 0 -> 744 bytes .../textures/item/potion_mortar_shell_overlay.png | Bin 0 -> 589 bytes 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/assets/superbwarfare/models/item/potion_mortar_shell.json create mode 100644 src/main/resources/assets/superbwarfare/textures/item/potion_mortar_shell_base.png create mode 100644 src/main/resources/assets/superbwarfare/textures/item/potion_mortar_shell_overlay.png diff --git a/src/main/java/com/atsuishio/superbwarfare/ModUtils.java b/src/main/java/com/atsuishio/superbwarfare/ModUtils.java index dd3edec50..e5d94c5ae 100644 --- a/src/main/java/com/atsuishio/superbwarfare/ModUtils.java +++ b/src/main/java/com/atsuishio/superbwarfare/ModUtils.java @@ -14,6 +14,7 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.alchemy.PotionUtils; import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraftforge.client.event.RegisterColorHandlersEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.brewing.BrewingRecipeRegistry; import net.minecraftforge.event.TickEvent; @@ -69,10 +70,15 @@ public class ModUtils { bus.addListener(this::onCommonSetup); bus.addListener(this::onClientSetup); + bus.addListener(this::onRegisterColorHandlers); MinecraftForge.EVENT_BUS.register(this); } + public static ResourceLocation loc(String path) { + return new ResourceLocation(MODID, path); + } + private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel PACKET_HANDLER = NetworkRegistry.newSimpleChannel(new ResourceLocation(MODID, MODID), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals); private static int messageID = 0; @@ -184,7 +190,7 @@ public class ModUtils { MouseMovementHandler.init(); } - public static ResourceLocation loc(String path) { - return new ResourceLocation(MODID, path); + public void onRegisterColorHandlers(final RegisterColorHandlersEvent.Item event) { + event.register((stack, count) -> count == 0 ? PotionUtils.getColor(stack) : -1, ModItems.POTION_MORTAR_SHELL.get()); } } diff --git a/src/main/resources/assets/superbwarfare/models/item/potion_mortar_shell.json b/src/main/resources/assets/superbwarfare/models/item/potion_mortar_shell.json new file mode 100644 index 000000000..b47bbe6b2 --- /dev/null +++ b/src/main/resources/assets/superbwarfare/models/item/potion_mortar_shell.json @@ -0,0 +1,7 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "superbwarfare:item/potion_mortar_shell_overlay", + "layer1": "superbwarfare:item/potion_mortar_shell_base" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/superbwarfare/textures/item/potion_mortar_shell_base.png b/src/main/resources/assets/superbwarfare/textures/item/potion_mortar_shell_base.png new file mode 100644 index 0000000000000000000000000000000000000000..f356d89aaca5617865315232f18196385a855a91 GIT binary patch literal 744 zcmVP)EX>4Tx04R}tkv&MmKpe$iQ>7x64i*t{$WWcELltq9Di*;)X)CnqU~=gfG-*gu zTpR`0f`cE6RRK2d-P^xs+Wq|i5ovPf`P%8!00006VoOIv0D%Bd0EL9BdqMyJ010qNS#tmY zE+YT{E+YYWr9XB6000McNliru=>irHF$GUX56J)k02y>eSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{006*AL_t(I%e|7pt%6VxMUOvrz>e2|c{^5bO){0x$PZmG z9Z&=bC9uRb3ASEX>4Tx04R}tkv&MmKpe$iQ>7x64i*t{$WWcELltq9Di*;)X)CnqU~=gfG-*gu zTpR`0f`cE6RRK2d-P^xs+Wq|i5ovPf`P%8!00006VoOIv0D%Bd0EL9BdqMyJ010qNS#tmY zE+YT{E+YYWr9XB6000McNliru=>irHFgbZLLJt4{02y>eSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{001RPL_t(I%VS^|IpFv2-~TB#