Пример #1
0
 private static <T extends Enum> Set<T> toEnumSet(int[] arr, T[] values) {
   Set<T> list = new HashSet<T>();
   for (int a : arr) {
     list.add(values[a]);
   }
   return list;
 }
Пример #2
0
  private void setupBiomeMapping() {
    biomeMapping.clear();
    if (controllerType == ControllerType.CONTROLLER_FILTERED) {
      BiomeGenBase[] biomeGenArray = BiomeGenBase.getBiomeGenArray();
      final Set<Integer> ids = new HashSet<Integer>();
      for (BiomeGenBase biome : biomes) {
        if (biome != null) {
          ids.add(biome.biomeID);
        } else {
          ids.add(BiomeGenBase.plains.biomeID);
        }
      }

      ControllerType.BiomeFilter biomeFilter =
          new ControllerType.BiomeFilter() {
            @Override
            public boolean match(BiomeGenBase biome) {
              return ids.contains(biome.biomeID);
            }

            @Override
            public double calculateBiomeDistance(BiomeGenBase a, BiomeGenBase b) {
              return calculateBiomeDistance(a, b, false, false, false);
            }
          };
      BiomeControllerMapping.makeFilteredBiomeMap(biomeGenArray, biomeMapping, biomeFilter);
    }
  }
Пример #3
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;
  }
