Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mod.blackoutrpg.entities;
- import net.minecraft.block.BlockState;
- import net.minecraft.entity.*;
- import net.minecraft.entity.ai.attributes.AttributeModifierMap;
- import net.minecraft.entity.ai.attributes.Attributes;
- import net.minecraft.entity.ai.goal.*;
- import net.minecraft.entity.monster.MonsterEntity;
- import net.minecraft.entity.monster.ZombieEntity;
- import net.minecraft.entity.monster.piglin.PiglinBruteBrain;
- import net.minecraft.entity.player.PlayerEntity;
- import net.minecraft.inventory.EquipmentSlotType;
- import net.minecraft.item.ItemStack;
- import net.minecraft.item.Items;
- import net.minecraft.nbt.CompoundNBT;
- import net.minecraft.util.DamageSource;
- import net.minecraft.util.SoundEvent;
- import net.minecraft.util.SoundEvents;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.world.Difficulty;
- import net.minecraft.world.DifficultyInstance;
- import net.minecraft.world.IServerWorld;
- import net.minecraft.world.World;
- import javax.annotation.Nullable;
- public class OrcWandererEntity extends MonsterEntity {
- public OrcWandererEntity(EntityType<? extends MonsterEntity> type, World worldIn) {
- super(type, worldIn);
- }
- public static AttributeModifierMap.MutableAttribute setCustomAttributes() {
- return MonsterEntity.registerAttributes()
- .createMutableAttribute(Attributes.MAX_HEALTH, 20.0D)
- .createMutableAttribute(Attributes.ARMOR, 10.0D)
- .createMutableAttribute(Attributes.MOVEMENT_SPEED, (double)0.25D)
- .createMutableAttribute(Attributes.FOLLOW_RANGE, 35.0D)
- .createMutableAttribute(Attributes.ATTACK_DAMAGE, 5.0D)
- .createMutableAttribute(Attributes.ATTACK_SPEED, 2.0D)
- .createMutableAttribute(Attributes.ATTACK_KNOCKBACK, 1.0D);
- }
- @Override
- protected void registerGoals() {
- super.registerGoals();
- this.goalSelector.addGoal(9, new SwimGoal(this));
- this.goalSelector.addGoal(8, new LookAtGoal(this, PlayerEntity.class, 8.0F));
- this.goalSelector.addGoal(8, new LookRandomlyGoal(this));
- this.goalSelector.addGoal(7, new WaterAvoidingRandomWalkingGoal(this, 1.0D));
- this.goalSelector.addGoal(6, new OpenDoorGoal(this, true));
- this.targetSelector.addGoal(10, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, true));
- this.targetSelector.addGoal(10, new MeleeAttackGoal(this, 1, true));
- }
- @Override
- public ILivingEntityData onInitialSpawn(IServerWorld worldIn, DifficultyInstance difficultyIn, SpawnReason reason, @Nullable ILivingEntityData spawnDataIn, @Nullable CompoundNBT dataTag) {
- this.setEquipmentBasedOnDifficulty(difficultyIn);
- return super.onInitialSpawn(worldIn, difficultyIn, reason, spawnDataIn, dataTag);
- }
- @Override
- protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty) {
- this.setItemStackToSlot(EquipmentSlotType.MAINHAND, new ItemStack(Items.GOLDEN_AXE));
- }
- @Override
- protected int getExperiencePoints(PlayerEntity player) { return 1 + this.world.rand.nextInt(4); }
- @Override
- protected SoundEvent getAmbientSound() { return SoundEvents.ENTITY_PIG_AMBIENT; }
- @Override
- protected SoundEvent getDeathSound() { return SoundEvents.ENTITY_PIG_DEATH; }
- @Override
- protected SoundEvent getHurtSound(DamageSource damageSourceIn) { return SoundEvents.ENTITY_PIG_HURT; }
- @Override
- protected void playStepSound(BlockPos pos, BlockState blockIn) { this.playSound(SoundEvents.ENTITY_PIG_STEP, 0.15F, 1.0F); }
- @Override
- protected SoundEvent getFallSound(int heightIn) { return heightIn > 4 ? SoundEvents.ENTITY_HOSTILE_BIG_FALL : SoundEvents.ENTITY_HOSTILE_SMALL_FALL; }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement