@SuppressWarnings("deprecation") @Override public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_) { if (entityIn instanceof EntityLivingBase && (((EntityLivingBase) entityIn).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)) { collidingBoxes.add(new AxisAlignedBB(pos).expand(0, 255, 0)); } if (entityIn instanceof EntityLivingBase && (((EntityLivingBase) entityIn).getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD)) { entityIn.attackEntityFrom(DamageSource.MAGIC, 1); } if (entityIn instanceof EntityBlaze) { collidingBoxes.add(new AxisAlignedBB(pos).expand(0, 255, 0)); } if (entityIn instanceof EntityEnderman) { collidingBoxes.add(new AxisAlignedBB(pos).expand(0, 255, 0)); } if (entityIn instanceof EntityGhast) { collidingBoxes.add(new AxisAlignedBB(pos).expand(0, 255, 0)); } if (entityIn instanceof EntityVex) { collidingBoxes.add(new AxisAlignedBB(pos).expand(0, 255, 0)); } }
@Override public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) { if (amplifier >= 3) { if (entity instanceof EntityWitch) { entity.setFire(500); entity.attackEntityFrom(DamageSource.MAGIC, 20); } else if (entity.getCreatureAttribute() == EnumCreatureAttribute.ILLAGER) { entity.addPotionEffect(new PotionEffect(MobEffects.WITHER, 1500, 0)); entity.attackEntityFrom(DamageSource.MAGIC, 20); } } else if (amplifier == 2 && entity.getCreatureAttribute() == EnumCreatureAttribute.ILLAGER || entity instanceof EntityWitch) { entity.attackEntityFrom(DamageSource.MAGIC, 16); } else if (entity.getCreatureAttribute() == EnumCreatureAttribute.ILLAGER) { entity.attackEntityFrom(DamageSource.MAGIC, 10); } }
@Override public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { if (!world.isRemote) { world.scheduleUpdate(pos, this, 5); AxisAlignedBB axisalignedbb = this.getCollisionBoundingBox(world, pos, state).expand(6, 6, 6); List<EntityMob> list = world.getEntitiesWithinAABB(EntityMob.class, axisalignedbb); for (EntityMob mob : list) { if (mob.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD) { mob.setFire(20); } } } }
@Override public boolean shouldDefend(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, ArmourSlot slot) { Entity entity = source.getSourceOfDamage(); if (entity == null) { return false; } if (!(entity instanceof EntityMob)) { return false; } EntityMob entityMob = (EntityMob) entity; return entityMob.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; }
@Override public boolean shouldDefend(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, ArmourSlot slot) { Entity entity = source.getSourceOfDamage(); if (entity == null) { return false; } if (!(entity instanceof EntityMob)) { return false; } EntityMob entityMob = (EntityMob) entity; return entityMob.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD; }
public static boolean shouldSilverHurt(EntityLivingBase target) { Class enClass = target.getClass(); String name = ""; if(enClass != null && EntityList.classToStringMapping.get(enClass) != null) { name = (String) EntityList.classToStringMapping.get(enClass); } if (target.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD) { return true; } if (name.endsWith("Werewolf")) { return true; } return false; }
@Override public boolean shouldDamage(DamageSource source) { if(material == EnumArmourMF.GUILDED) { if(source.getSourceOfDamage() != null && source.getSourceOfDamage() instanceof EntityLivingBase) { if(((EntityLivingBase)source.getSourceOfDamage()).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD) { return false; } } } if(material == EnumArmourMF.DRAGONFORGE) { if(source.isFireDamage()) { return false; } } return true; }
@Override public boolean hitEntity(ItemStack weapon, EntityLiving target, EntityLiving user) { if(this.toolMaterial == ToolMaterialMedieval.DRAGONFORGE) target.setFire(20); if(this.toolMaterial == ToolMaterialMedieval.IGNOTUMITE) { user.heal(2); } if(this.toolMaterial == ToolMaterialMedieval.ORNATE) { if (((EntityLiving) target).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD || target.getClass().getName().endsWith("MoCEntityWarewolf")) { target.setFire(20); target.worldObj.playSoundAtEntity(target, "random.fizz", 1, 1); } } return super.hitEntity(weapon, target, user); }
@Override public float getDamage(Entity tar) { float dam = weaponDamage; if(tar != null && tar instanceof EntityLiving && toolMaterial == ToolMaterialMedieval.ORNATE) { if (((EntityLiving) tar).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD || tar.getClass().getName().endsWith("MoCEntityWarewolf")) { if(tar.getClass().getName().endsWith("MoCEntityWarewolf")) { dam *= 10; } else { dam *= 2; } } } return dam; }
public static int getHearing(Entity entity) { if(entity instanceof ISpecialSenses) { return((ISpecialSenses)entity).getSight(); } if(entity instanceof EntityMob) { if(((EntityMob)entity).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD) { return 10; } } return 5; }
@Override public void onUpdate(ItemStack is, World w, Entity ent, int time, boolean holding) { if (ent instanceof EntityLivingBase) { final EntityLivingBase el = (EntityLivingBase) ent; if (el.getEquipmentInSlot(0) == null) return; if (el.getEquipmentInSlot(0).getItem() != this) return; else if (el.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD) return; else if (!el.isPotionActive(Potion.wither.id)) { el.addPotionEffect(new PotionEffect(Potion.wither.id, 41, 0)); } } super.onUpdate(is, w, ent, time, holding); }
public void doShadowAttack(EntityLivingBase par1EntityLiving, float par2) { final boolean harm_undead = par1EntityLiving.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; final EntityThrowable entityball = new EntityShadowBall(worldObj, this, harm_undead, IaSWorldHelper.getRegionLevel(par1EntityLiving) >= 6); final double d0 = par1EntityLiving.posX + par1EntityLiving.motionX - posX; final double d1 = par1EntityLiving.posY + par1EntityLiving.getEyeHeight() - getEyeHeight() - posY; final double d2 = par1EntityLiving.posZ + par1EntityLiving.motionZ - posZ; final float f1 = MathHelper.sqrt_double(d0 * d0 + d2 * d2); if (f1 <= 2.0) { entityball.setThrowableHeading(d0, d1, d2, 0.40F, 8.0F); } else { entityball.rotationPitch += 20.0F; } entityball.setThrowableHeading(d0, d1 + f1 * 0.2F, d2, 0.80F, 8.0F); worldObj.spawnEntityInWorld(entityball); }
@Override public boolean hitEntity(ItemStack stack, EntityLivingBase target, @Nonnull EntityLivingBase attacker) { if (!target.world.isRemote) { if (target.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD && attacker instanceof EntityPlayer) { target.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 12); stack.damageItem(25, attacker); } else { stack.damageItem(1, attacker); } } return true; }
@SubscribeEvent public void onEntityDamage(LivingHurtEvent event) { DamageSource source = event.getSource(); Entity attacker = source.getTrueSource(); if ((attacker instanceof EntityLivingBase) && ((EntityLivingBase) attacker).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD) { event.setAmount(event.getAmount() * 0.95F); } }
@SuppressWarnings("deprecation") @Override public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_) { if (entityIn instanceof EntityLivingBase && (((EntityLivingBase) entityIn).getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD)) { entityIn.attackEntityFrom(DamageSource.MAGIC, 4); } if (entityIn instanceof EntityLivingBase && (((EntityLivingBase) entityIn).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)) { entityIn.attackEntityFrom(DamageSource.MAGIC, 4); } }
@Override public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) { if (entity.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD) { if (amplifier >= 3) { entity.attackEntityFrom(DamageSource.MAGIC, 20); } else if (amplifier == 2) { entity.attackEntityFrom(DamageSource.MAGIC, 16); } else { entity.attackEntityFrom(DamageSource.MAGIC, 10); } } }
public static float func_152377_a(ItemStack p_152377_0_, EnumCreatureAttribute p_152377_1_) { enchantmentModifierLiving.livingModifier = 0.0F; enchantmentModifierLiving.entityLiving = p_152377_1_; applyEnchantmentModifier(enchantmentModifierLiving, p_152377_0_); return enchantmentModifierLiving.livingModifier; }
/** * Called whenever a mob is damaged with an item that has this enchantment on it. */ public void onEntityDamaged(EntityLivingBase user, Entity target, int level) { if (target instanceof EntityLivingBase) { EntityLivingBase entitylivingbase = (EntityLivingBase)target; if (this.damageType == 2 && entitylivingbase.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD) { int i = 20 + user.getRNG().nextInt(10 * level); entitylivingbase.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, i, 3)); } } }
@Override public EnumCreatureAttribute getCreatureAttribute() { if (m_realPlayer == null) { return super.getCreatureAttribute(); } else { syncToRealPlayer(); return syncPublicFieldsFromRealAndReturn(m_realPlayer.getCreatureAttribute()); } }
@Override public EnumCreatureAttribute getCreatureAttribute() { if (m_realPlayer == null) { return super.getCreatureAttribute(); } else { return m_realPlayer.getCreatureAttribute(); } }
public static float getModifierForCreature(ItemStack stack, EnumCreatureAttribute creatureAttribute) { ENCHANTMENT_MODIFIER_LIVING.livingModifier = 0.0F; ENCHANTMENT_MODIFIER_LIVING.entityLiving = creatureAttribute; applyEnchantmentModifier(ENCHANTMENT_MODIFIER_LIVING, stack); return ENCHANTMENT_MODIFIER_LIVING.livingModifier; }
/** * Called whenever a mob is damaged with an item that has this enchantment on it. */ public void onEntityDamaged(EntityLivingBase user, Entity target, int level) { if (target instanceof EntityLivingBase) { EntityLivingBase entitylivingbase = (EntityLivingBase)target; if (this.damageType == 2 && entitylivingbase.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD) { int i = 20 + user.getRNG().nextInt(10 * level); entitylivingbase.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, i, 3)); } } }
@Override public void refuel() { BlockPos min = getPos(); BlockPos max = getPos().up(); List<EntityLivingBase> entites = getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(min, max).expand(2, 1, 2)); int mobsAttacked = 0; int fuelAmt = 0; if(!entites.isEmpty()){ for(EntityLivingBase entity : entites){ if(entity.isEntityAlive() && !(entity instanceof EntityPlayer)){ if(entity.attackEntityFrom(DamageSource.WITHER, 1)){ //One pig is worth 1/4 of a piece of coal in a furnace generator. At 40 ticks * 30 CU per tick int value = 1; if(entity.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD){ value = 2; } fuelAmt+=80*value; mobsAttacked++; if(mobsAttacked >= Config.engine_vampire_maxattack){ break; } } } } } if(fuelAmt > 0){ fuel.add(fuelAmt); maxFuel.setValue(fuel.getValue()); } }
public static void handle_Cure(PacketSpellToServer message, World world) { Entity e; e = world.getEntityByID(message.data); if(((EntityLivingBase) e).getCreatureAttribute()==EnumCreatureAttribute.UNDEAD){ ((EntityLivingBase)e).attackEntityFrom(DamageSource.generic, 4.0f + (message.data2 / 20.0f)); } if (e instanceof EntityLivingBase && !(e instanceof EntityMob)) { ((EntityLivingBase)e).heal(3.0f + message.data2 / 30); //30 clarity pour 1 coeur en plus } }
public static void handle_Cura(PacketSpellToServer message, World world) { Entity e; e = world.getEntityByID(message.data); if (e instanceof EntityLivingBase && !(e instanceof EntityMob)) { ((EntityLivingBase)e).heal(6.0f + message.data2 / 30); //30 clarity pour 1 coeur en plus } if(((EntityLivingBase) e).getCreatureAttribute()==EnumCreatureAttribute.UNDEAD){ ((EntityLivingBase)e).attackEntityFrom(DamageSource.generic, 8.0f + (message.data2 / 20.0f)); } }
public static void handle_Curaga(PacketSpellToServer message, World world) { Entity e; e = world.getEntityByID(message.data); if (e instanceof EntityLivingBase && !(e instanceof EntityMob)) { ((EntityLivingBase)e).heal(9.0f + message.data2 / 30); //30 clarity pour 1 coeur en plus } if(((EntityLivingBase) e).getCreatureAttribute()==EnumCreatureAttribute.UNDEAD){ ((EntityLivingBase)e).attackEntityFrom(DamageSource.generic, 12.0f + (message.data2 / 20.0f)); } }
@Override public float calcDamageByCreature(int level, EnumCreatureAttribute creatureType) { if (creatureType == EnumCreatureAttribute.ILLAGER || creatureType == EnumCreatureAttribute.UNDEFINED) { return level * 2.5F; } else { return 0; } }