| 1 | package net.minecraft.entity.ai;
|
| 2 |
|
| 3 | public abstract class EntityAIBase
|
| 4 | {
|
| 5 | /**
|
| 6 | * A bitmask telling which other tasks may not run concurrently. The test is a simple bitwise AND - if it yields
|
| 7 | * zero, the two tasks may run concurrently, if not - they must run exclusively from each other.
|
| 8 | */
|
| 9 | private int mutexBits;
|
| 10 |
|
| 11 | /**
|
| 12 | * Returns whether the EntityAIBase should begin execution.
|
| 13 | */
|
| 14 | public abstract boolean shouldExecute();
|
| 15 |
|
| 16 | /**
|
| 17 | * Returns whether an in-progress EntityAIBase should continue executing
|
| 18 | */
|
| 19 | public boolean continueExecuting()
|
| 20 | {
|
| 21 | return this.shouldExecute();
|
| 22 | }
|
| 23 |
|
| 24 | /**
|
| 25 | * Determine if this AI Task is interruptible by a higher (= lower value) priority task. All vanilla AITask have
|
| 26 | * this value set to true.
|
| 27 | */
|
| 28 | public boolean isInterruptible()
|
| 29 | {
|
| 30 | return true;
|
| 31 | }
|
| 32 |
|
| 33 | /**
|
| 34 | * Execute a one shot task or start executing a continuous task
|
| 35 | */
|
| 36 | public void startExecuting()
|
| 37 | {
|
| 38 | }
|
| 39 |
|
| 40 | /**
|
| 41 | * Resets the task
|
| 42 | */
|
| 43 | public void resetTask()
|
| 44 | {
|
| 45 | }
|
| 46 |
|
| 47 | /**
|
| 48 | * Updates the task
|
| 49 | */
|
| 50 | public void updateTask()
|
| 51 | {
|
| 52 | }
|
| 53 |
|
| 54 | /**
|
| 55 | * Sets a bitmask telling which other tasks may not run concurrently. The test is a simple bitwise AND - if it
|
| 56 | * yields zero, the two tasks may run concurrently, if not - they must run exclusively from each other.
|
| 57 | */
|
| 58 | public void setMutexBits(int mutexBitsIn)
|
| 59 | {
|
| 60 | this.mutexBits = mutexBitsIn;
|
| 61 | }
|
| 62 |
|
| 63 | /**
|
| 64 | * Get a bitmask telling which other tasks may not run concurrently. The test is a simple bitwise AND - if it yields
|
| 65 | * zero, the two tasks may run concurrently, if not - they must run exclusively from each other.
|
| 66 | */
|
| 67 | public int getMutexBits()
|
| 68 | {
|
| 69 | return this.mutexBits;
|
| 70 | }
|
| 71 | }
|
| 72 |
|