//private readonly object lockObj = new object(); public ChunkSection(string defaultBlock) { palette = new List <BlockState>(); if (defaultBlock != null) { palette.Add(new BlockState(BlockList.Find("minecraft:air"))); //Index 0 palette.Add(new BlockState(BlockList.Find(defaultBlock))); //Index 1 } }
///<summary>Gets the block type at the given location.</summary> public ProtoBlock GetBlock(int x, int y, int z) { var chunk = GetChunk(x, z, false); if (chunk != null) { return(chunk.GetBlockAt(x % 16, y, z % 16)?.block ?? BlockList.Find("minecraft:air")); } else { return(null); } }
///<summary>Sets the block type at the given location.</summary> public bool SetBlock(int x, int y, int z, string block) { return(SetBlock(x, y, z, new BlockState(BlockList.Find(block)))); }