Compiles for 1.9! Very buggy, some things are missing.

This commit is contained in:
mezz committed 2016-05-05 01:11:21 -07:00
1 parent 5d74c1254b
commit 7bf554b024
135 files changed
+1710 -1919

No files matched your search

@@ -10,49 +10,40 @@
******************************************************************************/
package forestry.farming.triggers;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fluids.IFluidTank;
import forestry.core.fluids.ITankManager;
import forestry.core.triggers.Trigger;
import forestry.farming.tiles.TileFarmHatch;
import buildcraft.api.statements.IStatementContainer;
import buildcraft.api.statements.IStatementParameter;
// TODO: Buildcraft for 1.9
public class TriggerLowLiquid extends Trigger {
private final float threshold;
public TriggerLowLiquid(String tag, float threshold) {
super(tag, "lowLiquid");
// super(tag, "lowLiquid");
this.threshold = threshold;
}
@Override
public String getDescription() {
return super.getDescription() + " < " + threshold * 100 + "%";
}
/**
* Return true if the tile given in parameter activates the trigger, given
* the parameters.
*/
@Override
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
if (!(tile instanceof TileFarmHatch)) {
return false;
}
TileFarmHatch tileHatch = (TileFarmHatch) tile;
ITankManager tankManager = tileHatch.getMultiblockLogic().getController().getTankManager();
IFluidTank tank = tankManager.getTank(0);
if (tank.getCapacity() == 0) {
return false;
}
return (float) tank.getFluidAmount() / tank.getCapacity() <= threshold;
}
// @Override
// public String getDescription() {
// return super.getDescription() + " < " + threshold * 100 + "%";
// }
//
// /**
// * Return true if the tile given in parameter activates the trigger, given
// * the parameters.
// */
// @Override
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
// if (!(tile instanceof TileFarmHatch)) {
// return false;
// }
//
// TileFarmHatch tileHatch = (TileFarmHatch) tile;
// ITankManager tankManager = tileHatch.getMultiblockLogic().getController().getTankManager();
//
// IFluidTank tank = tankManager.getTank(0);
// if (tank.getCapacity() == 0) {
// return false;
// }
// return (float) tank.getFluidAmount() / tank.getCapacity() <= threshold;
// }
}