/// <exception cref="System.IO.IOException"/> public virtual void SaveChunk(net.minecraft.src.World world, net.minecraft.src.Chunk chunk) { world.CheckSessionLock(); try { java.io.DataOutputStream dataoutputstream = net.minecraft.src.RegionFileCache.Func_22120_d (worldFolder, chunk.xPosition, chunk.zPosition); net.minecraft.src.NBTTagCompound nbttagcompound = new net.minecraft.src.NBTTagCompound (); net.minecraft.src.NBTTagCompound nbttagcompound1 = new net.minecraft.src.NBTTagCompound (); nbttagcompound.SetTag("Level", nbttagcompound1); net.minecraft.src.ChunkLoader.StoreChunkInCompound(chunk, world, nbttagcompound1); net.minecraft.src.CompressedStreamTools.Func_771_a(nbttagcompound, dataoutputstream ); dataoutputstream.Close(); net.minecraft.src.WorldInfo worldinfo = world.GetWorldInfo(); worldinfo.SetSizeOnDisk(worldinfo.GetSizeOnDisk() + (long)net.minecraft.src.RegionFileCache .Func_22121_b(worldFolder, chunk.xPosition, chunk.zPosition)); } catch (System.Exception exception) { Sharpen.Runtime.PrintStackTrace(exception); } }
public virtual int GetBlockId(int i, int j, int k) { if (j < 0) { return(0); } if (j >= 128) { return(0); } int l = (i >> 4) - chunkX; int i1 = (k >> 4) - chunkZ; if (l < 0 || l >= chunkArray.Length || i1 < 0 || i1 >= chunkArray[l].Length) { return(0); } net.minecraft.src.Chunk chunk = chunkArray[l][i1]; if (chunk == null) { return(0); } else { return(chunk.GetBlockID(i & 0xf, j, k & 0xf)); } }
public virtual bool SaveChunks(bool flag, net.minecraft.src.IProgressUpdate iprogressupdate ) { int i = 0; for (int j = 0; j < field_28064_f.Count; j++) { net.minecraft.src.Chunk chunk = (net.minecraft.src.Chunk)field_28064_f[j]; if (flag && !chunk.neverSave) { Func_28060_a(chunk); } if (!chunk.NeedsSaving(flag)) { continue; } Func_28059_b(chunk); chunk.isModified = false; if (++i == 24 && !flag) { return(false); } } if (flag) { if (field_28066_d == null) { return(true); } field_28066_d.SaveExtraData(); } return(true); }
public override bool GetCanSpawnHere() { net.minecraft.src.Chunk chunk = worldObj.GetChunkFromBlockCoords(net.minecraft.src.MathHelper .Floor_double(posX), net.minecraft.src.MathHelper.Floor_double(posZ)); return((Func_25027_m() == 1 || worldObj.difficultySetting > 0) && rand.Next(10 ) == 0 && chunk.Func_334_a(unchecked ((long)(0x3ad8025fL))).NextInt(10) == 0 && posY < 16D); }
public virtual net.minecraft.src.Chunk ProvideChunk(int i, int j) { //hellRNG = new SharpBukkitLive.SharpBukkit.SharpRandom(((long)i * unchecked((long)(0x4f9939f508L)) + (long)j * unchecked((long)(0x1ef1565bd5L)))); hellRNG.SetSeed((long)i *unchecked ((long)(0x4f9939f508L)) + (long)j *unchecked ((long)(0x1ef1565bd5L))); byte[] abyte0 = new byte[32768]; Func_4062_a(i, j, abyte0); Func_4061_b(i, j, abyte0); field_4230_s.Func_667_a(this, field_4235_n, i, j, abyte0); net.minecraft.src.Chunk chunk = new net.minecraft.src.Chunk(field_4235_n, abyte0, i, j); return(chunk); }
public virtual net.minecraft.src.Chunk ProvideChunk(int i, int j) { net.minecraft.src.Chunk chunk = (net.minecraft.src.Chunk)field_28065_e[ net.minecraft.src.ChunkCoordIntPair.ChunkXZ2Int(i, j)]; if (chunk == null) { return(LoadChunk(i, j)); } else { return(chunk); } }
/// <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); }
public virtual net.minecraft.src.Chunk LoadChunk(int i, int j) { int k = net.minecraft.src.ChunkCoordIntPair.ChunkXZ2Int(i, j); field_28062_a.Remove(k); net.minecraft.src.Chunk chunk = (net.minecraft.src.Chunk)field_28065_e[k]; if (chunk == null) { chunk = Func_28058_d(i, j); if (chunk == null) { if (chunkGenerator == null) { chunk = field_28061_b; } else { chunk = chunkGenerator.ProvideChunk(i, j); } } field_28065_e[k] = chunk; field_28064_f.Add(chunk); if (chunk != null) { chunk.Func_4053_c(); chunk.OnChunkLoad(); } if (!chunk.isTerrainPopulated && ChunkExists(i + 1, j + 1) && ChunkExists(i, j + 1) && ChunkExists(i + 1, j)) { Populate(this, i, j); } if (ChunkExists(i - 1, j) && !ProvideChunk(i - 1, j).isTerrainPopulated&& ChunkExists (i - 1, j + 1) && ChunkExists(i, j + 1) && ChunkExists(i - 1, j)) { Populate(this, i - 1, j); } if (ChunkExists(i, j - 1) && !ProvideChunk(i, j - 1).isTerrainPopulated&& ChunkExists (i + 1, j - 1) && ChunkExists(i, j - 1) && ChunkExists(i + 1, j)) { Populate(this, i, j - 1); } if (ChunkExists(i - 1, j - 1) && !ProvideChunk(i - 1, j - 1).isTerrainPopulated&& ChunkExists(i - 1, j - 1) && ChunkExists(i, j - 1) && ChunkExists(i - 1, j)) { Populate(this, i - 1, j - 1); } } return(chunk); }
public virtual net.minecraft.src.Chunk ProvideChunk(int i, int j) { rand.SetSeed((long)i *unchecked ((long)(0x4f9939f508L)) + (long)j *unchecked ((long )(0x1ef1565bd5L))); byte[] abyte0 = new byte[32768]; net.minecraft.src.Chunk chunk = new net.minecraft.src.Chunk(worldObj, abyte0, i, j); biomesForGeneration = worldObj.GetWorldChunkManager().LoadBlockGeneratorData(biomesForGeneration, i * 16, j * 16, 16, 16); double[] ad = worldObj.GetWorldChunkManager().temperature; GenerateTerrain(i, j, abyte0, biomesForGeneration, ad); ReplaceBlocksForBiome(i, j, abyte0, biomesForGeneration); field_695_u.Func_667_a(this, worldObj, i, j, abyte0); chunk.Func_353_b(); return(chunk); }
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); }
private void Func_28060_a(net.minecraft.src.Chunk chunk) { if (field_28066_d == null) { return; } try { field_28066_d.SaveExtraChunkData(worldObj, chunk); } catch (System.Exception exception) { Sharpen.Runtime.PrintStackTrace(exception); } }
private void Func_28059_b(net.minecraft.src.Chunk chunk) { if (field_28066_d == null) { return; } try { chunk.lastSaveTime = worldObj.GetWorldTime(); field_28066_d.SaveChunk(worldObj, chunk); } catch (System.IO.IOException ioexception) { Sharpen.Runtime.PrintStackTrace(ioexception); } }
public virtual net.minecraft.src.Chunk ProvideChunk(int i, int j) { field_28085_j.SetSeed((long)i *unchecked ((long)(0x4f9939f508L)) + (long)j *unchecked ( (long)(0x1ef1565bd5L))); byte[] abyte0 = new byte[32768]; net.minecraft.src.Chunk chunk = new net.minecraft.src.Chunk(field_28079_p, abyte0 , i, j); field_28073_v = field_28079_p.GetWorldChunkManager().LoadBlockGeneratorData(field_28073_v , i * 16, j * 16, 16, 16); double[] ad = field_28079_p.GetWorldChunkManager().temperature; Func_28070_a(i, j, abyte0, field_28073_v, ad); Func_28069_a(i, j, abyte0, field_28073_v); field_28074_u.Func_667_a(this, field_28079_p, i, j, abyte0); chunk.Func_353_b(); return(chunk); }
/// <exception cref="System.IO.IOException"/> public virtual net.minecraft.src.Chunk LoadChunk(net.minecraft.src.World world, int i, int j) { java.io.DataInputStream datainputstream = net.minecraft.src.RegionFileCache.Func_22124_c(worldFolder, i, j); net.minecraft.src.NBTTagCompound nbttagcompound; if (datainputstream != null) { nbttagcompound = net.minecraft.src.CompressedStreamTools.GetCompound(datainputstream ); } else { return(null); } 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 = net.minecraft.src.ChunkLoader.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 = net.minecraft.src.ChunkLoader.LoadChunkIntoWorldFromCompound(world, nbttagcompound .GetCompoundTag("Level")); } chunk.Func_25083_h(); return(chunk); }
public Packet52MultiBlockChange(int x, int z, short[] aword0, int arraySize, net.minecraft.src.World world) { isChunkDataPacket = true; xPosition = x; zPosition = z; size = arraySize; coordinateArray = new short[arraySize]; typeArray = new byte[arraySize]; metadataArray = new byte[arraySize]; net.minecraft.src.Chunk chunk = world.GetChunkFromChunkCoords(x, z); for (int l = 0; l < arraySize; l++) { int i1 = aword0[l] >> 12 & 0xf; int j1 = aword0[l] >> 8 & 0xf; int k1 = aword0[l] & 0xff; coordinateArray[l] = aword0[l]; typeArray[l] = unchecked ((byte)chunk.GetBlockID(i1, k1, j1)); metadataArray[l] = unchecked ((byte)chunk.GetBlockMetadata(i1, k1, j1)); } }
private net.minecraft.src.Chunk LoadChunkViaChunkLoader(int i, int j) { if (chunkLoader == null) { return(null); } try { net.minecraft.src.Chunk chunk = chunkLoader.LoadChunk(world, i, j); if (chunk != null) { chunk.lastSaveTime = world.GetWorldTime(); } return(chunk); } catch (System.Exception exception) { Sharpen.Runtime.PrintStackTrace(exception); } return(null); }
private net.minecraft.src.Chunk Func_28058_d(int i, int j) { if (field_28066_d == null) { return(null); } try { net.minecraft.src.Chunk chunk = field_28066_d.LoadChunk(worldObj, i, j); if (chunk != null) { chunk.lastSaveTime = worldObj.GetWorldTime(); } return(chunk); } catch (System.Exception exception) { Sharpen.Runtime.PrintStackTrace(exception); } return(null); }
public virtual bool UnloadChunks() { for (int i = 0; i < 100; i++) { if (field_28062_a.Count > 0) { int integer = (int)field_28062_a.GetEnumerator().Current.Key; net.minecraft.src.Chunk chunk = (net.minecraft.src.Chunk)field_28065_e[integer]; chunk.OnChunkUnload(); Func_28059_b(chunk); Func_28060_a(chunk); field_28062_a.Remove(integer); field_28065_e.Remove(integer); //Sharpen.Collections.Remove(field_28065_e, integer); field_28064_f.Remove(chunk); } } if (field_28066_d != null) { field_28066_d.Func_661_a(); } return(chunkGenerator.UnloadChunks()); }
/// <exception cref="System.IO.IOException"/> public virtual void SaveChunk(net.minecraft.src.World world, net.minecraft.src.Chunk chunk) { world.CheckSessionLock(); string file = ChunkFileForXZ(chunk.xPosition, chunk.zPosition); if (System.IO.File.Exists(file)) { net.minecraft.src.WorldInfo worldinfo = world.GetWorldInfo(); worldinfo.SetSizeOnDisk(worldinfo.GetSizeOnDisk() - file.Length); } try { string file1 = System.IO.Path.Combine(saveDir, "tmp_chunk.dat"); using (FileStream fileoutputstream = File.OpenWrite(file1)) { net.minecraft.src.NBTTagCompound nbttagcompound = new net.minecraft.src.NBTTagCompound (); net.minecraft.src.NBTTagCompound nbttagcompound1 = new net.minecraft.src.NBTTagCompound (); nbttagcompound.SetTag("Level", nbttagcompound1); StoreChunkInCompound(chunk, world, nbttagcompound1); net.minecraft.src.CompressedStreamTools.WriteGzippedCompoundToOutputStream(nbttagcompound, fileoutputstream); //fileoutputstream.Close(); } if (System.IO.File.Exists(file)) { System.IO.File.Delete(file); } System.IO.File.Move(file1, file); //file1.RenameTo(file); net.minecraft.src.WorldInfo worldinfo1 = world.GetWorldInfo(); worldinfo1.SetSizeOnDisk(worldinfo1.GetSizeOnDisk() + file.Length); } catch (System.Exception exception) { Sharpen.Runtime.PrintStackTrace(exception); } }
public virtual void Func_4107_a(net.minecraft.src.World world) { int i = (field_960_e - field_956_b) + 1; int j = (field_959_f - field_962_c) + 1; int k = (field_958_g - field_961_d) + 1; int l = i * j * k; if (l > 32768) { System.Console.Out.WriteLine("Light too large, skipping!"); return; } int i1 = 0; int j1 = 0; bool flag = false; bool flag1 = false; for (int k1 = field_956_b; k1 <= field_960_e; k1++) { for (int l1 = field_961_d; l1 <= field_958_g; l1++) { int i2 = k1 >> 4; int j2 = l1 >> 4; bool flag2 = false; if (flag && i2 == i1 && j2 == j1) { flag2 = flag1; } else { flag2 = world.DoChunksNearChunkExist(k1, 0, l1, 1); if (flag2) { net.minecraft.src.Chunk chunk = world.GetChunkFromChunkCoords(k1 >> 4, l1 >> 4); if (chunk.Func_21101_g()) { flag2 = false; } } flag1 = flag2; i1 = i2; j1 = j2; } if (!flag2) { continue; } if (field_962_c < 0) { field_962_c = 0; } if (field_959_f >= 128) { field_959_f = 127; } for (int k2 = field_962_c; k2 <= field_959_f; k2++) { int l2 = world.GetSavedLightValue(field_957_a, k1, k2, l1); int i3 = 0; int j3 = world.GetBlockId(k1, k2, l1); int k3 = net.minecraft.src.Block.lightOpacity[j3]; if (k3 == 0) { k3 = 1; } int l3 = 0; if (field_957_a == net.minecraft.src.EnumSkyBlock.Sky) { if (world.CanExistingBlockSeeTheSky(k1, k2, l1)) { l3 = 15; } } else { if (field_957_a == net.minecraft.src.EnumSkyBlock.Block) { l3 = net.minecraft.src.Block.lightValue[j3]; } } if (k3 >= 15 && l3 == 0) { i3 = 0; } else { int i4 = world.GetSavedLightValue(field_957_a, k1 - 1, k2, l1); int k4 = world.GetSavedLightValue(field_957_a, k1 + 1, k2, l1); int l4 = world.GetSavedLightValue(field_957_a, k1, k2 - 1, l1); int i5 = world.GetSavedLightValue(field_957_a, k1, k2 + 1, l1); int j5 = world.GetSavedLightValue(field_957_a, k1, k2, l1 - 1); int k5 = world.GetSavedLightValue(field_957_a, k1, k2, l1 + 1); i3 = i4; if (k4 > i3) { i3 = k4; } if (l4 > i3) { i3 = l4; } if (i5 > i3) { i3 = i5; } if (j5 > i3) { i3 = j5; } if (k5 > i3) { i3 = k5; } i3 -= k3; if (i3 < 0) { i3 = 0; } if (l3 > i3) { i3 = l3; } } if (l2 == i3) { continue; } world.SetLightValue(field_957_a, k1, k2, l1, i3); int j4 = i3 - 1; if (j4 < 0) { j4 = 0; } world.NeighborLightPropagationChanged(field_957_a, k1 - 1, k2, l1, j4); world.NeighborLightPropagationChanged(field_957_a, k1, k2 - 1, l1, j4); world.NeighborLightPropagationChanged(field_957_a, k1, k2, l1 - 1, j4); if (k1 + 1 >= field_960_e) { world.NeighborLightPropagationChanged(field_957_a, k1 + 1, k2, l1, j4); } if (k2 + 1 >= field_959_f) { world.NeighborLightPropagationChanged(field_957_a, k1, k2 + 1, l1, j4); } if (l1 + 1 >= field_958_g) { world.NeighborLightPropagationChanged(field_957_a, k1, k2, l1 + 1, j4); } } } } }
public virtual void Func_28024_a(net.minecraft.src.World world, net.minecraft.src.Entity entity, net.minecraft.src.MapData mapdata) { if (world.worldProvider.worldType != mapdata.field_28162_d) { return; } short c = 128; //'\200'; short c1 = 128; //'\200'; int i = 1 << mapdata.field_28161_e; int j = mapdata.field_28164_b; int k = mapdata.field_28163_c; int l = net.minecraft.src.MathHelper.Floor_double(entity.posX - (double)j) / i + c / 2; int i1 = net.minecraft.src.MathHelper.Floor_double(entity.posZ - (double)k) / i + c1 / 2; int j1 = 128 / i; if (world.worldProvider.worldHasSky) { j1 /= 2; } mapdata.field_28159_g++; for (int k1 = (l - j1) + 1; k1 < l + j1; k1++) { if ((k1 & 0xf) != (mapdata.field_28159_g & 0xf)) { continue; } int l1 = 255; int i2 = 0; double d = 0.0D; for (int j2 = i1 - j1 - 1; j2 < i1 + j1; j2++) { if (k1 < 0 || j2 < -1 || k1 >= c || j2 >= c1) { continue; } int k2 = k1 - l; int l2 = j2 - i1; bool flag = k2 * k2 + l2 * l2 > (j1 - 2) * (j1 - 2); int i3 = ((j / i + k1) - c / 2) * i; int j3 = ((k / i + j2) - c1 / 2) * i; int k3 = 0; int l3 = 0; int i4 = 0; int[] ai = new int[256]; net.minecraft.src.Chunk chunk = world.GetChunkFromBlockCoords(i3, j3); int j4 = i3 & 0xf; int k4 = j3 & 0xf; int l4 = 0; double d1 = 0.0D; if (world.worldProvider.worldHasSky) { int i5 = i3 + j3 * 0x389bf; i5 = i5 * i5 * 0x1dd6751 + i5 * 11; if ((i5 >> 20 & 1) == 0) { ai[net.minecraft.src.Block.DIRT.ID] += 10; } else { ai[net.minecraft.src.Block.STONE.ID] += 10; } d1 = 100D; } else { for (int j5 = 0; j5 < i; j5++) { for (int l5 = 0; l5 < i; l5++) { int j6 = chunk.GetHeightValue(j5 + j4, l5 + k4) + 1; int l6 = 0; if (j6 > 1) { bool flag1 = false; do { flag1 = true; l6 = chunk.GetBlockID(j5 + j4, j6 - 1, l5 + k4); if (l6 == 0) { flag1 = false; } else { if (j6 > 0 && l6 > 0 && net.minecraft.src.Block.blocksList[l6].blockMaterial.field_28131_A == net.minecraft.src.MapColor.field_28199_b) { flag1 = false; } } if (!flag1) { j6--; l6 = chunk.GetBlockID(j5 + j4, j6 - 1, l5 + k4); } }while (!flag1); if (l6 != 0 && net.minecraft.src.Block.blocksList[l6].blockMaterial.GetIsLiquid()) { int i7 = j6 - 1; int k7 = 0; do { k7 = chunk.GetBlockID(j5 + j4, i7--, l5 + k4); l4++; }while (i7 > 0 && k7 != 0 && net.minecraft.src.Block.blocksList[k7].blockMaterial. GetIsLiquid()); } } d1 += (double)j6 / (double)(i * i); ai[l6]++; } } } l4 /= i * i; k3 /= i * i; l3 /= i * i; i4 /= i * i; int k5 = 0; int i6 = 0; for (int k6 = 0; k6 < 256; k6++) { if (ai[k6] > k5) { i6 = k6; k5 = ai[k6]; } } double d2 = ((d1 - d) * 4D) / (double)(i + 4) + ((double)(k1 + j2 & 1) - 0.5D) * 0.40000000000000002D; byte byte0 = 1; if (d2 > 0.59999999999999998D) { byte0 = 2; } if (d2 < -0.59999999999999998D) { byte0 = 0; } int j7 = 0; if (i6 > 0) { net.minecraft.src.MapColor mapcolor = net.minecraft.src.Block.blocksList[i6].blockMaterial .field_28131_A; if (mapcolor == net.minecraft.src.MapColor.field_28187_n) { double d3 = (double)l4 * 0.10000000000000001D + (double)(k1 + j2 & 1) * 0.20000000000000001D; byte0 = 1; if (d3 < 0.5D) { byte0 = 2; } if (d3 > 0.90000000000000002D) { byte0 = 0; } } j7 = mapcolor.field_28184_q; } d = d1; if (j2 < 0 || k2 * k2 + l2 * l2 >= j1 * j1 || flag && (k1 + j2 & 1) == 0) { continue; } byte byte1 = mapdata.field_28160_f[k1 + j2 * c]; byte byte2 = unchecked ((byte)(j7 * 4 + byte0)); if (byte1 == byte2) { continue; } if (l1 > j2) { l1 = j2; } if (i2 < j2) { i2 = j2; } mapdata.field_28160_f[k1 + j2 * c] = byte2; } if (l1 <= i2) { mapdata.Func_28153_a(k1, l1, i2); } } }
/// <exception cref="System.IO.IOException"/> public virtual void SaveExtraChunkData(net.minecraft.src.World world, net.minecraft.src.Chunk chunk) { }
public static net.minecraft.src.Chunk LoadChunkIntoWorldFromCompound(net.minecraft.src.World world, net.minecraft.src.NBTTagCompound nbttagcompound) { int i = nbttagcompound.GetInteger("xPos"); int j = nbttagcompound.GetInteger("zPos"); net.minecraft.src.Chunk chunk = new net.minecraft.src.Chunk(world, i, j); chunk.blocks = nbttagcompound.GetByteArray("Blocks"); chunk.data = new net.minecraft.src.NibbleArray(nbttagcompound.GetByteArray("Data" )); chunk.skylightMap = new net.minecraft.src.NibbleArray(nbttagcompound.GetByteArray ("SkyLight")); chunk.blocklightMap = new net.minecraft.src.NibbleArray(nbttagcompound.GetByteArray ("BlockLight")); chunk.heightMap = nbttagcompound.GetByteArray("HeightMap"); chunk.isTerrainPopulated = nbttagcompound.GetBoolean("TerrainPopulated"); if (!chunk.data.IsValid()) { chunk.data = new net.minecraft.src.NibbleArray(chunk.blocks.Length); } if (chunk.heightMap == null || !chunk.skylightMap.IsValid()) { chunk.heightMap = new byte[256]; chunk.skylightMap = new net.minecraft.src.NibbleArray(chunk.blocks.Length); chunk.Func_353_b(); } if (!chunk.blocklightMap.IsValid()) { chunk.blocklightMap = new net.minecraft.src.NibbleArray(chunk.blocks.Length); chunk.Func_348_a(); } net.minecraft.src.NBTTagList nbttaglist = nbttagcompound.GetTagList("Entities"); if (nbttaglist != null) { for (int k = 0; k < nbttaglist.TagCount(); k++) { net.minecraft.src.NBTTagCompound nbttagcompound1 = (net.minecraft.src.NBTTagCompound )nbttaglist.TagAt(k); net.minecraft.src.Entity entity = net.minecraft.src.EntityList.CreateEntityFromNBT (nbttagcompound1, world); chunk.hasEntities = true; if (entity != null) { chunk.AddEntity(entity); } } } net.minecraft.src.NBTTagList nbttaglist1 = nbttagcompound.GetTagList("TileEntities" ); if (nbttaglist1 != null) { for (int l = 0; l < nbttaglist1.TagCount(); l++) { net.minecraft.src.NBTTagCompound nbttagcompound2 = (net.minecraft.src.NBTTagCompound )nbttaglist1.TagAt(l); net.minecraft.src.TileEntity tileentity = net.minecraft.src.TileEntity.CreateAndLoadEntity (nbttagcompound2); if (tileentity != null) { chunk.AddTileEntity(tileentity); } } } return(chunk); }