Package net.lightstone.util.nbt

Examples of net.lightstone.util.nbt.CompoundTag


    DataInputStream in = region.getChunkDataInputStream(regionX, regionZ);
    Chunk chunk = new Chunk(x, z);

    NBTInputStream nbt = new NBTInputStream(in, false);
    CompoundTag tag = (CompoundTag) nbt.readTag();
    Map<String, Tag> levelTags = ((CompoundTag) tag.getValue().get("Level")).getValue();

    byte[] tileData = ((ByteArrayTag) levelTags.get("Blocks")).getValue();
    chunk.setTypes(tileData);

    byte[] skyLightData = ((ByteArrayTag) levelTags.get("SkyLight")).getValue();
View Full Code Here


   * Writes a chunk to a McRegion file.
   * WARNING! The files written by this method probably won't load in the Notchian server. Make backups.
   */
  @Override
  public void write(int x, int z, Chunk chunk) throws IOException {
    CompoundTag levelTag = chunkToTag(chunk);
    RegionFile region = cache.getRegionFile(dir, x, z);
    int regionX = x & (REGION_SIZE - 1);
    int regionZ = z & (REGION_SIZE - 1);

    DataOutputStream out = region.getChunkDataOutputStream(regionX, regionZ);
    try {
      NBTOutputStream nbtOut = new NBTOutputStream(out, false);

      Map<String, Tag> tagMap = new HashMap<String, Tag>(1);
      tagMap.put("Level", levelTag);

      CompoundTag tag = new CompoundTag("", tagMap);
      nbtOut.writeTag(tag);
    } finally {
      out.close();
    }

View Full Code Here

    levelTags.put("xPos", new IntTag("xPos", chunk.getX()));
    levelTags.put("zPos", new IntTag("zPos", chunk.getZ()));
    // TODO: terrainpopulated
    levelTags.put("TerrainPopulated", new ByteTag("TerrainPopulated", (byte) 0));
    return new CompoundTag("Level", levelTags);
  }
View Full Code Here

TOP

Related Classes of net.lightstone.util.nbt.CompoundTag

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.