use of forestry.core.fluids.TankManager in project ForestryMC by ForestryMC.
the class TileFarmPlain method createInventory.
protected void createInventory() {
setInternalInventory(new TileInventoryAdapter(this, SLOT_COUNT, "Items") {
@Override
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
if (GuiUtil.isIndexInRange(slotIndex, SLOT_FERTILIZER, SLOT_FERTILIZER_COUNT)) {
return acceptsAsFertilizer(itemStack);
} else if (GuiUtil.isIndexInRange(slotIndex, SLOT_GERMLINGS_1, SLOT_GERMLINGS_COUNT)) {
return acceptsAsGermling(itemStack);
} else if (GuiUtil.isIndexInRange(slotIndex, SLOT_RESOURCES_1, SLOT_RESOURCES_COUNT)) {
return acceptsAsResource(itemStack);
} else if (GuiUtil.isIndexInRange(slotIndex, SLOT_CAN, SLOT_CAN_COUNT)) {
Fluid fluid = FluidHelper.getFluidInContainer(itemStack);
return tankManager.accepts(fluid);
}
return false;
}
@Override
public boolean canExtractItem(int slotIndex, ItemStack stack, int side) {
return GuiUtil.isIndexInRange(slotIndex, SLOT_PRODUCTION_1, SLOT_PRODUCTION_COUNT);
}
});
FilteredTank liquidTank = new FilteredTank(Defaults.PROCESSOR_TANK_CAPACITY, FluidRegistry.WATER);
tankManager = new TankManager(liquidTank);
}
use of forestry.core.fluids.TankManager in project ForestryMC by ForestryMC.
the class ContainerFarm method detectAndSendChanges.
@Override
@SuppressWarnings("unchecked")
public void detectAndSendChanges() {
super.detectAndSendChanges();
TankManager tankManager = tile.getTankManager();
if (tankManager != null) {
tankManager.updateGuiData(this, crafters);
}
for (Object crafter : crafters) {
tile.sendGUINetworkData(this, (ICrafting) crafter);
}
}
use of forestry.core.fluids.TankManager in project ForestryMC by ForestryMC.
the class ContainerFarm method addCraftingToCrafters.
@Override
public void addCraftingToCrafters(ICrafting iCrafting) {
super.addCraftingToCrafters(iCrafting);
TankManager tankManager = tile.getTankManager();
if (tankManager != null) {
tankManager.initGuiData(this, iCrafting);
}
}
use of forestry.core.fluids.TankManager in project ForestryMC by ForestryMC.
the class TriggerLowLiquid method isTriggerActive.
/**
* Return true if the tile given in parameter activates the trigger, given
* the parameters.
*/
@Override
public boolean isTriggerActive(TileEntity tile, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters) {
if (!(tile instanceof TileHatch)) {
return false;
}
ITileStructure central = ((TileHatch) tile).getCentralTE();
if (central == null || !(central instanceof TileFarmPlain)) {
return false;
}
TankManager tankManager = ((TileFarmPlain) central).getTankManager();
FluidTankInfo info = tankManager.getTankInfo(0);
if (info.fluid == null) {
return true;
}
return ((float) info.fluid.amount / info.capacity) <= threshold;
}
use of forestry.core.fluids.TankManager in project ForestryMC by ForestryMC.
the class ContainerFarm method updateProgressBar.
@Override
public void updateProgressBar(int i, int j) {
tile.getGUINetworkData(i, j);
TankManager tankManager = tile.getTankManager();
if (tankManager != null) {
tankManager.processGuiUpdate(i, j);
}
}
Aggregations