public Path getPathToEntityLiving(EntityAnimal entityIn, EntityCyclops cyclops) { PathNavigate navi = entityIn.getNavigator(); Vec3d vec3d = RandomPositionGenerator.findRandomTargetBlockTowards(entityIn, 2, 7, new Vec3d(cyclops.posX, cyclops.posY, cyclops.posZ)); if(vec3d != null){ BlockPos blockpos = new BlockPos(vec3d); return navi.getPathToPos(blockpos); } return null; } }
@Nullable private Path getPathToTarget(EntityAgeable npc) { Path path = npc.getNavigator().getPathToPos(pos); if (path != null) return path; else { //Grab a random block towards the target Vec3d vec = RandomPositionGenerator.findRandomTargetBlockTowards(npc, 10, 7, new Vec3d((double) pos.getX() + 0.5D, (double) pos.getY() + 1D, (double) pos.getZ() + 0.5D)); if (vec != null) { return npc.getNavigator().getPathToPos(new BlockPos(vec)); } else return null; } }
@Nullable private Path getPathToTarget() { Path path = npc.getNavigator().getPathToPos(blockTarget); if (path != null) return path; else { //Grab a random block towards the target Vec3d vec = RandomPositionGenerator.findRandomTargetBlockTowards(npc, 16, 7, new Vec3d((double) blockTarget.getX() + 0.5D, (double) blockTarget.getY(), (double) blockTarget.getZ() + 0.5D)); if (vec != null) { return npc.getNavigator().getPathToPos(new BlockPos(vec)); } else return null; } }
/** * Execute a one shot task or start executing a continuous task */ public void startExecuting() { this.insidePosX = -1; BlockPos blockpos = this.doorInfo.getInsideBlockPos(); int i = blockpos.getX(); int j = blockpos.getY(); int k = blockpos.getZ(); if (this.entityObj.getDistanceSq(blockpos) > 256.0D) { Vec3d vec3d = RandomPositionGenerator.findRandomTargetBlockTowards(this.entityObj, 14, 3, new Vec3d((double) i + 0.5D, (double) j, (double) k + 0.5D)); if (vec3d != null) { this.entityObj.getNavigator().tryMoveToXYZ(vec3d.x, vec3d.y, vec3d.z, 1.0D); } } else { this.entityObj.getNavigator().tryMoveToXYZ((double) i + 0.5D, (double) j, (double) k + 0.5D, 1.0D); } } }
private void attemptToTeleportToSafety(BlockPos go) { Vec3d vec = RandomPositionGenerator.findRandomTargetBlockTowards(npc, 3, 32, new Vec3d((double) go.getX() + 0.5D, (double) go.getY() + 1D, (double) go.getZ() + 0.5D)); if (vec != null) { BlockPos pos = new BlockPos(vec); if (EntityHelper.isSpawnable(npc.world, pos) && EntityHelper.isSpawnable(npc.world, pos.up()) && npc.world.getBlockState(pos.down()).isSideSolid(npc.world, pos.down(), EnumFacing.UP)) { npc.setPositionAndUpdate(pos.getX() + 0.5D, pos.getY() + 1D, pos.getZ() + 0.5D); } } }
Vec3d vec3d = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 10, 7, new Vec3d((double) this.doorInfo.getDoorBlockPos().getX(), (double) this.doorInfo.getDoorBlockPos().getY(), (double) this.doorInfo.getDoorBlockPos().getZ()));
} else { if (!pathableMob.getEntity().getNavigator().tryMoveToXYZ(pathableMob.getCurrentTarget().x, pathableMob.getCurrentTarget().y, pathableMob.getCurrentTarget().z, this.movementSpeed)) { Vec3d vec3 = RandomPositionGenerator.findRandomTargetBlockTowards(pathableMob.getEntity(), 8, 2, pathableMob.getCurrentTarget());
Vec3d vec = RandomPositionGenerator.findRandomTargetBlockTowards(npc, 32, 5, new Vec3d((double) go.getX() + 0.5D, (double) go.getY() + 1D, (double) go.getZ() + 0.5D)); if (vec != null) { path = npc.getNavigator().getPathToPos(new BlockPos(vec)); stuckTimer = 0; } else { Vec3d vec = RandomPositionGenerator.findRandomTargetBlockTowards(npc, 1, 1, new Vec3d((double) go.getX() + 0.5D, (double) go.getY() + 1D, (double) go.getZ() + 0.5D)); if (vec != null) { npc.getNavigator().setPath(npc.getNavigator().getPathToPos(new BlockPos(vec)), 0.85F);