Advertisement
TheZyga

EntityNew.java

Jan 1st, 2018
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package net.minecraft.src;
  2.  
  3. public class EntityNew extends EntityPurgatoryAnimal
  4. {
  5.  
  6.  
  7.     public EntityNew(World world)
  8.     {
  9.         super(world);
  10.         this.texture = "/Purgatory/Mobs/Spider1.png";
  11.         setSize(1.5F, 1.9F);
  12.         this.setSize(1.4F, 0.9F);
  13.         this.moveSpeed = 0.8F;
  14.     }
  15.    
  16.     public double getMountedYOffset() {
  17.           return (double)this.height * 0.75D - 0.5D;
  18.        }
  19.  
  20.        protected boolean canTriggerWalking() {
  21.           return false;
  22.        }
  23.  
  24.        protected Entity findPlayerToAttack() {
  25.           float var1 = this.getEntityBrightness(1.0F);
  26.           if(var1 < 0.5F) {
  27.              double var2 = 16.0D;
  28.              return this.worldObj.getClosestPlayerToEntity(this, var2);
  29.           } else {
  30.              return null;
  31.           }
  32.        }
  33.  
  34.     public void writeEntityToNBT(NBTTagCompound nbttagcompound)
  35.     {
  36.         super.writeEntityToNBT(nbttagcompound);
  37.     }
  38.  
  39.     public void readEntityFromNBT(NBTTagCompound nbttagcompound)
  40.     {
  41.         super.readEntityFromNBT(nbttagcompound);
  42.     }
  43.    
  44.     protected void attackEntity(Entity var1, float var2) {
  45.         float var3 = this.getEntityBrightness(1.0F);
  46.         if(var3 > 0.5F && this.rand.nextInt(100) == 0) {
  47.            this.playerToAttack = null;
  48.         } else {
  49.            if(var2 > 2.0F && var2 < 6.0F && this.rand.nextInt(10) == 0) {
  50.               if(this.onGround) {
  51.                  double var4 = var1.posX - this.posX;
  52.                  double var6 = var1.posZ - this.posZ;
  53.                  float var8 = MathHelper.sqrt_double(var4 * var4 + var6 * var6);
  54.                  this.motionX = var4 / (double)var8 * 0.5D * 0.800000011920929D + this.motionX * 0.20000000298023224D;
  55.                  this.motionZ = var6 / (double)var8 * 0.5D * 0.800000011920929D + this.motionZ * 0.20000000298023224D;
  56.                  this.motionY = 0.4000000059604645D;
  57.               }
  58.            } else {
  59.               super.attackEntity(var1, var2);
  60.            }
  61.  
  62.         }
  63.      }
  64.  
  65.     protected String getLivingSound() {
  66.         return "mob.spider";
  67.      }
  68.  
  69.      protected String getHurtSound() {
  70.         return "mob.spider";
  71.      }
  72.  
  73.      protected String getDeathSound() {
  74.         return "mob.spiderdeath";
  75.      }
  76.  
  77.     protected float getSoundVolume()
  78.     {
  79.         return 0.4F;
  80.     }
  81.    
  82.     protected boolean canDespawn()
  83.     {
  84.     return false;
  85.     }
  86.  
  87.     protected int getDropItemId() {
  88.         return Item.silk.shiftedIndex;
  89.      }
  90.    
  91.     public boolean isOnLadder() {
  92.         return this.isCollidedHorizontally;
  93.      }
  94.    
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement