diff --git a/MODSRC/vazkii/botania/api/item/IExoflameHeatable.java b/MODSRC/vazkii/botania/api/item/IExoflameHeatable.java new file mode 100644 index 000000000..18c8b92e9 --- /dev/null +++ b/MODSRC/vazkii/botania/api/item/IExoflameHeatable.java @@ -0,0 +1,44 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Aug 30, 2014, 4:28:29 PM (GMT)] + */ +package vazkii.botania.api.item; + +/** + * A TileEntity that implements this can be heated by an Exoflame flower. + */ +public interface IExoflameHeatable { + + /** + * Can this TileEntity smelt its contents. If true, the Exoflame is allowed + * to fuel it. + */ + public boolean canSmelt(); + + /** + * Gets the amount of ticks left for the fuel. If below 2, the exoflame + * will call boostBurnTime. + */ + public int getBurnTime(); + + /** + * Called to increase the amount of time this furnace should be burning + * the fuel for. Even if it doesn't have any fuel. + */ + public void boostBurnTime(); + + /** + * Called once every two ticks to increase the speed of the furnace. Feel + * free to not do anything if all you want is to allow the exoflame to feed + * it, not make it faster. + */ + public void boostCookTime(); + +} diff --git a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileExoflame.java b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileExoflame.java index 8478da003..7542fdbf5 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileExoflame.java +++ b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileExoflame.java @@ -16,6 +16,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFurnace; +import vazkii.botania.api.item.IExoflameHeatable; import vazkii.botania.api.subtile.SubTileFunctional; public class SubTileExoflame extends SubTileFunctional { @@ -36,22 +37,38 @@ public class SubTileExoflame extends SubTileFunctional { int z = supertile.zCoord + k; TileEntity tile = supertile.getWorldObj().getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityFurnace) { - TileEntityFurnace furnace = (TileEntityFurnace) tile; - boolean canSmelt = canFurnaceSmelt(furnace); - if(canSmelt && mana > 2) { - if(furnace.furnaceBurnTime < 2) { - if(furnace.furnaceBurnTime == 0) - BlockFurnace.updateFurnaceBlockState(true, supertile.getWorldObj(), x, y, z); - furnace.furnaceBurnTime = 200; + if(tile != null) { + if(tile instanceof TileEntityFurnace) { + TileEntityFurnace furnace = (TileEntityFurnace) tile; + boolean canSmelt = canFurnaceSmelt(furnace); + if(canSmelt && mana > 2) { + if(furnace.furnaceBurnTime < 2) { + if(furnace.furnaceBurnTime == 0) + BlockFurnace.updateFurnaceBlockState(true, supertile.getWorldObj(), x, y, z); + furnace.furnaceBurnTime = 200; + } + if(supertile.getWorldObj().getTotalWorldTime() % 2 == 0) + furnace.furnaceCookTime = Math.min(199, furnace.furnaceCookTime + 1); + + mana -= 2; + + if(mana == 0) + break fireFurnaces; } - if(supertile.getWorldObj().getTotalWorldTime() % 2 == 0) - furnace.furnaceCookTime = Math.min(199, furnace.furnaceCookTime + 1); + } else if(tile instanceof IExoflameHeatable) { + IExoflameHeatable heatable = (IExoflameHeatable) tile; + + if(heatable.canSmelt() && mana > 2) { + if(heatable.getBurnTime() == 0) + heatable.boostBurnTime(); + if(supertile.getWorldObj().getTotalWorldTime() % 2 == 0) + heatable.boostCookTime(); - mana -= 2; + mana -= 2; - if(mana == 0) - break fireFurnaces; + if(mana == 0) + break fireFurnaces; + } } } }