Guest User

Untitled

a guest
Jan 8th, 2022
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.28 KB | None | 0 0
  1. package com.solegendary.ageofcraft.units;
  2.  
  3. import com.solegendary.ageofcraft.units.goals.MoveToCursorBlockGoal;
  4. import net.minecraft.world.entity.EntityType;
  5. import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
  6. import net.minecraft.world.entity.ai.attributes.Attributes;
  7. import net.minecraft.world.entity.ai.goal.FloatGoal;
  8. import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
  9. import net.minecraft.world.entity.ai.goal.RandomStrollGoal;
  10. import net.minecraft.world.entity.player.Player;
  11. import net.minecraft.world.level.Level;
  12.  
  13. public class VillagerUnit extends Unit {
  14.  
  15.     public VillagerUnit(EntityType<? extends Unit> p_33002_, Level p_33003_) {
  16.         super(p_33002_, p_33003_);
  17.     }
  18.  
  19.     protected void registerGoals() {
  20.         this.goalSelector.addGoal(1, new FloatGoal(this));
  21.         this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 8.0F));
  22.         this.goalSelector.addGoal(3, new RandomStrollGoal(this, 1.0F));
  23.         //this.goalSelector.addGoal(3, new MoveToCursorBlockGoal(this));
  24.     }
  25.  
  26.     public static AttributeSupplier.Builder createAttributes() {
  27.         return Unit.createUnitAttributes()
  28.                 .add(Attributes.MAX_HEALTH, 10.0D)
  29.                 .add(Attributes.MOVEMENT_SPEED, (double)0.25F);
  30.     }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment