Move fuel handling to new event

This commit is contained in:
Nicholas Ignoffo 2018-03-01 19:40:37 -08:00
parent 70d98455b7
commit f025407014
3 changed files with 9 additions and 20 deletions

View file

@ -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;
}
}

View file

@ -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();
}

View file

@ -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)));
}
}