Advertisement
Guest User

EntityGreek.java

a guest
Jan 22nd, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.97 KB | None | 0 0
  1. //I don't think it's supposed to be abstract but I left it there in case.
  2. public /* abstract */ class EntityGreek extends EntityMob implements IRangedAttackMob
  3. {
  4.     private boolean isArcher;
  5.     private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F);
  6.  
  7.     public EntityGreek(World par1World)
  8.     {
  9.         super(par1World);
  10.         getNavigator().setAvoidsWater(true);
  11.         getNavigator().setBreakDoors(true);
  12.         getNavigator().setEnterDoors(true);
  13.         getNavigator().setCanSwim(true);
  14.         getNavigator().getPathSearchRange();
  15.         clearAITasks();
  16.         this.isImmuneToFire(); //what is this for? Did you mean to do the below line? If so, un comment it.
  17.         // this.isImmuneToFire = true;
  18.         this.tasks.addTask(0, new EntityAISwimming(this));
  19.         this.tasks.addTask(3, new EntityAIWander(this, 1.0D));
  20.         this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
  21.         this.tasks.addTask(5, new EntityAILookIdle(this));
  22.         this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
  23.         this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityRoman.class, 0, true));
  24.         this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityZombie.class, 0, true));
  25.         this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntitySkeleton.class, 0, true));
  26.         this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityCreeper.class, 0, true));
  27.         this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntitySpider.class, 0, true));
  28.         this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityCaveSpider.class, 0, true));
  29.         this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntitySilverfish.class, 0, true));
  30.         isArcher = new Random().nextBoolean();
  31.        
  32.         if(!par1World.isRemote)
  33.         {
  34.             setCombatTask();
  35.         }
  36.     }
  37.    
  38.     @Override
  39.     protected boolean isAIEnabled()
  40.     {
  41.         return true;
  42.     }
  43.  
  44.     @Override
  45.     protected void applyEntityAttributes()
  46.     {
  47.         super.applyEntityAttributes();
  48.         this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D);
  49.         this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(50.0D);
  50.         this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(0.65D);
  51.         this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D);
  52.         this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D);
  53.     }
  54.  
  55.     protected void clearAITasks()
  56.     {
  57.         tasks.taskEntries.clear();
  58.         targetTasks.taskEntries.clear();
  59.     }
  60.    
  61.     public void setCombatTask()
  62.     {
  63.         if(isArcher)
  64.         {
  65.             this.tasks.addTask(2, aiArrowAttack);
  66.         }
  67.         else
  68.         {
  69.             this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityLivingBase.class, 1.0D, true));
  70.         }
  71.     }
  72.  
  73.     public ItemStack getHeldItem()
  74.     {
  75.         if (isArcher)
  76.         {
  77.             return new ItemStack(Percyjackson.greekBow);
  78.         }
  79.         else
  80.         {
  81.             return new ItemStack(Percyjackson.xiphos);
  82.         }
  83.     }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement