Пример #1
0
        public WorldInfo func_22103_b(string s)
        {
            var file = new File(field_22106_a, s);

            if (!file.exists())
            {
                return(null);
            }
            var file1 = new File(file, "level.dat");

            if (file1.exists())
            {
                try
                {
                    NBTTagCompound nbttagcompound  = CompressedStreamTools.func_770_a(new FileInputStream(file1));
                    NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data");
                    return(new WorldInfo(nbttagcompound1));
                }
                catch (Exception exception)
                {
                    exception.printStackTrace();
                }
            }
            return(null);
        }
Пример #2
0
        public Chunk loadChunk(World world, int i, int j)
        {
            File file = chunkFileForXZ(i, j);

            if (file != null && file.exists())
            {
                try
                {
                    var            fileinputstream = new FileInputStream(file);
                    NBTTagCompound nbttagcompound  = CompressedStreamTools.func_770_a(fileinputstream);
                    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 = 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 = loadChunkIntoWorldFromCompound(world, nbttagcompound.getCompoundTag("Level"));
                    }
                    return(chunk);
                }
                catch (Exception exception)
                {
                    exception.printStackTrace();
                }
            }
            return(null);
        }
Пример #3
0
        public virtual WorldInfo func_22096_c()
        {
            var file = new File(field_22099_b, "level.dat");

            if (file.exists())
            {
                try
                {
                    NBTTagCompound nbttagcompound  = CompressedStreamTools.func_770_a(new FileInputStream(file));
                    NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data");
                    return(new WorldInfo(nbttagcompound1));
                }
                catch (Exception exception)
                {
                    exception.printStackTrace();
                }
            }
            return(null);
        }
Пример #4
0
 public virtual void readPlayerData(EntityPlayer entityplayer)
 {
     try
     {
         var file = new File(worldFile,
                             (new StringBuilder()).append(entityplayer.username).append(".dat").toString());
         if (file.exists())
         {
             NBTTagCompound nbttagcompound = CompressedStreamTools.func_770_a(new FileInputStream(file));
             if (nbttagcompound != null)
             {
                 entityplayer.readFromNBT(nbttagcompound);
             }
         }
     }
     catch (Exception)
     {
         logger.warning(
             (new StringBuilder()).append("Failed to load player data for ").append(entityplayer.username).
             toString());
     }
 }