protected internal override void ReadEntityFromNBT(net.minecraft.src.NBTTagCompound nbttagcompound) { health = nbttagcompound.GetShort("Health"); if (!nbttagcompound.HasKey("Health")) { health = 10; } hurtTime = nbttagcompound.GetShort("HurtTime"); deathTime = nbttagcompound.GetShort("DeathTime"); attackTime = nbttagcompound.GetShort("AttackTime"); }
/// <exception cref="System.IO.IOException"/> public virtual net.minecraft.src.Chunk LoadChunk(net.minecraft.src.World world, int i, int j) { string file = ChunkFileForXZ(i, j); if (file != null && System.IO.File.Exists(file)) { try { net.minecraft.src.NBTTagCompound nbttagcompound = null; //java.io.FileInputStream fileinputstream = new java.io.FileInputStream(file); using (System.IO.FileStream fileinputstream = System.IO.File.OpenRead(file)) nbttagcompound = net.minecraft.src.CompressedStreamTools.ReadCompoundFromStream(fileinputstream); if (!nbttagcompound.HasKey("Level")) { System.Console.Out.WriteLine((new java.lang.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")) { System.Console.Out.WriteLine((new java.lang.StringBuilder()).Append("Chunk file at " ).Append(i).Append(",").Append(j).Append(" is missing block data, skipping").ToString ()); return(null); } net.minecraft.src.Chunk chunk = LoadChunkIntoWorldFromCompound(world, nbttagcompound .GetCompoundTag("Level")); if (!chunk.IsAtLocation(i, j)) { System.Console.Out.WriteLine((new java.lang.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" )); } chunk.Func_25083_h(); return(chunk); } catch (System.Exception exception) { Sharpen.Runtime.PrintStackTrace(exception); } } return(null); }
protected internal override void ReadEntityFromNBT(net.minecraft.src.NBTTagCompound nbttagcompound) { base.ReadEntityFromNBT(nbttagcompound); net.minecraft.src.NBTTagList nbttaglist = nbttagcompound.GetTagList("Inventory"); inventory.ReadFromNBT(nbttaglist); dimension = nbttagcompound.GetInteger("Dimension"); sleeping = nbttagcompound.GetBoolean("Sleeping"); sleepTimer = nbttagcompound.GetShort("SleepTimer"); if (sleeping) { playerLocation = new net.minecraft.src.ChunkCoordinates(net.minecraft.src.MathHelper .Floor_double(posX), net.minecraft.src.MathHelper.Floor_double(posY), net.minecraft.src.MathHelper .Floor_double(posZ)); WakeUpPlayer(true, true, false); } if (nbttagcompound.HasKey("SpawnX") && nbttagcompound.HasKey("SpawnY") && nbttagcompound .HasKey("SpawnZ")) { spawnChunk = new net.minecraft.src.ChunkCoordinates(nbttagcompound.GetInteger("SpawnX" ), nbttagcompound.GetInteger("SpawnY"), nbttagcompound.GetInteger("SpawnZ")); } }
public WorldInfo(net.minecraft.src.NBTTagCompound nbttagcompound) { // Referenced classes of package net.minecraft.src: // NBTTagCompound, EntityPlayer randomSeed = nbttagcompound.GetLong("RandomSeed"); spawnX = nbttagcompound.GetInteger("SpawnX"); spawnY = nbttagcompound.GetInteger("SpawnY"); spawnZ = nbttagcompound.GetInteger("SpawnZ"); worldTime = nbttagcompound.GetLong("Time"); lastTimePlayed = nbttagcompound.GetLong("LastPlayed"); sizeOnDisk = nbttagcompound.GetLong("SizeOnDisk"); levelName = nbttagcompound.GetString("LevelName"); saveVersion = nbttagcompound.GetInteger("version"); rainTime = nbttagcompound.GetInteger("rainTime"); isRaining = nbttagcompound.GetBoolean("raining"); thunderTime = nbttagcompound.GetInteger("thunderTime"); isThundering = nbttagcompound.GetBoolean("thundering"); if (nbttagcompound.HasKey("Player")) { field_22195_h = nbttagcompound.GetCompoundTag("Player"); dimension = field_22195_h.GetInteger("Dimension"); } }