/xolova/divinerpg/entities/overworld/mobs/EntityJungleSpider.java
https://bitbucket.org/Hologuardian/divinerpg · Java · 114 lines · 82 code · 20 blank · 12 comment · 6 complexity · 2f5f0bc931649df634ecec9d69f3c930 MD5 · raw file
- package xolova.divinerpg.entities.overworld.mobs;
- import net.minecraft.enchantment.EnchantmentHelper;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLiving;
- import net.minecraft.entity.monster.EntitySpider;
- import net.minecraft.potion.Potion;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.util.DamageSource;
- import net.minecraft.util.MathHelper;
- import net.minecraft.world.World;
- import xolova.divinerpg.utils.helpers.item.OverworldItemHelper;
- public class EntityJungleSpider extends EntitySpider
- {
- public EntityJungleSpider(World var1)
- {
- super(var1);
- this.texture = "/mob/junglespider.png";
- this.setSize(1.4F, 0.9F);
- }
- public int getAttackStrength(Entity var1)
- {
- return 16;
- }
- public int getMaxHealth()
- {
- return 120;
- }
- public boolean attackEntityAsMob(Entity par1Entity)
- {
- int var2 = this.getAttackStrength(par1Entity);
- if (this.isPotionActive(Potion.damageBoost))
- {
- var2 += 3 << this.getActivePotionEffect(Potion.damageBoost).getAmplifier();
- }
- if (this.isPotionActive(Potion.weakness))
- {
- var2 -= 2 << this.getActivePotionEffect(Potion.weakness).getAmplifier();
- }
- int var3 = 0;
- if (par1Entity instanceof EntityLiving)
- {
- var2 += EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLiving)par1Entity);
- var3 += EnchantmentHelper.getKnockbackModifier(this, (EntityLiving)par1Entity);
- }
- boolean var4 = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), var2);
- if (var4)
- {
- if (var3 > 0)
- {
- par1Entity.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)var3 * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)var3 * 0.5F));
- this.motionX *= 0.6D;
- this.motionZ *= 0.6D;
- }
-
- ((EntityLiving)par1Entity).addPotionEffect(new PotionEffect(Potion.poison.id, var2 * 20, 0));
- int var5 = EnchantmentHelper.getFireAspectModifier(this);
- if (var5 > 0)
- {
- par1Entity.setFire(var5 * 4);
- }
- }
- return var4;
- }
- /**
- * Returns the sound this mob makes while it's alive.
- */
- protected String getLivingSound()
- {
- return "mob.RPG.JungleSpider";
- }
- /**
- * Returns the item ID for the item the mob drops on death.
- */
- protected int getDropItemId()
- {
- return OverworldItemHelper.jungleShard.itemID;
- }
- /**
- * Drop 0-2 items of this living's type
- */
- protected void dropFewItems(boolean var1, int var2)
- {
- int var3 = this.rand.nextInt(4 + var2);
- int var4;
- this.dropItem(OverworldItemHelper.jungleShard.itemID, var3);
- }
- /**
- * Checks to make sure the light is not too bright where the mob is spawning
- */
- @Override
- protected boolean isValidLightLevel()
- {
- return true;
- }
- }