Ejemplo n.º 1
0
        public Chunk loadChunk(World world, int i, int j)
        {
            DataInputStream datainputstream = RegionFileCache.func_22124_c(field_22110_a, i, j);
            NBTTagCompound  nbttagcompound;

            if (datainputstream != null)
            {
                nbttagcompound = CompressedStreamTools.func_774_a(datainputstream);
            }
            else
            {
                return(null);
            }
            if (!nbttagcompound.hasKey("Level"))
            {
                [email protected](
                    (new StringBuilder()).append("Chunk file at ").append(i).append(",").append(j).append(
                        " is missing level data, skipping").toString());
                return(null);
            }
            if (!nbttagcompound.getCompoundTag("Level").hasKey("Blocks"))
            {
                [email protected](
                    (new StringBuilder()).append("Chunk file at ").append(i).append(",").append(j).append(
                        " is missing block data, skipping").toString());
                return(null);
            }
            Chunk chunk = ChunkLoader.loadChunkIntoWorldFromCompound(world, nbttagcompound.getCompoundTag("Level"));

            if (!chunk.isAtLocation(i, j))
            {
                [email protected](
                    (new StringBuilder()).append("Chunk file at ").append(i).append(",").append(j).append(
                        " is in the wrong location; relocating. (Expected ").append(i).append(", ").append(j).append(
                        ", got ").append(chunk.xPosition).append(", ").append(chunk.zPosition).append(")").toString());
                nbttagcompound.setInteger("xPos", i);
                nbttagcompound.setInteger("zPos", j);
                chunk = ChunkLoader.loadChunkIntoWorldFromCompound(world, nbttagcompound.getCompoundTag("Level"));
            }
            return(chunk);
        }
Ejemplo n.º 2
0
 public void saveChunk(World world, Chunk chunk)
 {
     world.checkSessionLock();
     try
     {
         DataOutputStream dataoutputstream = RegionFileCache.func_22120_d(field_22110_a, chunk.xPosition,
                                                                          chunk.zPosition);
         var nbttagcompound  = new NBTTagCompound();
         var nbttagcompound1 = new NBTTagCompound();
         nbttagcompound.setTag("Level", nbttagcompound1);
         ChunkLoader.storeChunkInCompound(chunk, world, nbttagcompound1);
         CompressedStreamTools.func_771_a(nbttagcompound, dataoutputstream);
         dataoutputstream.close();
         WorldInfo worldinfo = world.getWorldInfo();
         worldinfo.func_22177_b(worldinfo.func_22182_g() +
                                RegionFileCache.func_22121_b(field_22110_a, chunk.xPosition, chunk.zPosition));
     }
     catch (Exception exception)
     {
         exception.printStackTrace();
     }
 }
Ejemplo n.º 3
0
        private void func_22107_a(File file, ArrayList arraylist, int i, int j, IProgressUpdate iprogressupdate)
        {
            Collections.sort(arraylist);
            var abyte0 = new byte[4096];
            int i1;

            for (Iterator iterator = arraylist.iterator(); iterator.hasNext(); iprogressupdate.setLoadingProgress(i1))
            {
                var        filematcher = (FileMatcher)iterator.next();
                int        k           = filematcher.func_22205_b();
                int        l           = filematcher.func_22204_c();
                RegionFile regionfile  = RegionFileCache.func_22123_a(file, k, l);
                if (!regionfile.isChunkSaved(k & 0x1f, l & 0x1f))
                {
                    try
                    {
                        var datainputstream =
                            new DataInputStream(new GZIPInputStream(new FileInputStream(filematcher.func_22207_a())));
                        DataOutputStream dataoutputstream = regionfile.getChunkDataOutputStream(k & 0x1f, l & 0x1f);
                        for (int j1 = 0; (j1 = datainputstream.read(abyte0)) != -1;)
                        {
                            dataoutputstream.write(abyte0, 0, j1);
                        }

                        dataoutputstream.close();
                        datainputstream.close();
                    }
                    catch (IOException ioexception)
                    {
                        ioexception.printStackTrace();
                    }
                }
                i++;
                i1 = (int)Math.round((100D * i) / j);
            }

            RegionFileCache.func_22122_a();
        }
Ejemplo n.º 4
0
 public override void func_22093_e()
 {
     RegionFileCache.func_22122_a();
 }