use of net.minecraft.entity.monster.CreeperEntity in project Enigmatic-Legacy by Aizistral-Studios.
the class EnigmaticEventHandler method onEntityHurt.
@SubscribeEvent
public void onEntityHurt(LivingHurtEvent event) {
if (event.getEntityLiving() instanceof PlayerEntity & !event.getEntityLiving().world.isRemote) {
PlayerEntity player = (PlayerEntity) event.getEntityLiving();
if (SuperpositionHandler.hasCurio(player, EnigmaticLegacy.angelBlessing))
if (AngelBlessing.resistanceList.containsKey(event.getSource().damageType))
event.setAmount(event.getAmount() * AngelBlessing.resistanceList.get(event.getSource().damageType));
if (SuperpositionHandler.hasCurio(player, EnigmaticLegacy.oceanStone)) {
Entity attacker = event.getSource().getTrueSource();
if (attacker instanceof DrownedEntity || attacker instanceof GuardianEntity || attacker instanceof ElderGuardianEntity)
event.setAmount(event.getAmount() * ConfigHandler.OCEAN_STONE_UNDERWATER_CREATURES_RESISTANCE.getValue().asModifierInverted());
}
if (SuperpositionHandler.hasCurio(player, EnigmaticLegacy.eyeOfNebula))
if (EyeOfNebula.resistanceList.containsKey(event.getSource().damageType))
event.setAmount(event.getAmount() * EyeOfNebula.resistanceList.get(event.getSource().damageType).get());
if (SuperpositionHandler.hasCurio(player, EnigmaticLegacy.golemHeart))
if (GolemHeart.resistanceList.containsKey(event.getSource().damageType))
event.setAmount(event.getAmount() * GolemHeart.resistanceList.get(event.getSource().damageType).get());
if (SuperpositionHandler.hasCurio(player, EnigmaticLegacy.voidPearl))
if (VoidPearl.resistanceList.containsKey(event.getSource().damageType))
event.setAmount(event.getAmount() * VoidPearl.resistanceList.get(event.getSource().damageType).get());
if (SuperpositionHandler.hasCurio(player, EnigmaticLegacy.magmaHeart)) {
// System.out.println("Damage type: " + event.getSource().damageType);
if (event.getSource().getTrueSource() instanceof LivingEntity && MagmaHeart.nemesisList.contains(event.getSource().damageType)) {
LivingEntity attacker = (LivingEntity) event.getSource().getTrueSource();
if (!attacker.isImmuneToFire()) {
attacker.attackEntityFrom(new EntityDamageSource(DamageSource.ON_FIRE.damageType, player), (float) ConfigHandler.BLAZING_CORE_DAMAGE_FEEDBACK.getValue());
attacker.setFire((int) ConfigHandler.BLAZING_CORE_IGNITION_FEEDBACK.getValue());
}
}
}
if (EtheriumArmor.hasShield(player)) {
if (event.getSource().getImmediateSource() instanceof LivingEntity) {
LivingEntity attacker = ((LivingEntity) event.getSource().getTrueSource());
Vector3 vec = Vector3.fromEntityCenter(player).subtract(Vector3.fromEntityCenter(event.getSource().getTrueSource())).normalize();
attacker.knockBack(player, 0.75F, vec.x, vec.y);
player.world.playSound(null, player.getPosition(), EnigmaticLegacy.SHIELD_TRIGGER, SoundCategory.PLAYERS, 1.0F, 0.9F + (float) (Math.random() * 0.1D));
player.world.playSound(null, player.getPosition(), EnigmaticLegacy.SHIELD_TRIGGER, SoundCategory.PLAYERS, 1.0F, 0.9F + (float) (Math.random() * 0.1D));
}
event.setAmount(event.getAmount() * ConfigHandler.ETHERIUM_ARMOR_SHIELD_REDUCTION.getValue().asModifierInverted());
}
} else if (event.getEntityLiving() instanceof MonsterEntity) {
MonsterEntity monster = (MonsterEntity) event.getEntityLiving();
if (event.getSource().getTrueSource() instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) event.getSource().getTrueSource();
if (SuperpositionHandler.hasCurio(player, EnigmaticLegacy.monsterCharm)) {
if (monster.isEntityUndead()) {
event.setAmount(event.getAmount() * ConfigHandler.MONSTER_CHARM_UNDEAD_DAMAGE.getValue().asModifier(true));
} else if (monster.isAggressive() || monster instanceof CreeperEntity) {
if (monster instanceof EndermanEntity || monster instanceof ZombiePigmanEntity || monster instanceof BlazeEntity || monster instanceof GuardianEntity || monster instanceof ElderGuardianEntity || !monster.isNonBoss()) {
} else {
event.setAmount(event.getAmount() * ConfigHandler.MONSTER_CHARM_AGGRESSIVE_DAMAGE.getValue().asModifier(true));
}
}
}
if (monster instanceof CreeperEntity)
monster.setLastAttackedEntity(player);
// TODO Test if required
}
}
if (event.getSource().getTrueSource() instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) event.getSource().getTrueSource();
if (SuperpositionHandler.hasCurio(player, EnigmaticLegacy.voidPearl)) {
event.getEntityLiving().addPotionEffect(new EffectInstance(Effects.WITHER, ConfigHandler.VOID_PEARL_WITHERING_EFFECT_TIME.getValue(), ConfigHandler.VOID_PEARL_WITHERING_EFFECT_LEVEL.getValue(), false, true));
}
}
}
use of net.minecraft.entity.monster.CreeperEntity in project Arclight by IzzelAliz.
the class CreeperEntityMixin method explode.
/**
* @author IzzelAliz
* @reason
*/
@Overwrite
public void explode() {
if (!this.world.isRemote) {
Explosion.Mode explosion_effect = ForgeEventFactory.getMobGriefingEvent(this.world, (CreeperEntity) (Object) this) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE;
final float f = this.dataManager.get(POWERED) ? 2.0f : 1.0f;
final ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
this.dead = true;
this.world.createExplosion((CreeperEntity) (Object) this, this.posX, this.posY, this.posZ, event.getRadius(), event.getFire(), explosion_effect);
this.remove();
this.spawnLingeringCloud();
} else {
this.timeSinceIgnited = 0;
}
}
}
use of net.minecraft.entity.monster.CreeperEntity in project WarDance by Jackiecrazy.
the class GeneralUtils method dropSkull.
/**
* drops a skull of the given type. For players it will retrieve their skin
*/
public static ItemStack dropSkull(LivingEntity elb) {
ItemStack ret = null;
if (elb instanceof AbstractSkeletonEntity) {
if (elb instanceof WitherSkeletonEntity)
ret = new ItemStack(Items.WITHER_SKELETON_SKULL);
else
ret = new ItemStack(Items.SKELETON_SKULL);
} else if (elb instanceof ZombieEntity)
ret = new ItemStack(Items.ZOMBIE_HEAD);
else if (elb instanceof CreeperEntity)
ret = new ItemStack(Items.CREEPER_HEAD);
else if (elb instanceof EnderDragonEntity)
ret = new ItemStack(Items.DRAGON_HEAD);
else if (elb instanceof PlayerEntity) {
PlayerEntity p = (PlayerEntity) elb;
ret = new ItemStack(Items.PLAYER_HEAD);
ret.setTag(new CompoundNBT());
ret.getTag().putString("SkullOwner", p.getName().getString());
}
return ret;
}
Aggregations