Package net.lightstone.io.region

Examples of net.lightstone.io.region.RegionFile


    this.dir = dir;
  }

  @Override
  public Chunk read(int x, int z) throws IOException {
    RegionFile region = cache.getRegionFile(dir, x, z);
    int regionX = x & (REGION_SIZE - 1);
    int regionZ = z & (REGION_SIZE - 1);
    if (!region.hasChunk(regionX, regionZ)) {
      return null;
    }

    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();
View Full Code Here


   * 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);
View Full Code Here

TOP

Related Classes of net.lightstone.io.region.RegionFile

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.