Advertisement
Guest User

Untitled

a guest
Oct 29th, 2017
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.13 KB | None | 0 0
  1. package lolmod.entitys;
  2.  
  3. import lolmod.entitys.ai.EntityAIWalkHome;
  4. import lolmod.game.Game;
  5. import net.minecraft.block.Block;
  6. import net.minecraft.entity.Entity;
  7. import net.minecraft.entity.EntityLivingBase;
  8. import net.minecraft.entity.SharedMonsterAttributes;
  9. import net.minecraft.entity.ai.EntityAIHurtByTarget;
  10. import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
  11. import net.minecraft.entity.monster.EntityPigZombie;
  12. import net.minecraft.entity.player.EntityPlayer;
  13. import net.minecraft.init.SoundEvents;
  14. import net.minecraft.util.DamageSource;
  15. import net.minecraft.util.SoundEvent;
  16. import net.minecraft.util.math.BlockPos;
  17. import net.minecraft.world.World;
  18.  
  19. public class EntityBluebuff extends EntityNeutral {
  20.  
  21.     private int side;
  22.    
  23.     public EntityBluebuff(World worldIn) {
  24.         this(worldIn, Game.TEAM_BLAU);
  25.     }
  26.    
  27.     @Override
  28.     public void setAttackTarget(EntityLivingBase entitylivingbaseIn) {
  29.         System.out.println("setting attack target");
  30.         super.setAttackTarget(entitylivingbaseIn);
  31.     }
  32.    
  33.     public EntityBluebuff(World worldIn, int side) {
  34.         super(worldIn);
  35.         this.side = side;
  36.         if(this.side == Game.TEAM_BLAU)
  37.             this.setHomePosAndDistance(Game.BLUEBUFF_WEST, 10);
  38.         else
  39.             this.setHomePosAndDistance(Game.BLUEBUFF_EAST, 10);
  40.         this.setSize(0.6F, 1.95F);
  41.     }
  42.  
  43.     @Override
  44.     protected void initEntityAI() {
  45.         this.tasks.addTask(1, new EntityAIWalkHome(this));
  46.         this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[] {EntityPigZombie.class}));
  47.         this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityPlayer>(this, EntityPlayer.class, true));
  48.         //this.targetTasks.addTask(2, new EntityAINeutralHurtByTarget(this));
  49.     }
  50.    
  51.     @Override
  52.     public boolean attackEntityAsMob(Entity entityIn) {
  53.         boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), (float)((int)this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue()));
  54.  
  55.         if(flag) {
  56.             this.applyEnchantments(this, entityIn);
  57.         }
  58.  
  59.         return flag;
  60.     }
  61.  
  62.     @Override
  63.     protected void applyEntityAttributes() {
  64.         super.applyEntityAttributes();
  65.         this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.30000001192092896D);
  66.         this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(20.0D);
  67.         this.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).setBaseValue(0D);
  68.         this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(2.0D);
  69.     }
  70.    
  71.     @Override
  72.     protected void updateAITasks() {
  73.         super.updateAITasks();
  74.     }
  75.    
  76.     protected SoundEvent getHurtSound(DamageSource p_184601_1_) {
  77.         return SoundEvents.ENTITY_IRONGOLEM_HURT;
  78.     }
  79.  
  80.     protected SoundEvent getDeathSound() {
  81.         return SoundEvents.ENTITY_IRONGOLEM_DEATH;
  82.     }
  83.  
  84.     protected void playStepSound(BlockPos pos, Block blockIn) {
  85.         this.playSound(SoundEvents.ENTITY_IRONGOLEM_STEP, 1.0F, 1.0F);
  86.     }
  87.    
  88.     @Override
  89.     public void onDeath(DamageSource cause) {
  90.         super.onDeath(cause);
  91.     }
  92.    
  93.     @Override
  94.     public int getMaxSpawnedInChunk() {
  95.         return 1;
  96.     }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement