use of club.nsdn.nyasamarailway.item.tool.Item1N4148 in project NyaSamaRailway by NSDN.
the class NSPCT10M method interactFirst.
@Override
public boolean interactFirst(EntityPlayer player) {
if (MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, player))) {
return true;
} else if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != player) {
return true;
} else if (this.riddenByEntity != null && this.riddenByEntity != player) {
return false;
} else {
if (player != null) {
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null) {
if (stack.getItem() instanceof Item1N4148 || stack.getItem() instanceof ItemNTP8Bit || stack.getItem() instanceof ItemNTP32Bit) {
return true;
}
if (stack.getItem() instanceof ItemMinecart)
return true;
}
if (!this.worldObj.isRemote) {
player.mountEntity(this);
player.addChatComponentMessage(new ChatComponentTranslation("info.nsr.x"));
}
}
return true;
}
}
use of club.nsdn.nyasamarailway.item.tool.Item1N4148 in project NyaSamaRailway by NSDN.
the class EntityInteractHandler method onEntityInteract.
@SubscribeEvent
public void onEntityInteract(EntityInteractEvent event) {
if (event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
if (player.worldObj.isRemote)
return;
Entity entity = event.target;
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null) {
if (stack.getItem() instanceof ItemNTP8Bit) {
if (player.isSneaking()) {
((ItemNTP8Bit) stack.getItem()).clearCart(stack, player);
return;
}
if (entity instanceof EntityMinecart) {
((ItemNTP8Bit) stack.getItem()).addCart(stack, player, entity);
}
} else if (stack.getItem() instanceof ItemNTP32Bit) {
if (player.isSneaking()) {
((ItemNTP32Bit) stack.getItem()).clearCart(stack, player);
return;
}
if (entity instanceof EntityMinecart) {
((ItemNTP32Bit) stack.getItem()).addCart(stack, player, entity);
} else {
if (ExRollerCoaster.getInstance() != null) {
if (ExRollerCoaster.getInstance().verifyEntity(entity)) {
((ItemNTP32Bit) stack.getItem()).addCart(stack, player, entity);
}
}
if (RailsOfWar.getInstance() != null) {
if (RailsOfWar.getInstance().verifyEntity(entity)) {
((ItemNTP32Bit) stack.getItem()).addCart(stack, player, entity);
}
}
}
} else if (stack.getItem() instanceof Item1N4148) {
if (entity instanceof IHighSpeedCart) {
IHighSpeedCart highSpeedCart = (IHighSpeedCart) entity;
highSpeedCart.modifyHighSpeedMode(player);
}
} else if (stack.getItem() instanceof ItemNSPCT5) {
if (entity instanceof NSPCT5) {
((NSPCT5) entity).modifyLength();
}
} else if (stack.getItem() instanceof ItemNSPCT5L) {
if (entity instanceof NSPCT5L) {
((NSPCT5L) entity).modifyLength();
}
}
}
}
}
use of club.nsdn.nyasamarailway.item.tool.Item1N4148 in project NyaSamaRailway by NSDN.
the class MinecartBase method attackEntityFrom.
@Override
public boolean attackEntityFrom(DamageSource source, float damage) {
if (!this.worldObj.isRemote && !this.isDead) {
if (this.isEntityInvulnerable()) {
return false;
} else {
this.setRollingDirection(-this.getRollingDirection());
this.setRollingAmplitude(10);
this.setBeenAttacked();
this.setDamage(this.getDamage() + damage * 10.0F);
boolean flag = false;
if (source.getEntity() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) source.getEntity();
ItemStack stack = player.getCurrentEquippedItem();
if (stack == null)
return false;
if (stack.getItem() instanceof Item1N4148)
flag = true;
}
if (flag || this.getDamage() > 40.0F) {
if (this.riddenByEntity != null) {
this.riddenByEntity.mountEntity(this);
}
if (flag && !this.hasCustomInventoryName()) {
this.setDead();
} else {
this.killMinecart(source);
}
}
return true;
}
} else {
return true;
}
}
use of club.nsdn.nyasamarailway.item.tool.Item1N4148 in project NyaSamaRailway by NSDN.
the class NSPCT10 method interactFirst.
@Override
public boolean interactFirst(EntityPlayer player) {
if (MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, player))) {
return true;
} else if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != player) {
return true;
} else if (this.riddenByEntity != null && this.riddenByEntity != player) {
return false;
} else {
if (player != null) {
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null) {
if (stack.getItem() instanceof Item1N4148 || stack.getItem() instanceof ItemNTP8Bit || stack.getItem() instanceof ItemNTP32Bit) {
return true;
}
if (stack.getItem() instanceof ItemMinecart)
return true;
}
if (!this.worldObj.isRemote) {
player.mountEntity(this);
player.addChatComponentMessage(new ChatComponentTranslation("info.nsr.x"));
}
}
return true;
}
}
use of club.nsdn.nyasamarailway.item.tool.Item1N4148 in project NyaSamaRailway by NSDN.
the class LocoBase method attackEntityFrom.
@Override
public boolean attackEntityFrom(DamageSource source, float damage) {
if (!this.worldObj.isRemote && !this.isDead) {
if (this.isEntityInvulnerable()) {
return false;
} else {
this.setRollingDirection(-this.getRollingDirection());
this.setRollingAmplitude(10);
this.setBeenAttacked();
this.setDamage(this.getDamage() + damage * 10.0F);
boolean flag = false;
if (source.getEntity() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) source.getEntity();
ItemStack stack = player.getCurrentEquippedItem();
if (stack == null)
return false;
if (stack.getItem() instanceof Item1N4148)
flag = true;
}
if (flag || this.getDamage() > 40.0F) {
if (this.riddenByEntity != null) {
this.riddenByEntity.mountEntity(this);
}
if (flag && !this.hasCustomInventoryName()) {
this.setDead();
} else {
this.killMinecart(source);
}
}
return true;
}
} else {
return true;
}
}
Aggregations