Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.examplemod.custom;
- import com.example.examplemod.entity.TestEntity;
- import net.minecraft.entity.ai.goal.Goal;
- import java.util.EnumSet;
- public class CustomSitGoal extends Goal {
- private final TestEntity tameable;
- public CustomSitGoal(TestEntity entityIn) {
- this.tameable = entityIn;
- this.setMutexFlags(EnumSet.of(Goal.Flag.JUMP, Goal.Flag.MOVE));
- }
- /**
- * Returns whether an in-progress EntityAIBase should continue executing
- */
- public boolean shouldContinueExecuting() {
- return this.tameable.flag;
- }
- /**
- * Returns whether execution should begin. You can also read and cache any state necessary for execution in this
- * method as well.
- */
- public boolean shouldExecute() {
- return this.tameable.flag;
- }
- /**
- * Execute a one shot task or start executing a continuous task
- */
- public void startExecuting() {
- System.out.println("Executed");
- this.tameable.getNavigator().clearPath();
- this.tameable.setSleeping(true);
- }
- /**
- * Reset the task's internal state. Called when this task is interrupted by another one
- */
- public void resetTask() {
- this.tameable.setSleeping(false);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment