use of knightminer.ceramics.network.FluidUpdatePacket in project Ceramics by KnightMiner.
the class TileFaucet method reset.
protected void reset() {
isPouring = false;
stopPouring = false;
drained = null;
// invalid direction
direction = EnumFacing.DOWN;
lastRedstoneState = false;
// sync to clients
if (getWorld() != null && !getWorld().isRemote && getWorld() instanceof WorldServer) {
CeramicsNetwork.sendToClients((WorldServer) getWorld(), pos, new FluidUpdatePacket(pos, null));
}
}
use of knightminer.ceramics.network.FluidUpdatePacket in project Ceramics by KnightMiner.
the class TileFaucet method doTransfer.
protected void doTransfer() {
// still got content left
if (drained != null) {
return;
}
IFluidHandler toDrain = getFluidHandler(pos.offset(direction), direction);
IFluidHandler toFill = getFluidHandler(pos.down(), EnumFacing.UP);
if (toDrain != null && toFill != null) {
// can we drain?
FluidStack drained = toDrain.drain(TRANSACTION_AMOUNT, false);
if (drained != null) {
// can we fill?
int filled = toFill.fill(drained, false);
if (filled > 0) {
// drain the liquid and transfer it, buffer the amount for delay
this.drained = toDrain.drain(filled, true);
this.isPouring = true;
pour();
// sync to clients
if (!getWorld().isRemote && getWorld() instanceof WorldServer) {
CeramicsNetwork.sendToClients((WorldServer) getWorld(), pos, new FluidUpdatePacket(pos, drained));
}
return;
}
}
}
// draining unsuccessful
reset();
}
Aggregations