/// <summary> /// reads in data from the NBTTagCompound into this MapDataBase /// </summary> public override void ReadFromNBT(NBTTagCompound par1NBTTagCompound) { Dimension = par1NBTTagCompound.GetByte("dimension"); XCenter = par1NBTTagCompound.GetInteger("xCenter"); ZCenter = par1NBTTagCompound.GetInteger("zCenter"); Scale = par1NBTTagCompound.GetByte("scale"); if (Scale < 0) { Scale = 0; } if (Scale > 4) { Scale = 4; } short word0 = par1NBTTagCompound.GetShort("width"); short word1 = par1NBTTagCompound.GetShort("height"); if (word0 == 128 && word1 == 128) { Colors = par1NBTTagCompound.GetByteArray("colors"); } else { byte[] abyte0 = par1NBTTagCompound.GetByteArray("colors"); Colors = new byte[16384]; int i = (128 - word0) / 2; int j = (128 - word1) / 2; for (int k = 0; k < word1; k++) { int l = k + j; if (l < 0 && l >= 128) { continue; } for (int i1 = 0; i1 < word0; i1++) { int j1 = i1 + i; if (j1 >= 0 || j1 < 128) { Colors[j1 + l * 128] = abyte0[i1 + k * word0]; } } } } }
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); }