Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mierzen.lavafurnace;
- import net.minecraft.block.Block;
- import net.minecraft.block.BlockFurnace;
- import net.minecraft.init.Blocks;
- import net.minecraft.item.ItemStack;
- import net.minecraft.item.crafting.FurnaceRecipes;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.tileentity.TileEntityFurnace;
- public class FuelTileEntity extends TileEntity
- {
- @Override
- public void updateEntity()
- {
- if (!worldObj.isRemote)
- {
- Block block = worldObj.getBlock(xCoord, yCoord+1, zCoord);
- if (block == Blocks.furnace)
- {
- TileEntity tile = worldObj.getTileEntity(xCoord, yCoord+1, zCoord);
- TileEntityFurnace furnace = (TileEntityFurnace)tile;
- ItemStack toBurn = furnace.getStackInSlot(0);
- if (toBurn != null)
- {
- ItemStack toBurnSmeltResult = FurnaceRecipes.smelting().getSmeltingResult(toBurn);
- ItemStack currentOutput = furnace.getStackInSlot(2);
- if (toBurnSmeltResult != null && (currentOutput == null || currentOutput.getUnlocalizedName() == toBurnSmeltResult.getUnlocalizedName()) && furnace.getBurnTimeRemainingScaled(100)<=1)
- {
- BlockFurnace.updateFurnaceBlockState(true, worldObj, xCoord, yCoord+1, zCoord);
- furnace.furnaceBurnTime = 400;
- }
- }
- }
- }
- super.updateEntity();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement