Search in sources :

Example 1 with IMotorCart

use of club.nsdn.nyasamarailway.entity.IMotorCart in project NyaSamaRailway by NSDN.

the class RailMonoMagnetRFID method onMinecartPass.

@Override
public void onMinecartPass(World world, EntityMinecart cart, int x, int y, int z) {
    if (world.getTileEntity(x, y, z) instanceof RailRFID) {
        RailRFID rfid = (RailRFID) world.getTileEntity(x, y, z);
        if (cart instanceof LocoBase) {
            LocoBase loco = (LocoBase) cart;
            if (isRailPowered(world, x, y, z) || rfid.senderIsPowered()) {
                loco.setEnginePower(rfid.P);
                loco.setEngineBrake(rfid.R);
            }
        } else if (cart instanceof IMotorCart) {
            IMotorCart motorCart = (IMotorCart) cart;
            if (isRailPowered(world, x, y, z) || rfid.senderIsPowered()) {
                motorCart.setMotorPower(rfid.P);
                motorCart.setMotorBrake(rfid.R);
                motorCart.setMotorState(rfid.state);
            }
        }
        if (cart instanceof ILimitVelCart) {
            ILimitVelCart limitVelCart = (ILimitVelCart) cart;
            if (isRailPowered(world, x, y, z) || rfid.senderIsPowered()) {
                limitVelCart.setMaxVelocity(rfid.vel);
            }
        }
        if (cart instanceof IExtendedInfoCart) {
            IExtendedInfoCart infoCart = (IExtendedInfoCart) cart;
            if (isRailPowered(world, x, y, z) || rfid.senderIsPowered()) {
                if (!rfid.cartSide.equals("null"))
                    infoCart.setExtendedInfo("side", rfid.cartSide);
                if (!rfid.cartStr.equals("null"))
                    infoCart.setExtendedInfo("str", rfid.cartStr);
                if (!rfid.cartJet.equals("null"))
                    infoCart.setExtendedInfo("jet", rfid.cartJet);
            }
        }
    }
}
Also used : TileEntityRailRFID(club.nsdn.nyasamarailway.tileblock.signal.TileEntityRailRFID) IMotorCart(club.nsdn.nyasamarailway.entity.IMotorCart) ILimitVelCart(club.nsdn.nyasamarailway.entity.ILimitVelCart) LocoBase(club.nsdn.nyasamarailway.entity.LocoBase) IExtendedInfoCart(club.nsdn.nyasamarailway.entity.IExtendedInfoCart)

Example 2 with IMotorCart

use of club.nsdn.nyasamarailway.entity.IMotorCart in project NyaSamaRailway by NSDN.

the class BlockRailNoSleeperRFID method onMinecartPass.

@Override
public void onMinecartPass(World world, EntityMinecart cart, int x, int y, int z) {
    if (world.getTileEntity(x, y, z) instanceof TileEntityRailRFID) {
        TileEntityRailRFID rfid = (TileEntityRailRFID) world.getTileEntity(x, y, z);
        if (cart instanceof LocoBase) {
            LocoBase loco = (LocoBase) cart;
            if (isRailPowered(world, x, y, z) || rfid.senderIsPowered()) {
                loco.setEnginePower(rfid.P);
                loco.setEngineBrake(rfid.R);
            }
        } else if (cart instanceof IMotorCart) {
            IMotorCart motorCart = (IMotorCart) cart;
            if (isRailPowered(world, x, y, z) || rfid.senderIsPowered()) {
                motorCart.setMotorPower(rfid.P);
                motorCart.setMotorBrake(rfid.R);
                motorCart.setMotorState(rfid.state);
            }
        }
        if (cart instanceof ILimitVelCart) {
            ILimitVelCart limitVelCart = (ILimitVelCart) cart;
            if (isRailPowered(world, x, y, z) || rfid.senderIsPowered()) {
                limitVelCart.setMaxVelocity(rfid.vel);
            }
        }
        if (cart instanceof IExtendedInfoCart) {
            IExtendedInfoCart infoCart = (IExtendedInfoCart) cart;
            if (isRailPowered(world, x, y, z) || rfid.senderIsPowered()) {
                if (!rfid.cartSide.equals("null"))
                    infoCart.setExtendedInfo("side", rfid.cartSide);
                if (!rfid.cartStr.equals("null"))
                    infoCart.setExtendedInfo("str", rfid.cartStr);
                if (!rfid.cartJet.equals("null"))
                    infoCart.setExtendedInfo("jet", rfid.cartJet);
            }
        }
    }
}
Also used : IMotorCart(club.nsdn.nyasamarailway.entity.IMotorCart) ILimitVelCart(club.nsdn.nyasamarailway.entity.ILimitVelCart) LocoBase(club.nsdn.nyasamarailway.entity.LocoBase) IExtendedInfoCart(club.nsdn.nyasamarailway.entity.IExtendedInfoCart)