Пример #4
0
  public void dump(EntityPlayer player) {
    String digits = getDigitString();
    if (!digits.isEmpty()) {
      logDebug(player, "    Digits: " + digits);
    }
    if (forcedDimensionSeed != 0) {
      logDebug(player, "    Forced seed: " + forcedDimensionSeed);
    }
    if (baseSeed != 0) {
      logDebug(player, "    Base seed: " + baseSeed);
    }
    logDebug(player, "    World version: " + worldVersion);
    TerrainType terrainType = getTerrainType();
    logDebug(player, "    Terrain: " + terrainType.toString());
    logDebug(
        player,
        "        Base block: "
            + new ItemStack(baseBlockForTerrain.getBlock(), 1, baseBlockForTerrain.getMeta())
                .getDisplayName());
    if (featureTypes.contains(FeatureType.FEATURE_TENDRILS)) {
      logDebug(
          player,
          "        Tendril block: "
              + new ItemStack(tendrilBlock.getBlock(), 1, tendrilBlock.getMeta()).getDisplayName());
    }
    if (featureTypes.contains(FeatureType.FEATURE_PYRAMIDS)) {
      for (BlockMeta block : pyramidBlocks) {
        if (block != null) {
          logDebug(
              player,
              "        Pyramid blocks: "
                  + new ItemStack(block.getBlock(), 1, block.getMeta()).getDisplayName());
        }
      }
    }
    if (featureTypes.contains(FeatureType.FEATURE_ORBS)) {
      for (BlockMeta block : sphereBlocks) {
        if (block != null) {
          logDebug(
              player,
              "        Orb blocks: "
                  + new ItemStack(block.getBlock(), 1, block.getMeta()).getDisplayName());
        }
      }
    }
    if (featureTypes.contains(FeatureType.FEATURE_HUGEORBS)) {
      for (BlockMeta block : hugeSphereBlocks) {
        if (block != null) {
          logDebug(
              player,
              "        Huge Orb blocks: "
                  + new ItemStack(block.getBlock(), 1, block.getMeta()).getDisplayName());
        }
      }
    }
    if (featureTypes.contains(FeatureType.FEATURE_LIQUIDORBS)) {
      for (BlockMeta block : liquidSphereBlocks) {
        if (block != null) {
          logDebug(
              player,
              "        Liquid Orb blocks: "
                  + new ItemStack(block.getBlock(), 1, block.getMeta()).getDisplayName());
        }
      }
    }
    if (featureTypes.contains(FeatureType.FEATURE_HUGELIQUIDORBS)) {
      for (BlockMeta block : hugeLiquidSphereBlocks) {
        if (block != null) {
          logDebug(
              player,
              "        Huge Liquid Orb blocks: "
                  + new ItemStack(block.getBlock(), 1, block.getMeta()).getDisplayName());
        }
      }
    }
    if (featureTypes.contains(FeatureType.FEATURE_CANYONS)) {
      logDebug(
          player,
          "        Canyon block: "
              + new ItemStack(canyonBlock.getBlock(), 1, canyonBlock.getMeta()).getDisplayName());
    }
    logDebug(player, "        Base fluid: " + new ItemStack(fluidForTerrain).getDisplayName());
    logDebug(
        player,
        "    Biome controller: " + (controllerType == null ? "<null>" : controllerType.name()));
    for (BiomeGenBase biome : getBiomes()) {
      if (biome != null) {
        logDebug(player, "    Biome: " + biome.biomeName);
      }
    }
    for (FeatureType featureType : getFeatureTypes()) {
      logDebug(player, "    Feature: " + featureType.toString());
    }
    for (BlockMeta block : extraOregen) {
      if (block != null) {
        logDebug(
            player,
            "        Extra ore: "
                + new ItemStack(block.getBlock(), 1, block.getMeta()).getDisplayName());
      }
    }
    for (Block block : fluidsForLakes) {
      logDebug(player, "        Lake fluid: " + new ItemStack(block).getDisplayName());
    }
    if (featureTypes.contains(FeatureType.FEATURE_LIQUIDORBS)) {
      for (Block fluid : liquidSphereFluids) {
        logDebug(player, "        Liquid orb fluids: " + new ItemStack(fluid).getDisplayName());
      }
    }
    if (featureTypes.contains(FeatureType.FEATURE_HUGELIQUIDORBS)) {
      for (Block fluid : hugeLiquidSphereFluids) {
        logDebug(
            player, "        Huge Liquid orb fluids: " + new ItemStack(fluid).getDisplayName());
      }
    }
    for (StructureType structureType : getStructureTypes()) {
      logDebug(player, "    Structure: " + structureType.toString());
    }
    if (structureTypes.contains(StructureType.STRUCTURE_RECURRENTCOMPLEX)) {
      for (String type : dimensionTypes) {
        logDebug(player, "    RR DimensionType: " + type);
      }
    }
    for (EffectType effectType : getEffectTypes()) {
      logDebug(player, "    Effect: " + effectType.toString());
    }
    logDebug(player, "    Sun brightness: " + skyDescriptor.getSunBrightnessFactor());
    logDebug(player, "    Star brightness: " + skyDescriptor.getStarBrightnessFactor());
    float r = skyDescriptor.getSkyColorFactorR();
    float g = skyDescriptor.getSkyColorFactorG();
    float b = skyDescriptor.getSkyColorFactorB();
    logDebug(player, "    Sky color: " + r + ", " + g + ", " + b);
    r = skyDescriptor.getFogColorFactorR();
    g = skyDescriptor.getFogColorFactorG();
    b = skyDescriptor.getFogColorFactorB();
    logDebug(player, "    Fog color: " + r + ", " + g + ", " + b);
    SkyType skyType = skyDescriptor.getSkyType();
    if (skyType != SkyType.SKY_NORMAL) {
      logDebug(player, "    Sky type: " + skyType.toString());
    }
    for (CelestialBodyType bodyType : skyDescriptor.getCelestialBodies()) {
      logDebug(player, "    Sky body: " + bodyType.name());
    }

    if (weatherDescriptor.getRainStrength() > -0.5f) {
      logDebug(player, "    Weather rain: " + weatherDescriptor.getRainStrength());
    }
    if (weatherDescriptor.getThunderStrength() > -0.5f) {
      logDebug(player, "    Weather thunder " + weatherDescriptor.getThunderStrength());
    }

    for (MobDescriptor mob : extraMobs) {
      if (mob != null) {
        if (mob.getEntityClass() == null) {
          logDebug(player, "    Mob: " + mob);
        } else {
          logDebug(player, "    Mob: " + mob.getEntityClass().getName());
        }
      }
    }
    if (peaceful) {
      logDebug(player, "    Peaceful mode");
    }
    if (noanimals) {
      logDebug(player, "    No animals mode");
    }
    if (shelter) {
      logDebug(player, "    Safe shelter");
    }
    if (respawnHere) {
      logDebug(player, "    Respawn local");
    }
    if (celestialAngle != null) {
      logDebug(player, "    Celestial angle: " + celestialAngle);
    }
    if (timeSpeed != null) {
      logDebug(player, "    Time speed: " + timeSpeed);
    }
    if (probeCounter > 0) {
      logDebug(player, "    Probes: " + probeCounter);
    }
    if (patreon1 != 0) {
      logDebug(player, "    Patreon: " + patreon1);
    }
  }
Пример #5
0
 public boolean hasEffectType(EffectType type) {
   return effectTypes.contains(type);
 }
Пример #6
0
 public boolean hasStructureType(StructureType type) {
   return structureTypes.contains(type);
 }
Пример #7
0
 public boolean hasFeatureType(FeatureType type) {
   return featureTypes.contains(type);
 }