Advertisement
Guest User

Untitled

a guest
Nov 19th, 2020
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.56 KB | None | 0 0
  1. package com.bunny.blackoutrpg.entities;
  2.  
  3. import net.minecraft.block.BlockState;
  4. import net.minecraft.entity.*;
  5. import net.minecraft.entity.ai.attributes.AttributeModifierMap;
  6. import net.minecraft.entity.ai.attributes.Attributes;
  7. import net.minecraft.entity.ai.goal.*;
  8. import net.minecraft.entity.monster.MonsterEntity;
  9. import net.minecraft.entity.player.PlayerEntity;
  10. import net.minecraft.util.DamageSource;
  11. import net.minecraft.util.SoundEvent;
  12. import net.minecraft.util.SoundEvents;
  13. import net.minecraft.util.math.BlockPos;
  14. import net.minecraft.world.World;
  15.  
  16. public class OrcWandererEntity extends MonsterEntity {
  17.  
  18.     public OrcWandererEntity(EntityType<? extends MonsterEntity> type, World worldIn) {
  19.         super(type, worldIn);
  20.     }
  21.  
  22.     public static AttributeModifierMap.MutableAttribute setCustomAttributes() {
  23.         return MonsterEntity.registerAttributes()
  24.                 .createMutableAttribute(Attributes.MAX_HEALTH, 15.0D)
  25.                 .createMutableAttribute(Attributes.MOVEMENT_SPEED, 0.25D)
  26.                 .createMutableAttribute(Attributes.FOLLOW_RANGE, 35.0D)
  27.                 .createMutableAttribute(Attributes.ATTACK_DAMAGE, 3.0D)
  28.                 .createMutableAttribute(Attributes.ATTACK_KNOCKBACK, 1.0D);
  29.     }
  30.     @Override
  31.     protected void registerGoals() {
  32.         super.registerGoals();
  33.         this.goalSelector.addGoal(9, new SwimGoal(this));
  34.         this.goalSelector.addGoal(8, new LookAtGoal(this, PlayerEntity.class, 6.0F));
  35.         this.goalSelector.addGoal(8, new LookRandomlyGoal(this));
  36.         this.goalSelector.addGoal(5, new MeleeAttackGoal(this, 1.0D, false));
  37.         this.goalSelector.addGoal(7, new WaterAvoidingRandomWalkingGoal(this, 1.0D));
  38.         this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, true));
  39.     }
  40.  
  41.     @Override
  42.     protected int getExperiencePoints(PlayerEntity player) { return 1 + this.world.rand.nextInt(4); }
  43.  
  44.     @Override
  45.     protected SoundEvent getAmbientSound() { return SoundEvents.ENTITY_PIG_AMBIENT; }
  46.  
  47.     @Override
  48.     protected SoundEvent getDeathSound() { return SoundEvents.ENTITY_PIG_DEATH; }
  49.  
  50.     @Override
  51.     protected SoundEvent getHurtSound(DamageSource damageSourceIn) { return SoundEvents.ENTITY_PIG_HURT; }
  52.  
  53.     @Override
  54.     protected void playStepSound(BlockPos pos, BlockState blockIn) { this.playSound(SoundEvents.ENTITY_PIG_STEP, 0.15F, 1.0F); }
  55.  
  56.     @Override
  57.     protected SoundEvent getFallSound(int heightIn) { return heightIn > 4 ? SoundEvents.ENTITY_HOSTILE_BIG_FALL : SoundEvents.ENTITY_HOSTILE_SMALL_FALL; }
  58. }
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement