protected Vec3d getWanderPosition() { return RandomPositionGenerator.getLandPos(this.entity, 10, 10); }
/** * Find a good place within the restaurant to eat. * @return the next state to go to. */ private STATE findPlaceToEat() { if (placeToPath == null) { final Vec3d placeToEat = RandomPositionGenerator.getLandPos(citizen, PLACE_TO_EAT_DISTANCE, 0); if (placeToEat == null) { waitingTicks = 0; return EAT; } placeToPath = new BlockPos(placeToEat); } if (citizen.isWorkerAtSiteWithMove(placeToPath, MIN_DISTANCE_TO_RESTAURANT)) { waitingTicks = 0; return EAT; } return FIND_PLACE_TO_EAT; }
@Override protected Vec3d getWanderPosition() { Vec3d vec3d = null; for(int i = 0; i < 100; i++) { Vec3d vec = RandomPositionGenerator.getLandPos(this.entity, 32, 7); if(vec == null) { continue; } else if(vec3d == null || this.entity.getPositionVector().distanceTo(vec) < this.entity.getPositionVector().distanceTo(vec3d)) { vec3d = vec; } } return vec3d == null ? super.getWanderPosition() : vec3d; }
/** * {@inheritDoc} * Returns whether the EntityAIBase should begin execution. * True when age less than 100, when a random (120) is chosen correctly, and when a citizen is nearby. */ @Override public boolean shouldExecute() { if (isTooOld() || checkForRandom() || citizen.getDesiredActivity() == DesiredActivity.SLEEP) { return false; } Vec3d vec3d = null; if(vec3d == null) { vec3d = RandomPositionGenerator.getLandPos(citizen, 10, 7); if (vec3d == null) { return false; } } vec3d = new Vec3d(vec3d.x, BlockPosUtil.getValidHeight(vec3d, CompatibilityUtils.getWorld(citizen)), vec3d.z); this.xPosition = vec3d.x; this.yPosition = vec3d.y; this.zPosition = vec3d.z; return true; }
vec3d = RandomPositionGenerator.getLandPos(citizen, 10, 10); if (vec3d != null)