Search in sources :

Example 1 with NSC2B

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

the class ItemNSC2B 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) {
            MinecartBase entityminecart = new NSC2B(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;
    }
}
Also used : MinecartBase(club.nsdn.nyasamarailway.entity.MinecartBase) RailMonoMagnetBase(club.nsdn.nyasamarailway.tileblock.rail.mono.RailMonoMagnetBase) NSC2B(club.nsdn.nyasamarailway.entity.nsc.NSC2B)

Aggregations

MinecartBase (club.nsdn.nyasamarailway.entity.MinecartBase)1 NSC2B (club.nsdn.nyasamarailway.entity.nsc.NSC2B)1 RailMonoMagnetBase (club.nsdn.nyasamarailway.tileblock.rail.mono.RailMonoMagnetBase)1