use of club.nsdn.nyasamarailway.util.ExtInfoCore in project NyaSamaRailway by NSDN.
the class ItemNSC2A 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) {
NSC2A cart = new NSC2A(world, (double) x + 0.5, (double) y + 0.5, (double) z + 0.5);
if (itemStack.hasDisplayName()) {
cart.setMinecartName(itemStack.getDisplayName());
}
ItemStack stack;
for (int i = 0; i < 9; i++) {
stack = player.inventory.mainInventory[i];
if (stack == null)
continue;
if (stack.getItem() == null)
continue;
if (stack.getItem() instanceof NGTablet) {
NBTTagList list = Util.getTagListFromNGT(stack);
if (list != null) {
String[][] code = NSASM.getCode(list);
new ExtInfoCore(code) {
@Override
public World getWorld() {
return world;
}
@Override
public double getX() {
return x;
}
@Override
public double getY() {
return y;
}
@Override
public double getZ() {
return z;
}
@Override
public EntityPlayer getPlayer() {
return player;
}
@Override
public IExtendedInfoCart getCart() {
return cart;
}
}.run();
}
}
}
world.spawnEntityInWorld(cart);
}
--itemStack.stackSize;
return true;
} else {
return false;
}
}
use of club.nsdn.nyasamarailway.util.ExtInfoCore in project NyaSamaRailway by NSDN.
the class ItemNSPCT9M 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) {
NSPCT9M cart = new NSPCT9M(world, (double) x + 0.5, (double) y + 0.5, (double) z + 0.5);
if (itemStack.hasDisplayName()) {
cart.setMinecartName(itemStack.getDisplayName());
}
ItemStack stack;
for (int i = 0; i < 9; i++) {
stack = player.inventory.mainInventory[i];
if (stack == null)
continue;
if (stack.getItem() == null)
continue;
if (stack.getItem() instanceof NGTablet) {
NBTTagList list = Util.getTagListFromNGT(stack);
if (list != null) {
String[][] code = NSASM.getCode(list);
new ExtInfoCore(code) {
@Override
public World getWorld() {
return world;
}
@Override
public double getX() {
return x;
}
@Override
public double getY() {
return y;
}
@Override
public double getZ() {
return z;
}
@Override
public EntityPlayer getPlayer() {
return player;
}
@Override
public IExtendedInfoCart getCart() {
return cart;
}
}.run();
}
}
}
world.spawnEntityInWorld(cart);
}
--itemStack.stackSize;
return true;
} else {
return false;
}
}
use of club.nsdn.nyasamarailway.util.ExtInfoCore in project NyaSamaRailway by NSDN.
the class ItemNSC2AM 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) {
NSC2AM cart = new NSC2AM(world, (double) x + 0.5, (double) y + 0.5, (double) z + 0.5);
if (itemStack.hasDisplayName()) {
cart.setMinecartName(itemStack.getDisplayName());
}
ItemStack stack;
for (int i = 0; i < 9; i++) {
stack = player.inventory.mainInventory[i];
if (stack == null)
continue;
if (stack.getItem() == null)
continue;
if (stack.getItem() instanceof NGTablet) {
NBTTagList list = Util.getTagListFromNGT(stack);
if (list != null) {
String[][] code = NSASM.getCode(list);
new ExtInfoCore(code) {
@Override
public World getWorld() {
return world;
}
@Override
public double getX() {
return x;
}
@Override
public double getY() {
return y;
}
@Override
public double getZ() {
return z;
}
@Override
public EntityPlayer getPlayer() {
return player;
}
@Override
public IExtendedInfoCart getCart() {
return cart;
}
}.run();
}
}
}
world.spawnEntityInWorld(cart);
}
--itemStack.stackSize;
return true;
} else {
return false;
}
}
Aggregations