2018-09-13 12:03:28 -04:00
|
|
|
package noppes.npcs.ai;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.entity.ai.EntityAIBase;
|
|
|
|
|
import noppes.npcs.entity.EntityNPCInterface;
|
|
|
|
|
|
2025-03-13 17:14:45 -04:00
|
|
|
public class EntityAIWaterNav extends EntityAIBase {
|
2018-09-13 12:03:28 -04:00
|
|
|
private EntityNPCInterface theEntity;
|
|
|
|
|
|
2025-03-13 17:14:45 -04:00
|
|
|
public EntityAIWaterNav(EntityNPCInterface par1EntityNPCInterface) {
|
2018-09-13 12:03:28 -04:00
|
|
|
this.theEntity = par1EntityNPCInterface;
|
|
|
|
|
par1EntityNPCInterface.getNavigator().setCanSwim(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns whether the EntityAIBase should begin execution.
|
|
|
|
|
*/
|
2025-03-13 17:14:45 -04:00
|
|
|
public boolean shouldExecute() {
|
|
|
|
|
if (this.theEntity.isInWater() || this.theEntity.handleLavaMovement()) {
|
|
|
|
|
if (this.theEntity.ais.canSwim) {
|
|
|
|
|
return true;
|
|
|
|
|
} else if (this.theEntity.isCollidedHorizontally) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2025-02-10 21:32:55 -05:00
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Updates the task
|
|
|
|
|
*/
|
2025-03-13 17:14:45 -04:00
|
|
|
public void updateTask() {
|
|
|
|
|
if (this.theEntity.getRNG().nextFloat() < 0.8F) {
|
2018-09-13 12:03:28 -04:00
|
|
|
this.theEntity.getJumpHelper().setJumping();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|