use of com.minecraftabnormals.upgrade_aquatic.common.entities.FlareEntity in project upgrade-aquatic by team-abnormals.
the class RestfulnessEffect method performEffect.
@Override
public void performEffect(LivingEntity entity, int amplifier) {
if (entity instanceof ServerPlayerEntity) {
ServerPlayerEntity playerMP = (ServerPlayerEntity) entity;
StatisticsManager statisticsManager = playerMP.getStats();
statisticsManager.increment(playerMP, Stats.CUSTOM.get(Stats.TIME_SINCE_REST), -(24000 * (amplifier + 1)));
} else if (entity instanceof PhantomEntity) {
entity.attackEntityFrom(DamageSource.MAGIC, Float.MAX_VALUE);
} else if (entity instanceof FlareEntity) {
PhantomEntity phantom = EntityType.PHANTOM.create(entity.world);
phantom.setLocationAndAngles(entity.getPosX(), entity.getPosY(), entity.getPosZ(), entity.rotationYaw, entity.rotationPitch);
phantom.setNoAI(((MobEntity) entity).isAIDisabled());
if (entity.hasCustomName()) {
phantom.setCustomName(entity.getCustomName());
phantom.setCustomNameVisible(entity.isCustomNameVisible());
}
phantom.setHealth(entity.getHealth());
if (phantom.getHealth() > 0) {
entity.world.addEntity(phantom);
entity.remove(true);
}
entity.remove(true);
}
}
use of com.minecraftabnormals.upgrade_aquatic.common.entities.FlareEntity in project upgrade-aquatic by team-abnormals.
the class InsomniaEffect method performEffect.
@Override
public void performEffect(LivingEntity entity, int amplifier) {
if (entity instanceof ServerPlayerEntity) {
ServerPlayerEntity playerMP = (ServerPlayerEntity) entity;
StatisticsManager statisticsManager = playerMP.getStats();
statisticsManager.increment(playerMP, Stats.CUSTOM.get(Stats.TIME_SINCE_REST), (24000 * (amplifier + 1)));
} else if (entity instanceof PhantomEntity) {
FlareEntity flare = UAEntities.FLARE.get().create(entity.world);
flare.setLocationAndAngles(entity.getPosX(), entity.getPosY(), entity.getPosZ(), entity.rotationYaw, entity.rotationPitch);
flare.setNoAI(((MobEntity) entity).isAIDisabled());
if (entity.hasCustomName()) {
flare.setCustomName(entity.getCustomName());
flare.setCustomNameVisible(entity.isCustomNameVisible());
}
flare.setHealth(entity.getHealth());
if (flare.getHealth() > 0) {
entity.world.addEntity(flare);
entity.remove(true);
}
PlayerEntity player = entity.getEntityWorld().getClosestPlayer(entity, 11);
if (player instanceof ServerPlayerEntity && player.isAlive()) {
ServerPlayerEntity serverPlayer = (ServerPlayerEntity) player;
if (!entity.world.isRemote()) {
UACriteriaTriggers.CONVERT_PHANTOM.trigger(serverPlayer);
}
}
} else if (entity instanceof FlareEntity) {
entity.attackEntityFrom(DamageSource.MAGIC, Float.MAX_VALUE);
}
}
Aggregations