From f025407014c85896fa28c7f872660eec6feb5920 Mon Sep 17 00:00:00 2001 From: Nicholas Ignoffo Date: Thu, 1 Mar 2018 19:40:37 -0800 Subject: [PATCH] Move fuel handling to new event --- .../WayofTime/bloodmagic/fuel/FuelHandler.java | 17 ----------------- .../WayofTime/bloodmagic/proxy/CommonProxy.java | 3 --- .../util/handler/event/CraftingHandler.java | 9 +++++++++ 3 files changed, 9 insertions(+), 20 deletions(-) delete mode 100644 src/main/java/WayofTime/bloodmagic/fuel/FuelHandler.java diff --git a/src/main/java/WayofTime/bloodmagic/fuel/FuelHandler.java b/src/main/java/WayofTime/bloodmagic/fuel/FuelHandler.java deleted file mode 100644 index 29b01c00..00000000 --- a/src/main/java/WayofTime/bloodmagic/fuel/FuelHandler.java +++ /dev/null @@ -1,17 +0,0 @@ -package WayofTime.bloodmagic.fuel; - -import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; -import WayofTime.bloodmagic.item.types.ComponentTypes; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.IFuelHandler; - -public class FuelHandler implements IFuelHandler { - @Override - public int getBurnTime(ItemStack fuel) { - if (fuel != null && fuel.getItem() == RegistrarBloodMagicItems.COMPONENT && fuel.getMetadata() == ComponentTypes.SAND_COAL.ordinal()) { - return 1600; - } - - return 0; - } -} diff --git a/src/main/java/WayofTime/bloodmagic/proxy/CommonProxy.java b/src/main/java/WayofTime/bloodmagic/proxy/CommonProxy.java index bfc6ee8d..34643085 100644 --- a/src/main/java/WayofTime/bloodmagic/proxy/CommonProxy.java +++ b/src/main/java/WayofTime/bloodmagic/proxy/CommonProxy.java @@ -3,7 +3,6 @@ package WayofTime.bloodmagic.proxy; import WayofTime.bloodmagic.ritual.data.CapabilityRuneType; import WayofTime.bloodmagic.ritual.data.IRitualStone; import WayofTime.bloodmagic.teleport.TeleportQueue; -import WayofTime.bloodmagic.fuel.FuelHandler; import com.google.common.collect.ImmutableMap; import net.minecraft.block.Block; import net.minecraft.item.Item; @@ -13,12 +12,10 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.animation.ITimeValue; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.model.animation.IAnimationStateMachine; -import net.minecraftforge.fml.common.registry.GameRegistry; public class CommonProxy { public void preInit() { MinecraftForge.EVENT_BUS.register(TeleportQueue.getInstance()); - GameRegistry.registerFuelHandler(new FuelHandler()); registerRenderers(); } diff --git a/src/main/java/WayofTime/bloodmagic/util/handler/event/CraftingHandler.java b/src/main/java/WayofTime/bloodmagic/util/handler/event/CraftingHandler.java index 1eafcbe6..119e96a2 100644 --- a/src/main/java/WayofTime/bloodmagic/util/handler/event/CraftingHandler.java +++ b/src/main/java/WayofTime/bloodmagic/util/handler/event/CraftingHandler.java @@ -1,6 +1,7 @@ package WayofTime.bloodmagic.util.handler.event; import WayofTime.bloodmagic.BloodMagic; +import WayofTime.bloodmagic.item.types.ComponentTypes; import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.event.AltarCraftedEvent; import WayofTime.bloodmagic.iface.IUpgradeTrainer; @@ -15,8 +16,10 @@ import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemBanner; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntityFurnace; import net.minecraftforge.common.ForgeModContainer; import net.minecraftforge.event.AnvilUpdateEvent; +import net.minecraftforge.event.furnace.FurnaceFuelBurnTimeEvent; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; @@ -137,4 +140,10 @@ public class CraftingHandler { } } } + + @SubscribeEvent + public static void handleFuelLevel(FurnaceFuelBurnTimeEvent event) { + if (event.getItemStack().getItem() == RegistrarBloodMagicItems.COMPONENT && event.getItemStack().getMetadata() == ComponentTypes.SAND_COAL.ordinal()) + event.setBurnTime(TileEntityFurnace.getItemBurnTime(new ItemStack(Items.COAL))); + } }