use of net.minecraft.pathfinding.PathNavigateGround in project NetherEx by LogicTechCorp.
the class EntityAIFenceGateInteract method shouldExecute.
@Override
public boolean shouldExecute() {
if (!theEntity.isCollidedHorizontally) {
return false;
} else {
PathNavigateGround pathnavigateground = (PathNavigateGround) theEntity.getNavigator();
Path path = pathnavigateground.getPath();
if (path != null && !path.isFinished() && pathnavigateground.getEnterDoors()) {
for (int i = 0; i < Math.min(path.getCurrentPathIndex() + 2, path.getCurrentPathLength()); ++i) {
PathPoint pathpoint = path.getPathPointFromIndex(i);
fenceGatePos = new BlockPos(pathpoint.xCoord, pathpoint.yCoord, pathpoint.zCoord);
if (theEntity.getDistanceSq((double) fenceGatePos.getX(), theEntity.posY, (double) fenceGatePos.getZ()) <= 2.25D) {
fenceGate = getFenceGate(fenceGatePos);
if (fenceGate != null) {
return true;
}
}
}
fenceGatePos = (new BlockPos(theEntity));
fenceGate = getFenceGate(fenceGatePos);
return fenceGate != null;
} else {
return false;
}
}
}
use of net.minecraft.pathfinding.PathNavigateGround in project minecolonies by Minecolonies.
the class EntityAIGateInteract method checkPath.
/**
* Checks if there exists a path.
*
* @return true if the fence gate can be passed.
*/
private boolean checkPath() {
@NotNull final PathNavigateGround pathnavigateground = (PathNavigateGround) this.theEntity.getNavigator();
final Path path = pathnavigateground.getPath();
return path != null && !path.isFinished() && pathnavigateground.getEnterDoors() && checkFenceGate(path);
}
Aggregations