示例#1
0
  public Block getFeatureLiquid(
      Random random,
      Map<FeatureType, List<DimletKey>> modifiersForFeature,
      FeatureType featureType) {
    Block block;
    if (featureTypes.contains(featureType)) {
      List<BlockMeta> blocks = new ArrayList<BlockMeta>();
      List<Block> fluids = new ArrayList<Block>();
      getMaterialAndFluidModifiers(modifiersForFeature.get(featureType), blocks, fluids);

      if (!fluids.isEmpty()) {
        block = fluids.get(random.nextInt(fluids.size()));
        if (block == null) {
          block = Blocks.water; // This is the default in case None was specified.
        }
      } else {
        // Nothing was specified. With a relatively big chance we use stone. But there is also a
        // chance that the material will be something else.
        if (random.nextFloat() < DimletConfiguration.randomOrbFluidChance) {
          DimletKey key = DimletRandomizer.getRandomFluidBlock(random, true);
          actualRfCost += calculateCostFactor(key);
          block = DimletObjectMapping.idToFluid.get(key);
        } else {
          block = Blocks.water;
        }
      }
    } else {
      block = Blocks.water;
    }
    return block;
  }