DRY for IronAlloySmelter fuel burn time

This commit is contained in:
drcrazy 2019-02-13 11:20:52 +03:00
parent 008358b39c
commit fbcab3bf2d

View file

@ -30,6 +30,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.*; import net.minecraft.item.*;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import reborncore.api.IToolDrop; import reborncore.api.IToolDrop;
import reborncore.api.recipe.IBaseRecipeType; import reborncore.api.recipe.IBaseRecipeType;
@ -68,63 +69,15 @@ public class TileIronAlloyFurnace extends TileLegacyMachineBase
/** /**
* Returns the number of ticks that the supplied fuel item will keep the * Returns the number of ticks that the supplied fuel item will keep the
* furnace burning, or 0 if the item isn't fuel * alloy furnace burning, or 0 if the item isn't fuel
* @param stack Itemstack of fuel * @param stack Itemstack of fuel
* @return Integer Number of ticks * @return Integer Number of ticks
*/ */
public static int getItemBurnTime(ItemStack stack) { public static int getItemBurnTime(ItemStack stack) {
if (stack.isEmpty()) { if (stack.isEmpty()) {
return 0; return 0;
} else {
int burnTime = net.minecraftforge.event.ForgeEventFactory.getItemBurnTime(stack);
if (burnTime >= 0)
return burnTime;
Item item = stack.getItem();
if (item == Item.getItemFromBlock(Blocks.WOODEN_SLAB)) {
return 150;
} else if (item == Item.getItemFromBlock(Blocks.WOOL)) {
return 100;
} else if (item == Item.getItemFromBlock(Blocks.CARPET)) {
return 67;
} else if (item == Item.getItemFromBlock(Blocks.LADDER)) {
return 300;
} else if (item == Item.getItemFromBlock(Blocks.WOODEN_BUTTON)) {
return 100;
} else if (Block.getBlockFromItem(item).getDefaultState().getMaterial() == Material.WOOD) {
return 300;
} else if (item == Item.getItemFromBlock(Blocks.COAL_BLOCK)) {
return 16000;
} else if (item instanceof ItemTool && "WOOD".equals(((ItemTool) item).getToolMaterialName())) {
return 200;
} else if (item instanceof ItemSword && "WOOD".equals(((ItemSword) item).getToolMaterialName())) {
return 200;
} else if (item instanceof ItemHoe && "WOOD".equals(((ItemHoe) item).getMaterialName())) {
return 200;
} else if (item == Items.STICK) {
return 100;
} else if (item != Items.BOW && item != Items.FISHING_ROD) {
if (item == Items.SIGN) {
return 200;
} else if (item == Items.COAL) {
return 1600;
} else if (item == Items.LAVA_BUCKET) {
return 20000;
} else if (item != Item.getItemFromBlock(Blocks.SAPLING) && item != Items.BOWL) {
if (item == Items.BLAZE_ROD) {
return 2400;
} else if (item instanceof ItemDoor && item != Items.IRON_DOOR) {
return 200;
} else {
return item instanceof ItemBoat ? 400 : 0;
}
} else {
return 100;
}
} else {
return 300;
}
} }
return (int) (TileEntityFurnace.getItemBurnTime(stack) * 1.25);
} }
@Override @Override