public void applyPathSettings(PathNavigateGround navigator) { navigator.setCanSwim(canSwim); navigator.setBreakDoors(canBreakDoors); }
/** * 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); }
@Override public void setEnterDoors(boolean value) { super.setEnterDoors(value); nodeProcessor.setCanEnterDoors(value); }
@Override public void setCanSwim(boolean value) { super.setCanSwim(value); nodeProcessor.setCanSwim(value); }
@Override protected void initEntityAI() { ((PathNavigateGround) getNavigator()).setEnterDoors(true); ((PathNavigateGround) getNavigator()).setBreakDoors(true); tasks.addTask(0, new EntityAISwimming(this)); tasks.addTask(1, new EntityAITalkingTo(this)); tasks.addTask(1, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); tasks.addTask(4, new EntityAIOpenDoor(this, true)); tasks.addTask(6, new EntityAIWander(this, 0.5D)); tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 3.0F, 1.0F)); tasks.addTask(9, new EntityAIWatchClosest(this, EntityNPC.class, 5.0F, 0.02F)); } }
/** * sets or removes EntityAIBreakDoor task */ public void setBreakDoorsAItask(boolean enabled) { ((PathNavigateGround) this.getNavigator()).setBreakDoors(enabled); if (enabled) { this.tasks.addTask(1, this.breakDoor); } else { this.tasks.removeTask(this.breakDoor); } }
} else { PathNavigateGround pathnavigateground = (PathNavigateGround) this.theEntity.getNavigator(); boolean flag = pathnavigateground.getEnterDoors(); pathnavigateground.setBreakDoors(false); this.entityPathNavigate = pathnavigateground.getPathToPos(this.doorInfo.getDoorBlockPos()); pathnavigateground.setBreakDoors(flag); } else { pathnavigateground.setBreakDoors(false); this.entityPathNavigate = this.theEntity.getNavigator().getPathToXYZ(vec3d.x, vec3d.y, vec3d.z); pathnavigateground.setBreakDoors(flag);
@Override public final boolean shouldExecute() { PathNavigateGround pathnavigate = (PathNavigateGround) this.theEntity.getNavigator(); if (!pathnavigate.getEnterDoors() || pathnavigate.noPath()) return false; Path path = pathnavigate.getPath(); if (path == null) { return false; } if (addDoorCloseOnThePath(path)) return true; if (!this.theEntity.collidedHorizontally) return false; BlockPos potentialDoorPos = new BlockPos(MathHelper.floor(this.theEntity.posX), MathHelper.floor(this.theEntity.posY), MathHelper.floor(this.theEntity.posZ)); return findDoor(potentialDoorPos) || findDoor(potentialDoorPos.up()); }
public boolean setPath(@Nullable Path path, double speed, boolean forceFlying) { if (super.setPath(path, speed)) { // String str = "FlyingPathNavigate.setPath:"; // for (int i = 0; i < path.getCurrentPathLength(); i++) { // PathPoint pp = path.getPathPointFromIndex(i); // str += " [" + pp + "]"; // } // Log.info(str); ticksAtLastPos = totalTicksLocal; lastPosCheck = getEntityPosition(); this.forceFlying = forceFlying; return true; } return false; }
text.println("Can swim: " + (pathNavigateGround == null ? "N/A" : pathNavigateGround.getCanSwim())); text.println("Break doors: " + (pathNavigateGround == null ? "N/A" : pathNavigateGround.getEnterDoors())); text.println("No path: " + nav.noPath());
@Override public void clearPath() { if (future != null) { future.cancel(true); future = null; } if (pathResult != null) { pathResult.setStatus(PathResult.Status.CANCELLED); pathResult = null; } destination = null; super.clearPath(); }
@Override protected boolean canNavigate() { return !this.dinosaur.isMovementBlocked() && super.canNavigate(); } }
/** * If null path or reached the end. */ @Override public boolean noPath() { return future == null && super.noPath(); }
public void setAvoidsWater(boolean avoidWater) { PathNavigate pathNavigate = dragon.getNavigator(); if (pathNavigate instanceof PathNavigateGround) { PathNavigateGround pathNavigateGround = (PathNavigateGround) pathNavigate; pathNavigateGround.setCanSwim(!avoidWater); // originally setAvoidsWater() } }
@Override protected void initEntityAI() { ((PathNavigateGround) getNavigator()).setEnterDoors(true); ((PathNavigateGround) getNavigator()).setBreakDoors(true); tasks.addTask(0, new EntityAISwimming(this)); tasks.addTask(1, new EntityAITalkingTo(this)); tasks.addTask(1, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); tasks.addTask(4, new EntityAIOpenDoor(this, true)); pathing = new EntityAIPathing(this); tasks.addTask(5, pathing); tasks.addTask(6, new EntityAISchedule(this)); tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 3.0F, 1.0F)); tasks.addTask(9, new EntityAIWatchClosest(this, EntityNPC.class, 5.0F, 0.02F)); }
/** * sets or removes EntityAIBreakDoor task */ public void setBreakDoorsAItask(boolean enabled) { ((PathNavigateGround) this.getNavigator()).setBreakDoors(enabled); if (enabled) { this.tasks.addTask(1, this.aiBreakDoor); } else { this.tasks.removeTask(this.aiBreakDoor); } }
@Override public boolean setPath(Path path, double speed) { if (hasMount()) { ((EntityLiving) entity.getRidingEntity()).getNavigator().setPath(path, speed); } return super.setPath(path, speed); }
@Override public void clearPath() { if (hasMount()) { ((EntityLiving) entity.getRidingEntity()).getNavigator().clearPath(); } super.clearPath(); }
@Override protected boolean canNavigate() { return super.canNavigate() || hasMount(); }
public EntityAISwim(EntityLiving entitylivingIn) { theEntity = entitylivingIn; setMutexBits(4); ((PathNavigateGround) entitylivingIn.getNavigator()).setCanSwim(true); }