mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-25 06:14:46 +00:00
Compiles for 1.9! Very buggy, some things are missing.
This commit is contained in:
1 parent
5d74c1254b
commit
7bf554b024
135 files changed
+1710
-1919
No files matched your search
@@ -10,39 +10,29 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.triggers;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
// TODO: Buildcraft for 1.9
|
||||
public class TriggerLowFertilizer {//} extends Trigger {
|
||||
|
||||
import forestry.core.triggers.Trigger;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.farming.tiles.TileFarmHatch;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
|
||||
public class TriggerLowFertilizer extends Trigger {
|
||||
|
||||
private final float threshold;
|
||||
|
||||
public TriggerLowFertilizer(String tag, float threshold) {
|
||||
super(tag, "lowFertilizer");
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return super.getDescription() + " < " + threshold * 100 + "%";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
if (!(tile instanceof TileFarmHatch)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileFarmHatch tileHatch = (TileFarmHatch) tile;
|
||||
IInventory fertilizerInventory = tileHatch.getMultiblockLogic().getController().getFarmInventory().getFertilizerInventory();
|
||||
return InventoryUtil.containsPercent(fertilizerInventory, threshold);
|
||||
}
|
||||
// private final float threshold;
|
||||
//
|
||||
// public TriggerLowFertilizer(String tag, float threshold) {
|
||||
// super(tag, "lowFertilizer");
|
||||
// this.threshold = threshold;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getDescription() {
|
||||
// return super.getDescription() + " < " + threshold * 100 + "%";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
// if (!(tile instanceof TileFarmHatch)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// TileFarmHatch tileHatch = (TileFarmHatch) tile;
|
||||
// IInventory fertilizerInventory = tileHatch.getMultiblockLogic().getController().getFarmInventory().getFertilizerInventory();
|
||||
// return InventoryUtil.containsPercent(fertilizerInventory, threshold);
|
||||
// }
|
||||
}
|
||||
Reference in new issue
Block a user