public WorldInfo(NBTTagCompound par1NBTTagCompound) { TerrainType = WorldType.DEFAULT; Hardcore = false; RandomSeed = par1NBTTagCompound.GetLong("RandomSeed"); if (par1NBTTagCompound.HasKey("generatorName")) { string s = par1NBTTagCompound.GetString("generatorName"); TerrainType = WorldType.ParseWorldType(s); if (TerrainType == null) { TerrainType = WorldType.DEFAULT; } else if (TerrainType.Func_48626_e()) { int i = 0; if (par1NBTTagCompound.HasKey("generatorVersion")) { i = par1NBTTagCompound.GetInteger("generatorVersion"); } TerrainType = TerrainType.Func_48629_a(i); } } GameType = par1NBTTagCompound.GetInteger("GameType"); if (par1NBTTagCompound.HasKey("MapFeatures")) { MapFeaturesEnabled = par1NBTTagCompound.Getbool("MapFeatures"); } else { MapFeaturesEnabled = true; } SpawnX = par1NBTTagCompound.GetInteger("SpawnX"); SpawnY = par1NBTTagCompound.GetInteger("SpawnY"); SpawnZ = par1NBTTagCompound.GetInteger("SpawnZ"); WorldTime = par1NBTTagCompound.GetLong("Time"); LastTimePlayed = par1NBTTagCompound.GetLong("LastPlayed"); SizeOnDisk = par1NBTTagCompound.GetLong("SizeOnDisk"); LevelName = par1NBTTagCompound.GetString("LevelName"); SaveVersion = par1NBTTagCompound.GetInteger("version"); RainTime = par1NBTTagCompound.GetInteger("rainTime"); Raining = par1NBTTagCompound.Getbool("raining"); ThunderTime = par1NBTTagCompound.GetInteger("thunderTime"); Thundering = par1NBTTagCompound.Getbool("thundering"); Hardcore = par1NBTTagCompound.Getbool("hardcore"); if (par1NBTTagCompound.HasKey("Player")) { PlayerTag = par1NBTTagCompound.GetCompoundTag("Player"); Dimension = PlayerTag.GetInteger("Dimension"); } }
protected virtual Chunk Func_48443_a(World par1World, int par2, int par3, NBTTagCompound par4NBTTagCompound) { if (!par4NBTTagCompound.HasKey("Level")) { Console.WriteLine((new StringBuilder()).Append("Chunk file at ").Append(par2).Append(",").Append(par3).Append(" is missing level data, skipping").ToString()); return(null); } if (!par4NBTTagCompound.GetCompoundTag("Level").HasKey("Sections")) { Console.WriteLine((new StringBuilder()).Append("Chunk file at ").Append(par2).Append(",").Append(par3).Append(" is missing block data, skipping").ToString()); return(null); } Chunk chunk = Func_48444_a(par1World, par4NBTTagCompound.GetCompoundTag("Level")); if (!chunk.IsAtLocation(par2, par3)) { Console.WriteLine((new StringBuilder()).Append("Chunk file at ").Append(par2).Append(",").Append(par3).Append(" is in the wrong location; relocating. (Expected ").Append(par2).Append(", ").Append(par3).Append(", got ").Append(chunk.XPosition).Append(", ").Append(chunk.ZPosition).Append(")").ToString()); par4NBTTagCompound.SetInteger("xPos", par2); par4NBTTagCompound.SetInteger("zPos", par3); chunk = Func_48444_a(par1World, par4NBTTagCompound.GetCompoundTag("Level")); } chunk.RemoveUnknownBlocks(); return(chunk); }
/// <summary> /// Reads food stats from an NBT object. /// </summary> public virtual void ReadNBT(NBTTagCompound par1NBTTagCompound) { if (par1NBTTagCompound.HasKey("foodLevel")) { FoodLevel = par1NBTTagCompound.GetInteger("foodLevel"); FoodTimer = par1NBTTagCompound.GetInteger("foodTickTimer"); FoodSaturationLevel = par1NBTTagCompound.GetFloat("foodSaturationLevel"); FoodExhaustionLevel = par1NBTTagCompound.GetFloat("foodExhaustionLevel"); } }
/// <summary> /// Adds a enchantments with a desired level on the ItemStack. /// </summary> public void AddEnchantment(Enchantment par1Enchantment, int par2) { if (StackTagCompound == null) { SetTagCompound(new NBTTagCompound()); } if (!StackTagCompound.HasKey("ench")) { StackTagCompound.SetTag("ench", new NBTTagList("ench")); } NBTTagList nbttaglist = (NBTTagList)StackTagCompound.GetTag("ench"); NBTTagCompound nbttagcompound = new NBTTagCompound(); nbttagcompound.SetShort("id", (short)par1Enchantment.EffectId); nbttagcompound.SetShort("lvl", (sbyte)par2); nbttaglist.AppendTag(nbttagcompound); }
/// <summary> /// Read the stack fields from a NBT object. /// </summary> public void ReadFromNBT(NBTTagCompound par1NBTTagCompound) { ItemID = par1NBTTagCompound.GetShort("id"); StackSize = par1NBTTagCompound.GetByte("Count"); ItemDamage = par1NBTTagCompound.GetShort("Damage"); if (par1NBTTagCompound.HasKey("tag")) { StackTagCompound = par1NBTTagCompound.GetCompoundTag("tag"); } }
/// <summary> /// (abstract) Protected helper method to read subclass entity data from NBT. /// </summary> public override void ReadEntityFromNBT(NBTTagCompound par1NBTTagCompound) { XTile = par1NBTTagCompound.GetShort("xTile"); YTile = par1NBTTagCompound.GetShort("yTile"); ZTile = par1NBTTagCompound.GetShort("zTile"); InTile = par1NBTTagCompound.GetByte("inTile") & 0xff; InData = par1NBTTagCompound.GetByte("inData") & 0xff; ArrowShake = par1NBTTagCompound.GetByte("shake") & 0xff; InGround = par1NBTTagCompound.GetByte("inGround") == 1; DoesArrowBelongToPlayer = par1NBTTagCompound.Getbool("player"); if (par1NBTTagCompound.HasKey("damage")) { Damage = par1NBTTagCompound.GetDouble("damage"); } }
private Chunk Func_48444_a(World par1World, NBTTagCompound par2NBTTagCompound) { int i = par2NBTTagCompound.GetInteger("xPos"); int j = par2NBTTagCompound.GetInteger("zPos"); Chunk chunk = new Chunk(par1World, i, j); chunk.HeightMap = par2NBTTagCompound.Func_48182_l("HeightMap"); chunk.IsTerrainPopulated = par2NBTTagCompound.Getbool("TerrainPopulated"); NBTTagList nbttaglist = par2NBTTagCompound.GetTagList("Sections"); sbyte byte0 = 16; ExtendedBlockStorage[] aextendedblockstorage = new ExtendedBlockStorage[byte0]; for (int k = 0; k < nbttaglist.TagCount(); k++) { NBTTagCompound nbttagcompound = (NBTTagCompound)nbttaglist.TagAt(k); byte byte1 = nbttagcompound.GetByte("Y"); ExtendedBlockStorage extendedblockstorage = new ExtendedBlockStorage(byte1 << 4); extendedblockstorage.SetBlockLSBArray(nbttagcompound.GetByteArray("Blocks")); if (nbttagcompound.HasKey("Add")) { extendedblockstorage.SetBlockMSBArray(new NibbleArray(nbttagcompound.GetByteArray("Add"), 4)); } extendedblockstorage.SetBlockMetadataArray(new NibbleArray(nbttagcompound.GetByteArray("Data"), 4)); extendedblockstorage.SetSkylightArray(new NibbleArray(nbttagcompound.GetByteArray("SkyLight"), 4)); extendedblockstorage.SetBlocklightArray(new NibbleArray(nbttagcompound.GetByteArray("BlockLight"), 4)); extendedblockstorage.Func_48708_d(); aextendedblockstorage[byte1] = extendedblockstorage; } chunk.SetStorageArrays(aextendedblockstorage); if (par2NBTTagCompound.HasKey("Biomes")) { chunk.SetBiomeArray(par2NBTTagCompound.GetByteArray("Biomes")); } NBTTagList nbttaglist1 = par2NBTTagCompound.GetTagList("Entities"); if (nbttaglist1 != null) { for (int l = 0; l < nbttaglist1.TagCount(); l++) { NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist1.TagAt(l); Entity entity = EntityList.CreateEntityFromNBT(nbttagcompound1, par1World); chunk.HasEntities = true; if (entity != null) { chunk.AddEntity(entity); } } } NBTTagList nbttaglist2 = par2NBTTagCompound.GetTagList("TileEntities"); if (nbttaglist2 != null) { for (int i1 = 0; i1 < nbttaglist2.TagCount(); i1++) { NBTTagCompound nbttagcompound2 = (NBTTagCompound)nbttaglist2.TagAt(i1); TileEntity tileentity = TileEntity.CreateAndLoadEntity(nbttagcompound2); if (tileentity != null) { chunk.AddTileEntity(tileentity); } } } if (par2NBTTagCompound.HasKey("TileTicks")) { NBTTagList nbttaglist3 = par2NBTTagCompound.GetTagList("TileTicks"); if (nbttaglist3 != null) { for (int j1 = 0; j1 < nbttaglist3.TagCount(); j1++) { NBTTagCompound nbttagcompound3 = (NBTTagCompound)nbttaglist3.TagAt(j1); par1World.ScheduleBlockUpdateFromLoad(nbttagcompound3.GetInteger("x"), nbttagcompound3.GetInteger("y"), nbttagcompound3.GetInteger("z"), nbttagcompound3.GetInteger("i"), nbttagcompound3.GetInteger("t")); } } } return(chunk); }