mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-26 23:13:09 +00:00
More API stuff. Other mods can now tap into the Exoflame and Petal Apothecary. [STARING AT AZANOR INTENSIFIES]
This commit is contained in:
1 parent
c94ee326ee
commit
b1dea5b998
2 files changed
+74
-13
No files matched your search
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. 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();
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user