initial commit

This commit is contained in:
Sen 2025-03-11 00:23:54 +01:00 committed by Sen
parent 3c9ee26b06
commit 22186c33b9
1458 changed files with 282792 additions and 0 deletions

View file

@ -0,0 +1,58 @@
package game.ai;
import game.entity.types.EntityLiving;
public class EntityAIOpenDoor extends EntityAIDoorInteract
{
/** If the entity close the door */
boolean closeDoor;
/**
* The temporisation before the entity close the door (in ticks, always 20 = 1 second)
*/
int closeDoorTemporisation;
public EntityAIOpenDoor(EntityLiving entitylivingIn, boolean shouldClose)
{
super(entitylivingIn);
this.theEntity = entitylivingIn;
this.closeDoor = shouldClose;
}
/**
* Returns whether an in-progress EntityAIBase should continue executing
*/
public boolean continueExecuting()
{
return this.closeDoor && this.closeDoorTemporisation > 0 && super.continueExecuting();
}
/**
* Execute a one shot task or start executing a continuous task
*/
public void startExecuting()
{
this.closeDoorTemporisation = 20;
this.doorBlock.toggleDoor(this.theEntity.worldObj, this.doorPosition, true);
}
/**
* Resets the task
*/
public void resetTask()
{
if (this.closeDoor)
{
this.doorBlock.toggleDoor(this.theEntity.worldObj, this.doorPosition, false);
}
}
/**
* Updates the task
*/
public void updateTask()
{
--this.closeDoorTemporisation;
super.updateTask();
}
}