use of club.nsdn.nyasamarailway.entity.MinecartBase in project NyaSamaRailway by NSDN.
the class ItemNSTCT1 method onItemUse.
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float px, float py, float pz) {
if (BlockRailBase.func_150051_a(world.getBlock(x, y, z))) {
if (!world.isRemote) {
MinecartBase entityminecart = new NSTCT1(world, (double) x + 0.5, (double) y + 0.5, (double) z + 0.5);
if (itemStack.hasDisplayName()) {
entityminecart.setMinecartName(itemStack.getDisplayName());
}
world.spawnEntityInWorld(entityminecart);
}
--itemStack.stackSize;
return true;
} else {
return false;
}
}
use of club.nsdn.nyasamarailway.entity.MinecartBase in project NyaSamaRailway by NSDN.
the class NSPCT8W method doSpawn.
public static void doSpawn(World world, int x, int y, int z, String name) {
MinecartBase head = new NSPCT8W(world, (double) x + 0.5, (double) y + 0.5, (double) z + 0.5);
if (!name.isEmpty())
head.setMinecartName(name);
world.spawnEntityInWorld(head);
MinecartBase container = new NSPCT8W.Container(world, (double) x + 0.5, (double) y + 0.5 - 3.0, (double) z + 0.5);
world.spawnEntityInWorld(container);
container.mountEntity(head);
}
use of club.nsdn.nyasamarailway.entity.MinecartBase in project NyaSamaRailway by NSDN.
the class NSPCT6W method doSpawn.
public static void doSpawn(World world, int x, int y, int z, String name) {
MinecartBase head = new NSPCT6W(world, (double) x + 0.5, (double) y + 0.5, (double) z + 0.5);
if (!name.isEmpty())
head.setMinecartName(name);
world.spawnEntityInWorld(head);
MinecartBase container = new NSPCT6W.Container(world, (double) x + 0.5, (double) y + 0.5 - 2.0, (double) z + 0.5);
world.spawnEntityInWorld(container);
container.mountEntity(head);
}
use of club.nsdn.nyasamarailway.entity.MinecartBase in project NyaSamaRailway by NSDN.
the class NSPCT6C method doSpawn.
public static void doSpawn(World world, int x, int y, int z, String name) {
LocoBase head = new NSPCT6C(world, (double) x + 0.5, (double) y + 0.5, (double) z + 0.5);
if (!name.isEmpty())
head.setMinecartName(name);
world.spawnEntityInWorld(head);
MinecartBase container = new NSPCT6C.Container(world, (double) x + 0.5, (double) y + 0.5 - 2.0, (double) z + 0.5);
world.spawnEntityInWorld(container);
container.mountEntity(head);
}
use of club.nsdn.nyasamarailway.entity.MinecartBase in project NyaSamaRailway by NSDN.
the class ItemTrainBase method onItemUse.
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float px, float py, float pz) {
if (BlockRailBase.func_150051_a(world.getBlock(x, y, z))) {
if (!world.isRemote) {
TrainBase trainBody = new TrainBase(world, (double) x + 0.5, (double) y + 0.5, (double) z + 0.5);
MinecartBase bogieF = new NSBT1(world, (double) x + 0.5, (double) y + 0.5, (double) z + 0.5);
MinecartBase bogieB = new NSBT1(world, (double) x + 0.5, (double) y + 0.5, (double) z + 0.5);
if (itemStack.hasDisplayName()) {
trainBody.setMinecartName(itemStack.getDisplayName());
}
trainBody.addBogie(0, bogieF.getEntityId(), 2.0);
trainBody.addBogie(1, bogieB.getEntityId(), -2.0);
world.spawnEntityInWorld(trainBody);
if (getRailDirection(world, x, y, z) == RailDirection.WE) {
bogieF.posX += 2.0;
bogieB.posX -= 2.0;
} else if (getRailDirection(world, x, y, z) == RailDirection.NS) {
bogieF.posZ += 2.0;
bogieB.posZ -= 2.0;
}
world.spawnEntityInWorld(bogieF);
world.spawnEntityInWorld(bogieB);
}
--itemStack.stackSize;
return true;
} else {
return false;
}
}
Aggregations