diff --git a/src/main/java/com/atsuishio/superbwarfare/ModUtils.java b/src/main/java/com/atsuishio/superbwarfare/ModUtils.java index c96cedb39..a74e30abc 100644 --- a/src/main/java/com/atsuishio/superbwarfare/ModUtils.java +++ b/src/main/java/com/atsuishio/superbwarfare/ModUtils.java @@ -14,7 +14,6 @@ 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; @@ -70,7 +69,6 @@ public class ModUtils { bus.addListener(this::onCommonSetup); bus.addListener(this::onClientSetup); - bus.addListener(this::onRegisterColorHandlers); MinecraftForge.EVENT_BUS.register(this); } @@ -189,8 +187,4 @@ public class ModUtils { public void onClientSetup(final FMLClientSetupEvent event) { MouseMovementHandler.init(); } - - public void onRegisterColorHandlers(final RegisterColorHandlersEvent.Item event) { - event.register((stack, layer) -> layer == 1 ? PotionUtils.getColor(stack) : -1, ModItems.POTION_MORTAR_SHELL.get()); - } } diff --git a/src/main/java/com/atsuishio/superbwarfare/item/common/ammo/PotionMortarShell.java b/src/main/java/com/atsuishio/superbwarfare/item/common/ammo/PotionMortarShell.java index 02c12860b..4833c87b7 100644 --- a/src/main/java/com/atsuishio/superbwarfare/item/common/ammo/PotionMortarShell.java +++ b/src/main/java/com/atsuishio/superbwarfare/item/common/ammo/PotionMortarShell.java @@ -1,15 +1,21 @@ package com.atsuishio.superbwarfare.item.common.ammo; +import com.atsuishio.superbwarfare.init.ModItems; import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.alchemy.PotionUtils; import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.level.Level; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.client.event.RegisterColorHandlersEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; import javax.annotation.Nullable; import java.util.List; +@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public class PotionMortarShell extends MortarShell { public PotionMortarShell() { @@ -25,4 +31,9 @@ public class PotionMortarShell extends MortarShell { public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List pTooltip, TooltipFlag pFlag) { PotionUtils.addPotionTooltip(pStack, pTooltip, 0.125F); } + + @SubscribeEvent + public static void onRegisterColorHandlers(final RegisterColorHandlersEvent.Item event) { + event.register((stack, layer) -> layer == 1 ? PotionUtils.getColor(stack) : -1, ModItems.POTION_MORTAR_SHELL.get()); + } }