public static void StoreChunkInCompound(net.minecraft.src.Chunk chunk, net.minecraft.src.World world, net.minecraft.src.NBTTagCompound nbttagcompound) { world.CheckSessionLock(); nbttagcompound.SetInteger("xPos", chunk.xPosition); nbttagcompound.SetInteger("zPos", chunk.zPosition); nbttagcompound.SetLong("LastUpdate", world.GetWorldTime()); nbttagcompound.SetByteArray("Blocks", chunk.blocks); nbttagcompound.SetByteArray("Data", chunk.data.data); nbttagcompound.SetByteArray("SkyLight", chunk.skylightMap.data); nbttagcompound.SetByteArray("BlockLight", chunk.blocklightMap.data); nbttagcompound.SetByteArray("HeightMap", chunk.heightMap); nbttagcompound.SetBoolean("TerrainPopulated", chunk.isTerrainPopulated); chunk.hasEntities = false; net.minecraft.src.NBTTagList nbttaglist = new net.minecraft.src.NBTTagList(); for (int i = 0; i < chunk.entities.Length; i++) { System.Collections.IEnumerator iterator = chunk.entities[i].GetEnumerator(); do { if (!iterator.MoveNext()) { goto label0_continue; } net.minecraft.src.Entity entity = (net.minecraft.src.Entity)iterator.Current; chunk.hasEntities = true; net.minecraft.src.NBTTagCompound nbttagcompound1 = new net.minecraft.src.NBTTagCompound (); if (entity.AddEntityID(nbttagcompound1)) { nbttaglist.SetTag(nbttagcompound1); } }while (true); label0_continue :; } label0_break :; nbttagcompound.SetTag("Entities", nbttaglist); net.minecraft.src.NBTTagList nbttaglist1 = new net.minecraft.src.NBTTagList(); net.minecraft.src.NBTTagCompound nbttagcompound2; for (System.Collections.IEnumerator iterator1 = chunk.chunkTileEntityMap.Values.GetEnumerator (); iterator1.MoveNext(); nbttaglist1.SetTag(nbttagcompound2)) { net.minecraft.src.TileEntity tileentity = (net.minecraft.src.TileEntity)iterator1 .Current; nbttagcompound2 = new net.minecraft.src.NBTTagCompound(); tileentity.WriteToNBT(nbttagcompound2); } nbttagcompound.SetTag("TileEntities", nbttaglist1); }