コード例 #1
0
  protected ItemStack[] createTreasures(
      Odds odds, Material minTreasure, Material maxTreasure, int maxCount, int maxStack) {
    int minId = minTreasure.getId();
    int maxId = maxTreasure.getId();
    int rangeId = maxId - minId + 1;
    int count = maxCount > 0 ? odds.getRandomInt(maxCount) + 1 : 0;

    // make room
    ItemStack[] items = new ItemStack[count];

    // populate
    for (int i = 0; i < count; i++)
      items[i] = new ItemStack(odds.getRandomInt(rangeId) + minId, odds.getRandomInt(maxStack) + 1);

    // all done
    return items;
  }
コード例 #2
0
ファイル: RoadContext.java プロジェクト: spaceribs/CityWorld
  public PlatLot createRoundaboutStatueLot(
      WorldGenerator generator, PlatMap platmap, int x, int z) {

    // grab potential platlot's random
    Odds odds = platmap.getChunkOddsGenerator(platmap.originX + x, platmap.originZ + z);

    // what way are we facing?
    Direction.Facing facing = odds.getFacing();

    // see if there is a schematic out there that fits
    Clipboard clip = mapsSchematics.getSingleLot(generator, platmap, odds, x, z);
    if (clip != null) {

      // create it then
      return new ClipboardRoundaboutLot(
          platmap, platmap.originX + x, platmap.originZ + z, clip, facing, 0, 0);

    } else return new RoundaboutStatueLot(platmap, platmap.originX + x, platmap.originZ + z);
  }