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);
}
}
}
}
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);
}
}
}
}
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);
}
}
}
}
Aggregations