Example #1
0
  public void toBytes(ByteBuf buf) {
    NetworkTools.writeEnum(buf, terrainType, TerrainType.TERRAIN_VOID);
    NetworkTools.writeEnumCollection(buf, featureTypes);
    NetworkTools.writeEnumCollection(buf, structureTypes);
    NetworkTools.writeEnumCollection(buf, effectTypes);

    buf.writeInt(biomes.size());
    for (BiomeGenBase entry : biomes) {
      if (entry != null) {
        buf.writeInt(entry.biomeID);
      } else {
        buf.writeInt(BiomeGenBase.plains.biomeID);
      }
    }
    NetworkTools.writeEnum(buf, controllerType, ControllerType.CONTROLLER_DEFAULT);

    NetworkTools.writeString(buf, digitString);
    buf.writeLong(forcedDimensionSeed);
    buf.writeLong(baseSeed);
    buf.writeInt(worldVersion);

    buf.writeInt(Block.blockRegistry.getIDForObject(baseBlockForTerrain.getBlock()));
    buf.writeInt(baseBlockForTerrain.getMeta());
    buf.writeInt(Block.blockRegistry.getIDForObject(tendrilBlock.getBlock()));
    buf.writeInt(tendrilBlock.getMeta());

    writeBlockArrayToBuf(buf, pyramidBlocks);
    writeBlockArrayToBuf(buf, sphereBlocks);
    writeBlockArrayToBuf(buf, hugeSphereBlocks);
    writeBlockArrayToBuf(buf, liquidSphereBlocks);
    writeFluidArrayToBuf(buf, liquidSphereFluids);
    writeBlockArrayToBuf(buf, hugeLiquidSphereBlocks);
    writeFluidArrayToBuf(buf, hugeLiquidSphereFluids);

    buf.writeInt(Block.blockRegistry.getIDForObject(canyonBlock.getBlock()));
    buf.writeInt(canyonBlock.getMeta());
    buf.writeInt(Block.blockRegistry.getIDForObject(fluidForTerrain));

    writeBlockArrayToBuf(buf, extraOregen);

    writeFluidArrayToBuf(buf, fluidsForLakes);

    buf.writeBoolean(peaceful);
    buf.writeBoolean(noanimals);
    buf.writeBoolean(shelter);
    buf.writeBoolean(respawnHere);
    NetworkTools.writeFloat(buf, celestialAngle);
    NetworkTools.writeFloat(buf, timeSpeed);

    buf.writeInt(probeCounter);
    buf.writeInt(actualRfCost);

    skyDescriptor.toBytes(buf);
    weatherDescriptor.toBytes(buf);

    buf.writeLong(patreon1);

    buf.writeInt(extraMobs.size());
    for (MobDescriptor mob : extraMobs) {
      if (mob != null) {
        if (mob.getEntityClass() != null) {
          NetworkTools.writeString(buf, mob.getEntityClass().getName());
          buf.writeInt(mob.getSpawnChance());
          buf.writeInt(mob.getMinGroup());
          buf.writeInt(mob.getMaxGroup());
          buf.writeInt(mob.getMaxLoaded());
        }
      }
    }

    buf.writeInt(dimensionTypes.length);
    for (String type : dimensionTypes) {
      NetworkTools.writeString(buf, type);
    }
  }