use of club.nsdn.nyasamarailway.entity.LocoBase in project NyaSamaRailway by NSDN.
the class ItemNSC1BM 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)) && world.getBlock(x, y, z) instanceof RailMonoMagnetBase) {
if (!world.isRemote) {
LocoBase entityminecart = new NSC1BM(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.LocoBase in project NyaSamaRailway by NSDN.
the class ItemNSC2BM 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)) && world.getBlock(x, y, z) instanceof RailMonoMagnetBase) {
if (!world.isRemote) {
LocoBase entityminecart = new NSC2BM(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.LocoBase in project NyaSamaRailway by NSDN.
the class NTPCtrlHandler method tick.
@SubscribeEvent
public void tick(TickEvent.ClientTickEvent event) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player == null)
return;
if (PacketStCHandler.player == null)
PacketStCHandler.player = player;
if (Minecraft.getMinecraft().currentScreen instanceof GuiChat)
return;
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null) {
TrainPacket packet = new TrainPacket();
if (stack.getItem() instanceof ItemNTP8Bit) {
ItemNTP8Bit ntp8Bit = (ItemNTP8Bit) stack.getItem();
packet.fromStack(stack);
EntityMinecart cart = packet.getCartInClient(ntp8Bit.cart.get(stack));
if (cart != null) {
if (cart instanceof LocoBase) {
TrainController.doControl(packet, player);
NetworkWrapper.instance.sendToServer(packet);
packet.toStack(stack);
return;
}
TrainController.doControl(packet, player);
NetworkWrapper.instance.sendToServer(packet);
packet.toStack(stack);
}
} else if (stack.getItem() instanceof ItemNTP32Bit) {
ItemNTP32Bit ntp32Bit = (ItemNTP32Bit) stack.getItem();
packet.fromStack(stack);
int[] carts = ntp32Bit.carts.get(stack);
if (carts.length == 1 && carts[0] == -1)
return;
TrainController.doControl(packet, player);
NetworkWrapper.instance.sendToServer(packet);
packet.toStack(stack);
}
}
}
use of club.nsdn.nyasamarailway.entity.LocoBase in project NyaSamaRailway by NSDN.
the class ItemNSPCT10J 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) {
LocoBase entityminecart = new NSPCT10J(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.LocoBase in project NyaSamaRailway by NSDN.
the class ItemNSPCT4M 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)) && world.getBlock(x, y, z) instanceof RailMonoMagnetBase) {
if (!world.isRemote) {
LocoBase entityminecart = new NSPCT4M(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;
}
}
Aggregations