use of net.minecraft.entity.player.EntityPlayerMP in project BetterWithAddons by DaedalusGame.
the class AssortedHandler method livingTick.
@SubscribeEvent
public void livingTick(LivingEvent.LivingUpdateEvent updateEvent) {
final EntityLivingBase entity = updateEvent.getEntityLiving();
World world = entity.getEntityWorld();
UUID uuid = entity.getUniqueID();
BlockPos pos = entity.getPosition();
if (!world.isRemote) {
if (entity.isPotionActive(ModPotions.boss)) {
if (!BossList.containsKey(uuid)) {
BossInfoServer displayData = (BossInfoServer) new BossInfoServer(entity.getDisplayName(), Color.PURPLE, Overlay.PROGRESS).setDarkenSky(false);
BossList.put(uuid, displayData);
List<EntityPlayerMP> entities = world.getEntitiesWithinAABB(EntityPlayerMP.class, new AxisAlignedBB(pos).expand(24, 24, 24));
if (entities != null)
for (EntityPlayerMP ply : entities) {
displayData.addPlayer(ply);
}
} else {
BossInfoServer bossInfo = BossList.get(uuid);
bossInfo.setPercent(entity.getHealth() / entity.getMaxHealth());
}
} else if (world.getMinecraftServer().getTickCounter() % BossCleanupThreshold == 0 && BossList.containsKey(uuid)) {
BossInfoServer bossInfo = BossList.get(uuid);
for (EntityPlayerMP ply : bossInfo.getPlayers()) {
bossInfo.removePlayer(ply);
}
BossList.remove(uuid);
}
}
}
use of net.minecraft.entity.player.EntityPlayerMP in project NyaSamaRailway by NSDN.
the class Item74HC04 method onConnectorUseLast.
@Override
public boolean onConnectorUseLast(EntityPlayer player, UUID uuid, TileEntity tileEntity) {
if (Railcraft.getInstance() != null) {
if (Railcraft.getInstance().verifySwitch(tileEntity)) {
if (receiverRails.containsKey(uuid)) {
if (receiverRails.get(uuid) instanceof TileEntityActuator) {
TileEntityActuator actuator = (TileEntityActuator) receiverRails.get(uuid);
if (actuator.getTarget() != tileEntity) {
actuator.setTarget(tileEntity);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.connected"));
updateTileEntity(actuator);
updateTileEntity(tileEntity);
} else {
actuator.setTarget(null);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.disconnected"));
updateTileEntity(actuator);
updateTileEntity(tileEntity);
}
}
receiverRails.remove(uuid);
} else {
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.error"));
}
return true;
}
}
return false;
}
use of net.minecraft.entity.player.EntityPlayerMP in project NyaSamaRailway by NSDN.
the class ItemNTP32Bit method clearCart.
public void clearCart(ItemStack itemStack, EntityPlayer player) {
int[] array = new int[] { -1 };
power.set(itemStack, 0);
brake.set(itemStack, 5);
dir.set(itemStack, 0);
carts.set(itemStack, array);
if (player instanceof EntityPlayerMP) {
TrainPacket packet = new TrainPacket();
packet.fromStack(itemStack);
NetworkWrapper.instance.sendTo(packet, (EntityPlayerMP) player);
}
player.addChatComponentMessage(new ChatComponentTranslation("info.ntp.cleared"));
}
use of net.minecraft.entity.player.EntityPlayerMP in project NyaSamaRailway by NSDN.
the class ItemNTP8Bit method clearCart.
public void clearCart(ItemStack itemStack, EntityPlayer player) {
power.set(itemStack, 0);
brake.set(itemStack, 5);
dir.set(itemStack, 0);
cart.set(itemStack, -1);
if (player instanceof EntityPlayerMP) {
TrainPacket packet = new TrainPacket();
packet.fromStack(itemStack);
NetworkWrapper.instance.sendTo(packet, (EntityPlayerMP) player);
}
player.addChatComponentMessage(new ChatComponentTranslation("info.ntp.cleared"));
}
use of net.minecraft.entity.player.EntityPlayerMP in project NyaSamaRailway by NSDN.
the class ItemNTP8Bit method onCreated.
@Override
public void onCreated(ItemStack itemStack, World world, EntityPlayer player) {
power.set(itemStack, 0);
brake.set(itemStack, 5);
dir.set(itemStack, 0);
cart.set(itemStack, -1);
if (player instanceof EntityPlayerMP) {
TrainPacket packet = new TrainPacket();
packet.fromStack(itemStack);
NetworkWrapper.instance.sendTo(packet, (EntityPlayerMP) player);
}
}
Aggregations