예제 #1
0
 /// <exception cref="System.IO.IOException"/>
 public virtual void SaveChunk(net.minecraft.src.World world, net.minecraft.src.Chunk
                               chunk)
 {
     world.CheckSessionLock();
     try
     {
         java.io.DataOutputStream dataoutputstream = net.minecraft.src.RegionFileCache.Func_22120_d
                                                         (worldFolder, chunk.xPosition, chunk.zPosition);
         net.minecraft.src.NBTTagCompound nbttagcompound = new net.minecraft.src.NBTTagCompound
                                                               ();
         net.minecraft.src.NBTTagCompound nbttagcompound1 = new net.minecraft.src.NBTTagCompound
                                                                ();
         nbttagcompound.SetTag("Level", nbttagcompound1);
         net.minecraft.src.ChunkLoader.StoreChunkInCompound(chunk, world, nbttagcompound1);
         net.minecraft.src.CompressedStreamTools.Func_771_a(nbttagcompound, dataoutputstream
                                                            );
         dataoutputstream.Close();
         net.minecraft.src.WorldInfo worldinfo = world.GetWorldInfo();
         worldinfo.SetSizeOnDisk(worldinfo.GetSizeOnDisk() + (long)net.minecraft.src.RegionFileCache
                                 .Func_22121_b(worldFolder, chunk.xPosition, chunk.zPosition));
     }
     catch (System.Exception exception)
     {
         Sharpen.Runtime.PrintStackTrace(exception);
     }
 }
예제 #2
0
        /// <exception cref="System.IO.IOException"/>
        public virtual void SaveChunk(net.minecraft.src.World world, net.minecraft.src.Chunk
                                      chunk)
        {
            world.CheckSessionLock();
            string file = ChunkFileForXZ(chunk.xPosition, chunk.zPosition);

            if (System.IO.File.Exists(file))
            {
                net.minecraft.src.WorldInfo worldinfo = world.GetWorldInfo();
                worldinfo.SetSizeOnDisk(worldinfo.GetSizeOnDisk() - file.Length);
            }
            try
            {
                string file1 = System.IO.Path.Combine(saveDir, "tmp_chunk.dat");
                using (FileStream fileoutputstream = File.OpenWrite(file1))
                {
                    net.minecraft.src.NBTTagCompound nbttagcompound = new net.minecraft.src.NBTTagCompound
                                                                          ();
                    net.minecraft.src.NBTTagCompound nbttagcompound1 = new net.minecraft.src.NBTTagCompound
                                                                           ();
                    nbttagcompound.SetTag("Level", nbttagcompound1);
                    StoreChunkInCompound(chunk, world, nbttagcompound1);
                    net.minecraft.src.CompressedStreamTools.WriteGzippedCompoundToOutputStream(nbttagcompound, fileoutputstream);
                    //fileoutputstream.Close();
                }
                if (System.IO.File.Exists(file))
                {
                    System.IO.File.Delete(file);
                }
                System.IO.File.Move(file1, file);
                //file1.RenameTo(file);
                net.minecraft.src.WorldInfo worldinfo1 = world.GetWorldInfo();
                worldinfo1.SetSizeOnDisk(worldinfo1.GetSizeOnDisk() + file.Length);
            }
            catch (System.Exception exception)
            {
                Sharpen.Runtime.PrintStackTrace(exception);
            }
        }
예제 #3
0
        public virtual net.minecraft.src.MapData Func_28023_a(net.minecraft.src.ItemStack
                                                              itemstack, net.minecraft.src.World world)
        {
            string s = (new java.lang.StringBuilder()).Append("map_").Append(itemstack.GetItemDamage
                                                                                 ()).ToString();

            net.minecraft.src.MapData mapdata = (net.minecraft.src.MapData)world.Func_28103_a
                                                    (Sharpen.Runtime.GetClassForType(typeof(net.minecraft.src.MapData)), (new java.lang.StringBuilder
                                                                                                                              ()).Append("map_").Append(itemstack.GetItemDamage()).ToString());
            if (mapdata == null)
            {
                itemstack.SetItemDamage(world.Func_28104_b("map"));
                string s1 = (new java.lang.StringBuilder()).Append("map_").Append(itemstack.GetItemDamage
                                                                                      ()).ToString();
                mapdata = new net.minecraft.src.MapData(s1);
                mapdata.field_28164_b = world.GetWorldInfo().GetSpawnX();
                mapdata.field_28163_c = world.GetWorldInfo().GetSpawnZ();
                mapdata.field_28161_e = 3;
                mapdata.field_28162_d = unchecked ((byte)world.worldProvider.worldType);
                mapdata.Func_28146_a();
                world.Func_28102_a(s1, mapdata);
            }
            return(mapdata);
        }