コード例 #1
0
 public override void readEntityFromNBT(NBTTagCompound nbttagcompound)
 {
     health = nbttagcompound.getShort("Health");
     if (!nbttagcompound.hasKey("Health"))
     {
         health = 10;
     }
     hurtTime   = nbttagcompound.getShort("HurtTime");
     deathTime  = nbttagcompound.getShort("DeathTime");
     attackTime = nbttagcompound.getShort("AttackTime");
 }
コード例 #2
0
ファイル: WorldInfo.cs プロジェクト: riverar/Crafty
 public WorldInfo(NBTTagCompound nbttagcompound)
 {
     randomSeed = nbttagcompound.getLong("RandomSeed");
     spawnX = nbttagcompound.getInteger("SpawnX");
     spawnY = nbttagcompound.getInteger("SpawnY");
     spawnZ = nbttagcompound.getInteger("SpawnZ");
     worldTime = nbttagcompound.getLong("Time");
     lastPlayed = nbttagcompound.getLong("LastPlayed");
     sizeOnDisk = nbttagcompound.getLong("SizeOnDisk");
     levelName = nbttagcompound.getString("LevelName");
     version = nbttagcompound.getInteger("version");
     if (nbttagcompound.hasKey("Player"))
     {
         field_22195_h = nbttagcompound.getCompoundTag("Player");
         field_22194_i = field_22195_h.getInteger("Dimension");
     }
 }
コード例 #3
0
ファイル: WorldInfo.cs プロジェクト: geckosoft/Crafty
 public WorldInfo(NBTTagCompound nbttagcompound)
 {
     randomSeed = nbttagcompound.getLong("RandomSeed");
     spawnX     = nbttagcompound.getInteger("SpawnX");
     spawnY     = nbttagcompound.getInteger("SpawnY");
     spawnZ     = nbttagcompound.getInteger("SpawnZ");
     worldTime  = nbttagcompound.getLong("Time");
     lastPlayed = nbttagcompound.getLong("LastPlayed");
     sizeOnDisk = nbttagcompound.getLong("SizeOnDisk");
     levelName  = nbttagcompound.getString("LevelName");
     version    = nbttagcompound.getInteger("version");
     if (nbttagcompound.hasKey("Player"))
     {
         field_22195_h = nbttagcompound.getCompoundTag("Player");
         field_22194_i = field_22195_h.getInteger("Dimension");
     }
 }
コード例 #4
0
ファイル: ChunkLoader.cs プロジェクト: geckosoft/Crafty
        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);
        }