Examples of RegionFile


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

Examples of net.lightstone.io.region.RegionFile

   * 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

Examples of net.minecraft.world.chunk.storage.RegionFile

    if (closed) {
      throw new IllegalStateException("RegionFileCache already closed - this means that for some reason ThreadedIOBase was still saving chunks in a world after unloading it.");
    }

    long hash = hash(x, z);
    RegionFile regionFile = regionFileMap.get(hash);
    if (!closing && regionFile != null) {
      return regionFile;
    }
    synchronized (this) {
      regionFile = regionFileMap.get(hash);
View Full Code Here

Examples of net.minecraft.world.chunk.storage.RegionFile

import java.util.logging.*;

class RegionFileFixer {
  public static RegionFile newRegionFile(File regionFileFile) {
    try {
      return new RegionFile(regionFileFile);
    } catch (ArrayIndexOutOfBoundsException e) {
      return fixNegativeOffset(regionFileFile);
    } catch (Throwable t) {
      FMLLog.log(Level.SEVERE, t, "Error opening region file: " + regionFileFile);
      throw UnsafeUtil.throwIgnoreChecked(t);
View Full Code Here

Examples of net.minecraft.world.chunk.storage.RegionFile

      }
    } catch (Throwable t) {
      FMLLog.log(Level.SEVERE, t, "Failed to fix negative offset index in " + regionFileFile);
      throw UnsafeUtil.throwIgnoreChecked(t);
    }
    return new RegionFile(regionFileFile);
  }
View Full Code Here

Examples of net.minecraft.world.level.chunk.storage.RegionFile

        if(debug && info.getFile().exists())
            log("LOAD_REGION " + info.getRegionCoordinate().x + " " + info.getRegionCoordinate().z);
        else if(debug && !info.getFile().exists())
            log("NEW_REGION " + info.getRegionCoordinate().x + " " + info.getRegionCoordinate().z);
       
        info.setCached(new RegionFile(info.getFile()));
    }
View Full Code Here

Examples of net.minecraft.world.level.chunk.storage.RegionFile

        dos.close();
    }

    protected DataInputStream getDataInputStream(int x, int z) throws IOException
    {
        RegionFile region = regionManager.getRegionFile(x >> 5, z >> 5);

        if(region == null)
            return null;

        return region.getChunkDataInputStream(x & 0x1F, z & 0x1F);
    }
View Full Code Here

Examples of net.minecraft.world.level.chunk.storage.RegionFile

        return region.getChunkDataInputStream(x & 0x1F, z & 0x1F);
    }

    protected DataOutputStream getDataOutputStream(int x, int z) throws IOException
    {
        RegionFile region = regionManager.getRegionFile(x >> 5, z >> 5);

        if(region == null)
        {
            region = createRegionFile(x >> 5, z >> 5);
            if(region == null)
                throw new IOException();
        }

        return region.getChunkDataOutputStream(x & 0x1F, z & 0x1F);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.