Search in sources :

Example 1 with EntityLocomotiveSteam

use of mods.railcraft.common.carts.EntityLocomotiveSteam 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);
}
Also used : AdvancedFluidHandler(mods.railcraft.common.fluids.AdvancedFluidHandler) FluidStack(net.minecraftforge.fluids.FluidStack) EntityLocomotiveSteam(mods.railcraft.common.carts.EntityLocomotiveSteam) IFluidCart(mods.railcraft.api.carts.IFluidCart)

Aggregations

IFluidCart (mods.railcraft.api.carts.IFluidCart)1 EntityLocomotiveSteam (mods.railcraft.common.carts.EntityLocomotiveSteam)1 AdvancedFluidHandler (mods.railcraft.common.fluids.AdvancedFluidHandler)1 FluidStack (net.minecraftforge.fluids.FluidStack)1