Пример #1
0
 protected void setPosition(
     PositionSettings pos, List<HeightInfo> heights, BasicModelData obj, int heightPos) {
   HeightInfo height = heights.get(heightPos);
   obj.setPosition(
       height.getX() + randomizeDouble(-xRatio, xRatio),
       randomizeDouble(pos.getMinY(), pos.getMaxY()),
       height.getZ() + randomizeDouble(-zRatio, zRatio));
   correctPosition(obj, pos, heights);
 }
Пример #2
0
 protected void correctPosition(BasicModelData obj, PositionSettings pos) {
   if (obj.getX() > pos.getMaxX()) {
     obj.setX(pos.getMaxX() - randomizeDouble(0, xRatio));
   }
   if (obj.getX() < pos.getMinX()) {
     obj.setX(pos.getMinX() + randomizeDouble(0, xRatio));
   }
   if (obj.getZ() > pos.getMaxZ()) {
     obj.setZ(pos.getMaxZ() - randomizeDouble(0, zRatio));
   }
   if (obj.getZ() < pos.getMinZ()) {
     obj.setZ(pos.getMinZ() + randomizeDouble(0, zRatio));
   }
 }