public GenOreBlockManager(IChunkManager bm, OregenOptions o) : base(bm) { opt = o; IChunk c = null; if (bm is AlphaChunkManager) { c = AlphaChunk.Create(0, 0); } else { c = AnvilChunk.Create(0, 0); } chunkXDim = c.Blocks.XDim; chunkYDim = c.Blocks.YDim; chunkZDim = c.Blocks.ZDim; chunkXMask = chunkXDim - 1; chunkYMask = chunkYDim - 1; chunkZMask = chunkZDim - 1; chunkXLog = Log2(chunkXDim); chunkYLog = Log2(chunkYDim); chunkZLog = Log2(chunkZDim); }
public static void SetBiomeData(string dest) { NbtWorld world = NbtWorld.Open(dest); IChunkManager cm = world.GetChunkManager(); foreach (ChunkRef chunk in cm) { AnvilChunk anvil_chunk = chunk.GetChunkRef() as AnvilChunk; TagNodeByteArray biomeNode = anvil_chunk.Tree.Root["Level"].ToTagCompound()["Biomes"].ToTagByteArray(); ZXByteArray biomeData = new ZXByteArray(16, 16, biomeNode.Data); for (int x = 0; x <= 15; x++) { for (int y = 0; y <= 15; y++) { biomeData[x, y] = biomes[chunk.X + "." + chunk.Z]; } } chunk.SetChunkRef(anvil_chunk); cm.Save(); } world.Save(); }
public new static AnvilChunk Load(AnvilChunkManager manager, TagCompound compound) { if (compound == null || !compound.ContainsKey("Level")) { return(null); } if (compound.ContainsKey("DataVersion") && compound.GetInt("DataVersion") < BorderVersion) { return(AnvilChunk.Load(manager, compound)); } TagCompound level = compound["Level"] as TagCompound; int cx = level.GetInt("xPos"); int cy = level.GetInt("zPos"); AnvilChunkImproved c = new AnvilChunkImproved(manager, new ChunkCoord(cx, cy)); if (compound.ContainsKey("DataVersion")) { c._dataVersion = compound.GetInt("DataVersion"); } c._status = ChunkStatusHelper.Parse(level.GetString("Status")); //c.InhabitedTime = tag.GetLong("InhabitedTime"); TagList sections = (TagList)level["Sections"]; c._sections = new AnvilSection[SectionsPerChunk]; for (int i = 0; i < sections.Count; i++) { TagCompound sec = sections[i] as TagCompound; if (sec == null) { continue; } c._sections[i] = new AnvilSectionImproved(sec.GetByte("Y"), true); c._sections[i].Load(sec); } if (level.ContainsKey("Biomes", TagType.IntArray)) { c._biomes = level.GetIntArray("Biomes"); } if (level.ContainsKey("Heightmaps")) { foreach (TagLongArray t in (TagCompound)level["Heightmaps"]) { c._heightMaps.Add(t.Name, new HeightMap(t.Name, t.Value)); } } if (level.ContainsKey("CarvingMasks")) { TagCompound tag = (TagCompound)level["CarvingMasks"]; if (tag.ContainsKey("AIR")) { c._carvingMaskAir = tag.GetByteArray("AIR"); } if (tag.ContainsKey("LIQUID")) { c._carvingMaskLiquid = tag.GetByteArray("LIQUID"); } } if (level.ContainsKey("Structures")) { c._structures = (TagCompound)level["Structures"]; } for (int i = 0; i < ListOfList.Length; i++) { if (level.ContainsKey(ListOfList[i])) { c._lists.Add(ListOfList[i], (TagList)level[ListOfList[i]]); } } TagList entities = (TagList)level["Entities"]; foreach (TagCompound t in entities) { c.Entities.Add(t); } TagList tiles = (TagList)level["TileEntities"]; foreach (TagCompound t in tiles) { int x = t.GetInt("x"); int y = t.GetInt("y"); int z = t.GetInt("z"); c._tileEntities.Add(new BlockPos(x, y, z), t); } return(c); }