use of net.minecraftforge.fluids.IFluidTank in project ForestryMC by ForestryMC.
the class TankWidget method getToolTip.
@Override
public ToolTip getToolTip(int mouseX, int mouseY) {
IFluidTank tank = getTank();
if (!(tank instanceof StandardTank)) {
return null;
}
StandardTank standardTank = (StandardTank) tank;
return standardTank.getToolTip();
}
use of net.minecraftforge.fluids.IFluidTank in project Binnie by ForestryMC.
the class MachineUtil method liquidInTank.
public boolean liquidInTank(final int tankIndex, final int amount) {
IFluidTank tank = this.getTank(tankIndex);
FluidStack drain = tank.drain(amount, false);
return drain != null && drain.amount == amount;
}
use of net.minecraftforge.fluids.IFluidTank in project Metalworks by canitzp.
the class TileBase method writeCapabilities.
protected void writeCapabilities(NBTTagCompound nbt, @Nullable EnumFacing side) {
IItemHandler inventory = this.getInventory(side);
if (inventory != null && inventory instanceof IItemHandlerModifiable) {
nbt.setTag("Inventory", CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.writeNBT(inventory, side));
}
IFluidHandler tank = getTank(side);
if (tank != null && tank instanceof IFluidTank) {
nbt.setTag("FluidTank", CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.writeNBT(tank, side));
}
IEnergyStorage energy = getEnergy(side);
if (energy != null && energy instanceof EnergyStorage) {
nbt.setTag("Energy", CapabilityEnergy.ENERGY.writeNBT(energy, side));
}
}
use of net.minecraftforge.fluids.IFluidTank in project PneumaticCraft by MineMaarten.
the class GuiLogisticsBase method actionPerformed.
@Override
public void actionPerformed(IGuiWidget widget) {
super.actionPerformed(widget);
if (widget instanceof WidgetFluidStack) {
boolean leftClick = Mouse.isButtonDown(0);
boolean middleClick = Mouse.isButtonDown(2);
boolean shift = PneumaticCraft.proxy.isSneakingInGui();
IFluidTank tank = logistics.getTankFilter(widget.getID());
if (tank.getFluidAmount() > 0) {
if (middleClick) {
logistics.setFilter(widget.getID(), (FluidStack) null);
} else if (leftClick) {
tank.drain(shift ? tank.getFluidAmount() / 2 : 1000, true);
if (tank.getFluidAmount() < 1000) {
tank.drain(1000, true);
}
} else {
tank.fill(new FluidStack(tank.getFluid().getFluid(), shift ? tank.getFluidAmount() : 1000), true);
}
NetworkHandler.sendToServer(new PacketSetLogisticsFluidFilterStack(logistics, tank.getFluid(), widget.getID()));
} else {
fluidSearchGui = new GuiLogisticsLiquidFilter(this);
editingSlot = widget.getID();
mc.displayGuiScreen(fluidSearchGui);
}
}
}
use of net.minecraftforge.fluids.IFluidTank in project GregTech by GregTechCE.
the class MetaTileEntity method pushFluidsIntoNearbyHandlers.
public void pushFluidsIntoNearbyHandlers(EnumFacing... allowedFaces) {
for (EnumFacing nearbyFacing : allowedFaces) {
TileEntity tileEntity = getWorld().getTileEntity(getPos().offset(nearbyFacing));
if (tileEntity == null)
continue;
IFluidHandler fluidHandler = tileEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, nearbyFacing.getOpposite());
if (fluidHandler == null)
continue;
for (int tankIndex = 0; tankIndex < exportFluids.getTanks(); tankIndex++) {
IFluidTank tank = exportFluids.getTankAt(tankIndex);
FluidStack fluidStack = tank.getFluid();
if (fluidStack != null && fluidHandler.fill(fluidStack, false) != 0) {
int filledAmount = fluidHandler.fill(fluidStack, true);
tank.drain(filledAmount, true);
}
}
}
}
Aggregations