001 package net.minecraft.src;
002
003 public class EntityAIOpenDoor extends EntityAIDoorInteract
004 {
005 boolean field_75361_i;
006 int field_75360_j;
007
008 public EntityAIOpenDoor(EntityLiving par1EntityLiving, boolean par2)
009 {
010 super(par1EntityLiving);
011 this.theEntity = par1EntityLiving;
012 this.field_75361_i = par2;
013 }
014
015 /**
016 * Returns whether an in-progress EntityAIBase should continue executing
017 */
018 public boolean continueExecuting()
019 {
020 return this.field_75361_i && this.field_75360_j > 0 && super.continueExecuting();
021 }
022
023 /**
024 * Execute a one shot task or start executing a continuous task
025 */
026 public void startExecuting()
027 {
028 this.field_75360_j = 20;
029 this.targetDoor.onPoweredBlockChange(this.theEntity.worldObj, this.entityPosX, this.entityPosY, this.entityPosZ, true);
030 }
031
032 /**
033 * Resets the task
034 */
035 public void resetTask()
036 {
037 if (this.field_75361_i)
038 {
039 this.targetDoor.onPoweredBlockChange(this.theEntity.worldObj, this.entityPosX, this.entityPosY, this.entityPosZ, false);
040 }
041 }
042
043 /**
044 * Updates the task
045 */
046 public void updateTask()
047 {
048 --this.field_75360_j;
049 super.updateTask();
050 }
051 }