Example #1
0
  public void readFromNBT(NBTTagCompound tagCompound) {
    this.name = tagCompound.getString("name");
    setSpawnPoint(Coordinate.readFromNBT(tagCompound, "spawnPoint"));
    setProbeCounter(tagCompound.getInteger("probeCounter"));
    setupFromNBT(tagCompound);

    setupBiomeMapping();
  }
Example #2
0
  public DimensionInformation(String name, DimensionDescriptor descriptor, World world) {
    this.name = name;
    this.descriptor = descriptor;

    this.forcedDimensionSeed = descriptor.getForcedSeed();
    if (DimletConfiguration.randomizeSeed) {
      baseSeed = (long) (Math.random() * 10000 + 1);
    } else {
      baseSeed = world.getSeed();
    }

    worldVersion = VERSION_CORRECTSEED;

    setupFromDescriptor(world.getSeed());
    setupBiomeMapping();

    dump(null);
  }
Example #3
0
  public DimensionInformation(DimensionDescriptor descriptor, NBTTagCompound tagCompound) {
    this.name = tagCompound.getString("name");
    this.descriptor = descriptor;

    setSpawnPoint(Coordinate.readFromNBT(tagCompound, "spawnPoint"));
    setProbeCounter(tagCompound.getInteger("probeCounter"));

    int version = tagCompound.getInteger("version");
    if (version == 1) {
      // This version of the dimension information has the random information persisted.
      setupFromNBT(tagCompound);
    } else {
      // This is an older version. Here we have to calculate the random information again.
      setupFromDescriptor(1);
    }

    setupBiomeMapping();
  }
Example #4
0
  public DimensionInformation(String name, DimensionDescriptor descriptor, ByteBuf buf) {
    this.name = name;
    this.descriptor = descriptor;

    terrainType = NetworkTools.readEnum(buf, TerrainType.values());
    NetworkTools.readEnumCollection(buf, featureTypes, FeatureType.values());
    NetworkTools.readEnumCollection(buf, structureTypes, StructureType.values());
    NetworkTools.readEnumCollection(buf, effectTypes, EffectType.values());

    biomes.clear();
    int size = buf.readInt();
    for (int i = 0; i < size; i++) {
      BiomeGenBase biome = BiomeGenBase.getBiome(buf.readInt());
      if (biome != null) {
        biomes.add(biome);
      } else {
        biomes.add(BiomeGenBase.plains);
      }
    }
    controllerType = NetworkTools.readEnum(buf, ControllerType.values());
    digitString = NetworkTools.readString(buf);

    forcedDimensionSeed = buf.readLong();
    baseSeed = buf.readLong();
    worldVersion = buf.readInt();

    Block block = (Block) Block.blockRegistry.getObjectById(buf.readInt());
    int meta = buf.readInt();
    baseBlockForTerrain = new BlockMeta(block, meta);
    block = (Block) Block.blockRegistry.getObjectById(buf.readInt());
    meta = buf.readInt();
    tendrilBlock = new BlockMeta(block, meta);

    pyramidBlocks = readBlockArrayFromBuf(buf);
    sphereBlocks = readBlockArrayFromBuf(buf);
    hugeSphereBlocks = readBlockArrayFromBuf(buf);
    liquidSphereBlocks = readBlockArrayFromBuf(buf);
    liquidSphereFluids = readFluidArrayFromBuf(buf);
    hugeLiquidSphereBlocks = readBlockArrayFromBuf(buf);
    hugeLiquidSphereFluids = readFluidArrayFromBuf(buf);

    block = (Block) Block.blockRegistry.getObjectById(buf.readInt());
    meta = buf.readInt();
    canyonBlock = new BlockMeta(block, meta);
    fluidForTerrain = (Block) Block.blockRegistry.getObjectById(buf.readInt());

    extraOregen = readBlockArrayFromBuf(buf);

    fluidsForLakes = readFluidArrayFromBuf(buf);

    peaceful = buf.readBoolean();
    noanimals = buf.readBoolean();
    shelter = buf.readBoolean();
    respawnHere = buf.readBoolean();

    celestialAngle = NetworkTools.readFloat(buf);
    timeSpeed = NetworkTools.readFloat(buf);

    probeCounter = buf.readInt();
    actualRfCost = buf.readInt();

    skyDescriptor = new SkyDescriptor.Builder().fromBytes(buf).build();
    calculateCelestialBodyDescriptors();

    weatherDescriptor = new WeatherDescriptor.Builder().fromBytes(buf).build();

    patreon1 = buf.readLong();

    extraMobs.clear();
    size = buf.readInt();
    for (int i = 0; i < size; i++) {
      String className = NetworkTools.readString(buf);
      try {
        Class<? extends EntityLiving> c = (Class<? extends EntityLiving>) Class.forName(className);
        int chance = buf.readInt();
        int minGroup = buf.readInt();
        int maxGroup = buf.readInt();
        int maxLoaded = buf.readInt();
        MobDescriptor mob = new MobDescriptor(null, c, chance, minGroup, maxGroup, maxLoaded);
        extraMobs.add(mob);
      } catch (ClassNotFoundException e) {
        e.printStackTrace();
      }
    }

    size = buf.readInt();
    dimensionTypes = new String[size];
    for (int i = 0; i < size; i++) {
      dimensionTypes[i] = NetworkTools.readString(buf);
    }

    setupBiomeMapping();
  }
Example #5
0
 public Map<Integer, Integer> getBiomeMapping() {
   if (biomeMapping.isEmpty()) {
     setupBiomeMapping();
   }
   return biomeMapping;
 }