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"); } }
/// <summary> /// create a new instance of an entity from NBT store /// </summary> public static Entity CreateEntityFromNBT(NBTTagCompound par0NBTTagCompound, World par1World) { Entity entity = null; try { Type class1 = StringToClassMapping[par0NBTTagCompound.GetString("id")]; if (class1 != null) { entity = (Entity)Activator.CreateInstance(class1, new object[] { par1World }); } } catch (Exception exception) { Console.WriteLine(exception.ToString()); Console.Write(exception.StackTrace); } if (entity != null) { entity.ReadFromNBT(par0NBTTagCompound); } else { Console.WriteLine((new StringBuilder()).Append("Skipping Entity with id ").Append(par0NBTTagCompound.GetString("id")).ToString()); } return(entity); }
/// <summary> /// (abstract) Protected helper method to read subclass entity data from NBT. /// </summary> public override void ReadEntityFromNBT(NBTTagCompound par1NBTTagCompound) { Direction = par1NBTTagCompound.GetByte("Dir"); XPosition = par1NBTTagCompound.GetInteger("TileX"); YPosition = par1NBTTagCompound.GetInteger("TileY"); ZPosition = par1NBTTagCompound.GetInteger("TileZ"); string s = par1NBTTagCompound.GetString("Motive"); Art[] aenumart = Art.ArtArray; int i = aenumart.Length; for (int j = 0; j < i; j++) { Art enumart = aenumart[j]; if (enumart.Title.Equals(s)) { Art = enumart; } } if (Art == null) { Art = Art.Kebab; } Func_412_b(Direction); }
/// <summary> /// Creates a new entity and loads its data from the specified NBT. /// </summary> public static TileEntity CreateAndLoadEntity(NBTTagCompound par0NBTTagCompound) { TileEntity tileentity = null; try { Type class1 = NameToClassMap[par0NBTTagCompound.GetString("id")]; if (class1 != null) { tileentity = (TileEntity)Activator.CreateInstance(class1); } } catch (Exception exception) { Console.WriteLine(exception.ToString()); Console.Write(exception.StackTrace); } if (tileentity != null) { tileentity.ReadFromNBT(par0NBTTagCompound); } else { Console.WriteLine((new StringBuilder()).Append("Skipping TileEntity with id ").Append(par0NBTTagCompound.GetString("id")).ToString()); } return(tileentity); }
/// <summary> /// (abstract) Protected helper method to read subclass entity data from NBT. /// </summary> public override void ReadEntityFromNBT(NBTTagCompound par1NBTTagCompound) { base.ReadEntityFromNBT(par1NBTTagCompound); string s = par1NBTTagCompound.GetString("Owner"); if (s.Length > 0) { SetOwner(s); SetTamed(true); } AiSit.Func_48407_a(par1NBTTagCompound.Getbool("Sitting")); }
/// <summary> /// Reads a tile entity from NBT. /// </summary> public override void ReadFromNBT(NBTTagCompound par1NBTTagCompound) { IsEditable = false; base.ReadFromNBT(par1NBTTagCompound); for (int i = 0; i < 4; i++) { SignText[i] = par1NBTTagCompound.GetString((new StringBuilder()).Append("Text").Append(i + 1).ToString()); if (SignText[i].Length > 15) { SignText[i] = SignText[i].Substring(0, 15); } } }