当前位置: 首页>>代码示例>>C#>>正文


C# World.checkSessionLock方法代码示例

本文整理汇总了C#中CraftyServer.Core.World.checkSessionLock方法的典型用法代码示例。如果您正苦于以下问题:C# World.checkSessionLock方法的具体用法?C# World.checkSessionLock怎么用?C# World.checkSessionLock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CraftyServer.Core.World的用法示例。


在下文中一共展示了World.checkSessionLock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: storeChunkInCompound

        public static void storeChunkInCompound(Chunk chunk, World world, NBTTagCompound nbttagcompound)
        {
            world.checkSessionLock();
            nbttagcompound.setInteger("xPos", chunk.xPosition);
            nbttagcompound.setInteger("zPos", chunk.zPosition);
            nbttagcompound.setLong("LastUpdate", world.getWorldTime());
            nbttagcompound.setByteArray("Blocks", chunk.blocks);
            nbttagcompound.setByteArray("Data", chunk.data.data);
            nbttagcompound.setByteArray("SkyLight", chunk.skylightMap.data);
            nbttagcompound.setByteArray("BlockLight", chunk.blocklightMap.data);
            nbttagcompound.setByteArray("HeightMap", chunk.heightMap);
            nbttagcompound.setBoolean("TerrainPopulated", chunk.isTerrainPopulated);
            chunk.hasEntities = false;
            var nbttaglist = new NBTTagList();

            for (int i = 0; i < chunk.entities.Length; i++)
            {
                Iterator iterator = chunk.entities[i].iterator();
                do
                {
                    if (!iterator.hasNext())
                    {
                        goto label0;
                    }
                    var entity = (Entity) iterator.next();
                    chunk.hasEntities = true;
                    var nbttagcompound1 = new NBTTagCompound();
                    if (entity.addEntityID(nbttagcompound1))
                    {
                        nbttaglist.setTag(nbttagcompound1);
                    }
                } while (true);
            }
            label0:

            nbttagcompound.setTag("Entities", nbttaglist);
            var nbttaglist1 = new NBTTagList();
            NBTTagCompound nbttagcompound2;
            for (Iterator iterator1 = chunk.chunkTileEntityMap.values().iterator();
                 iterator1.hasNext();
                 nbttaglist1.setTag(nbttagcompound2))
            {
                var tileentity = (TileEntity) iterator1.next();
                nbttagcompound2 = new NBTTagCompound();
                tileentity.writeToNBT(nbttagcompound2);
            }

            nbttagcompound.setTag("TileEntities", nbttaglist1);
        }
开发者ID:riverar,项目名称:Crafty,代码行数:49,代码来源:ChunkLoader.cs

示例2: saveChunk

 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();
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:22,代码来源:McRegionChunkLoader.cs

示例3: saveChunk

 public void saveChunk(World world, Chunk chunk)
 {
     world.checkSessionLock();
     File file = chunkFileForXZ(chunk.xPosition, chunk.zPosition);
     if (file.exists())
     {
         WorldInfo worldinfo = world.getWorldInfo();
         worldinfo.func_22177_b(worldinfo.func_22182_g() - file.length());
     }
     try
     {
         var file1 = new File(saveDir, "tmp_chunk.dat");
         var fileoutputstream = new FileOutputStream(file1);
         var nbttagcompound = new NBTTagCompound();
         var nbttagcompound1 = new NBTTagCompound();
         nbttagcompound.setTag("Level", nbttagcompound1);
         storeChunkInCompound(chunk, world, nbttagcompound1);
         CompressedStreamTools.writeGzippedCompoundToOutputStream(nbttagcompound, fileoutputstream);
         fileoutputstream.close();
         if (file.exists())
         {
             file.delete();
         }
         file1.renameTo(file);
         WorldInfo worldinfo1 = world.getWorldInfo();
         worldinfo1.func_22177_b(worldinfo1.func_22182_g() + file.length());
     }
     catch (Exception exception)
     {
         exception.printStackTrace();
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:32,代码来源:ChunkLoader.cs


注:本文中的CraftyServer.Core.World.checkSessionLock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。