Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mojius.mojiusmod.entities;
- import net.minecraft.entity.EntityType;
- import net.minecraft.entity.SharedMonsterAttributes;
- import net.minecraft.entity.ai.goal.HurtByTargetGoal;
- import net.minecraft.entity.ai.goal.LookAtGoal;
- import net.minecraft.entity.ai.goal.LookRandomlyGoal;
- import net.minecraft.entity.ai.goal.NearestAttackableTargetGoal;
- import net.minecraft.entity.ai.goal.RandomWalkingGoal;
- import net.minecraft.entity.ai.goal.SwimGoal;
- import net.minecraft.entity.ai.goal.WaterAvoidingRandomWalkingGoal;
- import net.minecraft.entity.monster.MonsterEntity;
- import net.minecraft.entity.player.PlayerEntity;
- import net.minecraft.world.World;
- public class GrassmanEntity extends MonsterEntity {
- public GrassmanEntity(EntityType<? extends MonsterEntity> type, World worldIn)
- {
- super (type, worldIn);
- }
- @Override
- protected void registerGoals()
- {
- this.goalSelector.addGoal(0, new SwimGoal(this));
- this.goalSelector.addGoal(1, new RandomWalkingGoal(this, 0.4d));
- this.goalSelector.addGoal(2, new LookRandomlyGoal(this));
- this.goalSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, true));
- }
- protected void applyEntityAI() {
- this.goalSelector.addGoal(5, new WaterAvoidingRandomWalkingGoal(this, 1.0D));
- this.goalSelector.addGoal(6, new LookAtGoal(this, PlayerEntity.class, 8.0F));
- this.goalSelector.addGoal(6, new LookRandomlyGoal(this));
- this.targetSelector.addGoal(1, new HurtByTargetGoal(this));
- this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, true));
- }
- protected void registerAttributes()
- {
- super.registerAttributes();
- this.getAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(15.0d);
- this.getAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(3.0d);
- this.getAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(35.0d);
- this.getAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(2.0d);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement