001 package net.minecraft.entity.ai; 002 003 public abstract class EntityAIBase 004 { 005 /** 006 * A bitmask telling which other tasks may not run concurrently. The test is a simple bitwise AND - if it yields 007 * zero, the two tasks may run concurrently, if not - they must run exclusively from each other. 008 */ 009 private int mutexBits = 0; 010 011 /** 012 * Returns whether the EntityAIBase should begin execution. 013 */ 014 public abstract boolean shouldExecute(); 015 016 /** 017 * Returns whether an in-progress EntityAIBase should continue executing 018 */ 019 public boolean continueExecuting() 020 { 021 return this.shouldExecute(); 022 } 023 024 /** 025 * Returns whether the task requires multiple updates or not 026 */ 027 public boolean isContinuous() 028 { 029 return true; 030 } 031 032 /** 033 * Execute a one shot task or start executing a continuous task 034 */ 035 public void startExecuting() {} 036 037 /** 038 * Resets the task 039 */ 040 public void resetTask() {} 041 042 /** 043 * Updates the task 044 */ 045 public void updateTask() {} 046 047 /** 048 * Sets a bitmask telling which other tasks may not run concurrently. The test is a simple bitwise AND - if it 049 * yields zero, the two tasks may run concurrently, if not - they must run exclusively from each other. 050 */ 051 public void setMutexBits(int par1) 052 { 053 this.mutexBits = par1; 054 } 055 056 /** 057 * Get a bitmask telling which other tasks may not run concurrently. The test is a simple bitwise AND - if it yields 058 * zero, the two tasks may run concurrently, if not - they must run exclusively from each other. 059 */ 060 public int getMutexBits() 061 { 062 return this.mutexBits; 063 } 064 }