use of club.nsdn.nyasamarailway.tileblock.signal.TileEntityRailReception in project NyaSamaRailway by NSDN.
the class RailMonoMagnetReception method onRailPowered.
@Override
public void onRailPowered(World world, int x, int y, int z, int meta, boolean hasCart) {
boolean playerDetectable = false;
if (!checkNearbySameRail(world, x, y, z))
playerDetectable = true;
EntityMinecart cart = getMinecart(world, x, y, z);
TileEntityRailReception rail = null;
if (world.getTileEntity(x, y, z) instanceof TileEntityRailReception) {
rail = (TileEntityRailReception) world.getTileEntity(x, y, z);
}
TileEntityRailReception.powered(!isForward(), cart, rail, playerDetectable);
}
use of club.nsdn.nyasamarailway.tileblock.signal.TileEntityRailReception in project NyaSamaRailway by NSDN.
the class RailMonoMagnetReceptionAnti method updateTick.
@Override
public void updateTick(World world, int x, int y, int z, Random random) {
if (!world.isRemote) {
float bBoxSize = 0.125F;
List bBox = world.getEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getBoundingBox((double) ((float) x + bBoxSize), (double) y, (double) ((float) z + bBoxSize), (double) ((float) (x + 1) - bBoxSize), (double) ((float) (y + 1) - bBoxSize), (double) ((float) (z + 1) - bBoxSize)));
TileEntityRailReception rail = null;
if (world.getTileEntity(x, y, z) instanceof TileEntityRailReception) {
rail = (TileEntityRailReception) world.getTileEntity(x, y, z);
}
boolean playerDetectable = false;
if (!checkNearbySameRail(world, x, y, z))
playerDetectable = true;
if (rail != null) {
TileEntityRailReception.tick(!isForward(), bBox, rail, playerDetectable);
}
world.scheduleBlockUpdate(x, y, z, this, 1);
}
super.updateTick(world, x, y, z, random);
}
use of club.nsdn.nyasamarailway.tileblock.signal.TileEntityRailReception in project NyaSamaRailway by NSDN.
the class RailMonoMagnetReceptionAnti method onRailPowered.
@Override
public void onRailPowered(World world, int x, int y, int z, int meta, boolean hasCart) {
boolean playerDetectable = false;
if (!checkNearbySameRail(world, x, y, z))
playerDetectable = true;
EntityMinecart cart = getMinecart(world, x, y, z);
TileEntityRailReception rail = null;
if (world.getTileEntity(x, y, z) instanceof TileEntityRailReception) {
rail = (TileEntityRailReception) world.getTileEntity(x, y, z);
}
TileEntityRailReception.powered(!isForward(), cart, rail, playerDetectable);
}
use of club.nsdn.nyasamarailway.tileblock.signal.TileEntityRailReception in project NyaSamaRailway by NSDN.
the class RailMonoMagnetReception method updateTick.
@Override
public void updateTick(World world, int x, int y, int z, Random random) {
if (!world.isRemote) {
float bBoxSize = 0.125F;
List bBox = world.getEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getBoundingBox((double) ((float) x + bBoxSize), (double) y, (double) ((float) z + bBoxSize), (double) ((float) (x + 1) - bBoxSize), (double) ((float) (y + 1) - bBoxSize), (double) ((float) (z + 1) - bBoxSize)));
TileEntityRailReception rail = null;
if (world.getTileEntity(x, y, z) instanceof TileEntityRailReception) {
rail = (TileEntityRailReception) world.getTileEntity(x, y, z);
}
boolean playerDetectable = false;
if (!checkNearbySameRail(world, x, y, z))
playerDetectable = true;
if (rail != null) {
TileEntityRailReception.tick(!isForward(), bBox, rail, playerDetectable);
}
world.scheduleBlockUpdate(x, y, z, this, 1);
}
super.updateTick(world, x, y, z, random);
}
use of club.nsdn.nyasamarailway.tileblock.signal.TileEntityRailReception in project NyaSamaRailway by NSDN.
the class RailMonoMagnetReception method onMinecartPass.
@Override
public void onMinecartPass(World world, EntityMinecart cart, int x, int y, int z) {
boolean playerDetectable = false;
EntityPlayer player = null;
if (!checkNearbySameRail(world, x, y, z))
playerDetectable = true;
if (cart.riddenByEntity instanceof EntityPlayer) {
player = (EntityPlayer) cart.riddenByEntity;
ItemStack stack = ((EntityPlayer) cart.riddenByEntity).getCurrentEquippedItem();
if (stack != null) {
if (stack.getItem() instanceof ItemNTP8Bit || stack.getItem() instanceof ItemNTP32Bit) {
return;
}
}
} else if (cart.riddenByEntity instanceof EntityMinecart) {
EntityMinecart ncart = (EntityMinecart) cart.riddenByEntity;
if (ncart.riddenByEntity instanceof EntityPlayer) {
player = (EntityPlayer) ncart.riddenByEntity;
ItemStack stack = ((EntityPlayer) ncart.riddenByEntity).getCurrentEquippedItem();
if (stack != null) {
if (stack.getItem() instanceof ItemNTP8Bit || stack.getItem() instanceof ItemNTP32Bit) {
return;
}
}
}
}
if (world.getTileEntity(x, y, z) instanceof TileEntityRailReception) {
TileEntityRailReception rail = (TileEntityRailReception) world.getTileEntity(x, y, z);
TileEntityRailReception.cart(!isForward(), cart, rail, player, playerDetectable);
}
}
Aggregations