Example 3 with IMotorCart

use of club.nsdn.nyasamarailway.entity.IMotorCart in project NyaSamaRailway by NSDN.

the class BlockRailRFID method onMinecartPass.

@Override
public void onMinecartPass(World world, EntityMinecart cart, int x, int y, int z) {
    if (world.getTileEntity(x, y, z) instanceof TileEntityRailRFID) {
        TileEntityRailRFID rfid = (TileEntityRailRFID) world.getTileEntity(x, y, z);
        if (cart instanceof LocoBase) {
            LocoBase loco = (LocoBase) cart;
            if (isRailPowered(world, x, y, z) || rfid.senderIsPowered()) {
                loco.setEnginePower(rfid.P);
                loco.setEngineBrake(rfid.R);
            }
        } else if (cart instanceof IMotorCart) {
            IMotorCart motorCart = (IMotorCart) cart;
            if (isRailPowered(world, x, y, z) || rfid.senderIsPowered()) {
                motorCart.setMotorPower(rfid.P);
                motorCart.setMotorBrake(rfid.R);
                motorCart.setMotorState(rfid.state);
            }
        }
        if (cart instanceof ILimitVelCart) {
            ILimitVelCart limitVelCart = (ILimitVelCart) cart;
            if (isRailPowered(world, x, y, z) || rfid.senderIsPowered()) {
                limitVelCart.setMaxVelocity(rfid.vel);
            }
        }
        if (cart instanceof IExtendedInfoCart) {
            IExtendedInfoCart infoCart = (IExtendedInfoCart) cart;
            if (isRailPowered(world, x, y, z) || rfid.senderIsPowered()) {
                if (!rfid.cartSide.equals("null"))
                    infoCart.setExtendedInfo("side", rfid.cartSide);
                if (!rfid.cartStr.equals("null"))
                    infoCart.setExtendedInfo("str", rfid.cartStr);
                if (!rfid.cartJet.equals("null"))
                    infoCart.setExtendedInfo("jet", rfid.cartJet);
            }
        }
    }
}
Also used : IMotorCart(club.nsdn.nyasamarailway.entity.IMotorCart) ILimitVelCart(club.nsdn.nyasamarailway.entity.ILimitVelCart) LocoBase(club.nsdn.nyasamarailway.entity.LocoBase) IExtendedInfoCart(club.nsdn.nyasamarailway.entity.IExtendedInfoCart)

Aggregations

IExtendedInfoCart (club.nsdn.nyasamarailway.entity.IExtendedInfoCart)3 ILimitVelCart (club.nsdn.nyasamarailway.entity.ILimitVelCart)3 IMotorCart (club.nsdn.nyasamarailway.entity.IMotorCart)3 LocoBase (club.nsdn.nyasamarailway.entity.LocoBase)3 TileEntityRailRFID (club.nsdn.nyasamarailway.tileblock.signal.TileEntityRailRFID)1