use of mods.railcraft.api.carts.IFluidCart in project Railcraft by Railcraft.
the class TileFluidLoader method processCart.
@Override
protected void processCart(EntityMinecart cart) {
if (cart instanceof EntityLocomotiveSteam) {
EntityLocomotiveSteam loco = (EntityLocomotiveSteam) cart;
if (!loco.isSafeToFill()) {
retractPipe();
return;
}
}
AdvancedFluidHandler tankCart = getFluidHandler(cart, EnumFacing.UP);
if (tankCart == null)
return;
boolean cartNeedsFilling = cartNeedsFilling(tankCart);
if (cartNeedsFilling && needsPipe)
extendPipe();
else
retractPipe();
setProcessing(false);
if (cartNeedsFilling && (!needsPipe || pipeIsExtended())) {
FluidStack moved = FluidUtil.tryFluidTransfer(tankCart, tank, RailcraftConfig.getTankCartFillRate(), true);
setProcessing(Fluids.isNotEmpty(moved));
}
if (isProcessing())
setPowered(false);
if (cart instanceof IFluidCart)
((IFluidCart) cart).setFilling(isProcessing());
if (tankCart.isTankFull(tank.getFluidType()))
setResetTimer(RESET_WAIT);
}
use of mods.railcraft.api.carts.IFluidCart in project Railcraft by Railcraft.
the class TrainTransferHelper method canAcceptPushedFluid.
private boolean canAcceptPushedFluid(EntityMinecart requester, EntityMinecart cart, Fluid fluid) {
IFluidHandler fluidHandler = FluidTools.getFluidHandler(EnumFacing.UP, cart);
if (fluidHandler == null)
return false;
if (cart instanceof IFluidCart)
return ((IFluidCart) cart).canAcceptPushedFluid(requester, fluid);
AdvancedFluidHandler advancedFluidHandler = new AdvancedFluidHandler(fluidHandler);
return advancedFluidHandler.canPutFluid(new FluidStack(fluid, 1));
}
Aggregations