public static BaseBlock LoadBlockFromXml(XmlElement element, BlockEditor blockEditor) { GCommand command = BlockUtils.LoadGCommand(element); ObjectCallBlock block = new ObjectCallBlock(command); XmlNodeList elementList = element.SelectNodes("Holes/Hole"); for (int i = 0; i < block.HoleList.Count; i++) { BlockUtils.ConnectToHole(block.HoleList[i], LoadBlock(elementList[i].SelectSingleNode("Block") as XmlElement, blockEditor)); } return(block); }
public static BaseBlock LoadBlockFromXml(XmlElement element, BlockEditor blockEditor) { GCommand command = BlockUtils.LoadGCommand(element); VoidCallBlock block = new VoidCallBlock(command); XmlNodeList elementList = element.SelectNodes("Holes/Hole"); var holeList = block.HoleList.Where(e => !(e is NextConnectHole)); for (int i = 0; i < holeList.Count(); i++) { BlockUtils.ConnectToHole(block.HoleList[i], LoadBlock(elementList[i].SelectSingleNode("Block") as XmlElement, blockEditor)); } return(block); }
public JsValue CreateThis(CpuBlock c, JsValue thizArg, JsValue[] args) { var thiz = ((ObjectInstance)thizArg); var instf = InstanceFields; for (int i = 0; i < 3; ++i) { if (i >= args.Length) { return(thizArg); } float value = BlockUtils.TryGetFloat(args[i], out value) ? value : 0; thiz.Set(instf[i].Name, value); } return(thizArg); }
public void Execute() { for (int i = 0; i < 16 * 22 * 16; i++) { treeBlocks[i] = Block.air; } for (int i = 0; i < trees.Length; i++) { uint hash = Hash((uint)(i + trees[i].x * 1007 + trees[i].y * 53 + trees[i].z)) % 1000; if ((hash > 10 && hash < 15) || (hash > 100 && hash < 105)) { GenerateTree(new Vector3(trees[i].x, trees[i].y, trees[i].z)); } } for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { for (int y = 0; y < 22; y++) { Block block = treeBlocks[BlockUtils.GetBlockIndex16x22x16(new int3(x, y, z))]; if (block.IsEmpty()) { continue; } // Loop all posible directions on cube and if // the next block in the direction is not empty, // save UVs to mesh data for (int i = 0; i < 6; i++) { if (Check(BlockUtils.GetPositionInDirection((Directions)i, x, y, z)) && ((Directions)i != Directions.Down || block != Block.tree)) { CreateFace((Directions)i, new int3(x, y, z)); meshData.uvs.Add(blockData.uvs[(int)block][0]); meshData.uvs.Add(blockData.uvs[(int)block][1]); meshData.uvs.Add(blockData.uvs[(int)block][2]); meshData.uvs.Add(blockData.uvs[(int)block][3]); } } } } } }
public static void Set(User user, string pTypeName) { try { WorldEditUserData weud = WorldEditManager.GetUserData(user.Name); if (weud.FirstPos == null || weud.SecondPos == null) { user.Player.SendTemporaryMessage($"Please set both Points with the Wand Tool first!"); return; } Type blockType = BlockUtils.GetBlockType(pTypeName); if (blockType == null) { user.Player.SendTemporaryMessage($"No BlockType with name {pTypeName} found!"); return; } var vectors = weud.GetSortedVectors(); weud.StartEditingBlocks(); long changedBlocks = 0; for (int x = vectors.Lower.X; x != vectors.Higher.X; x = (x + 1) % Shared.Voxel.World.VoxelSize.X) { for (int y = vectors.Lower.Y; y < vectors.Higher.Y; y++) { for (int z = vectors.Lower.Z; z != vectors.Higher.Z; z = (z + 1) % Shared.Voxel.World.VoxelSize.Z) { var pos = new Vector3i(x, y, z); weud.AddBlockChangedEntry(Eco.World.World.GetBlock(pos), pos); WorldEditManager.SetBlock(blockType, pos); changedBlocks++; } } } user.Player.SendTemporaryMessage($"{changedBlocks} blocks changed."); } catch (Exception e) { AsphaltLog.WriteError(e.ToStringPretty()); } }
public override void BuildFace(Chunk chunk, Vector3[] vertices, Color32[] palette, ref BlockFace face, bool rotated) { bool backFace = DirectionUtils.IsBackface(face.side); int d = DirectionUtils.Get(face.side); LocalPools pools = chunk.pools; var verts = pools.Vector3ArrayPool.PopExact(4); var cols = pools.Color32ArrayPool.PopExact(4); { if (vertices == null) { Vector3 pos = face.pos; verts[0] = pos + BlockUtils.PaddingOffsets[d][0]; verts[1] = pos + BlockUtils.PaddingOffsets[d][1]; verts[2] = pos + BlockUtils.PaddingOffsets[d][2]; verts[3] = pos + BlockUtils.PaddingOffsets[d][3]; cols[0] = colors[d]; cols[1] = colors[d]; cols[2] = colors[d]; cols[3] = colors[d]; } else { verts[0] = vertices[0]; verts[1] = vertices[1]; verts[2] = vertices[2]; verts[3] = vertices[3]; cols[0] = colors[d]; cols[1] = colors[d]; cols[2] = colors[d]; cols[3] = colors[d]; } BlockUtils.AdjustColors(chunk, cols, face.light); RenderGeometryBatcher batcher = chunk.GeometryHandler.Batcher; batcher.AddFace(face.materialID, verts, cols, backFace); } pools.Color32ArrayPool.Push(cols); pools.Vector3ArrayPool.Push(verts); }
public void Configure() { AutoMapper.Mapper.Initialize(cfg => { cfg.CreateMap <Block, BlockViewModel>() .ForMember(dest => dest.Block, opts => opts.MapFrom( src => src )) .ForMember(dest => dest.TorrentInfo, opts => opts.MapFrom( src => BlockUtils.GetTorrentInformation(src) )) .ForMember(dest => dest.MagnetLink, opts => opts.MapFrom( src => BlockUtils.GetTorrentInformation(src).GetMagnetLink(BencodeNET.Torrents.MagnetLinkOptions.IncludeTrackers) )) .ReverseMap(); }); }
/// <summary> /// Multiply vector3 by scalar /// </summary> /// <param name="c"></param> /// <param name="thizArg"></param> /// <param name="x"></param> /// <returns> /// The result of a vector3 multiplied by scalar. /// </returns> public JsValue VecMul(CpuBlock c, JsValue thizArg, JsValue[] x) { if (x.Length < 1) { throw new Exception("Invalid value"); } var vobj = ((ObjectInstance)thizArg); float f; if (!BlockUtils.TryGetFloat(x[0], out f)) { throw new Exception("Invalid value"); } Vector3 v = BlockUtils.ToVector3(vobj); return(BlockUtils.Vec2Obj(c, v * f)); }
public void Execute() { for (int x = 1; x < 17; x++) { for (int z = 1; z < 17; z++) { for (int y = 1; y < 17; y++) { Block block = chunkData.blocks[BlockUtils.GetBlockIndex(new int3(x, y, z))]; if (block.IsEmpty()) { continue; } // Loop all posible directions on cube and if // the next block in the direction is not empty, // save UVs to mesh data for (int i = 0; i < 6; i++) { if (Check(BlockUtils.GetPositionInDirection((Directions)i, x, y, z))) { CreateFace((Directions)i, new int3(x - 1, y - 1, z - 1)); if (block == Block.dirt && i == (int)Directions.Up) { meshData.uvs.Add(blockData.uvs[(int)Block.grass][0]); meshData.uvs.Add(blockData.uvs[(int)Block.grass][1]); meshData.uvs.Add(blockData.uvs[(int)Block.grass][2]); meshData.uvs.Add(blockData.uvs[(int)Block.grass][3]); } else { meshData.uvs.Add(blockData.uvs[(int)block][0]); meshData.uvs.Add(blockData.uvs[(int)block][1]); meshData.uvs.Add(blockData.uvs[(int)block][2]); meshData.uvs.Add(blockData.uvs[(int)block][3]); } } } } } } }
static void CheckBlocks() { var r0 = BlockUtils.HasAnyBlock(replyGet1000); System.Console.WriteLine($"HasAnyBlock: {r0}"); var r1 = BlockUtils.HasAnyBlock(replyGet1000.Split(BlockUtils.LF)); System.Console.WriteLine($"HasAnyBlock: {r1}"); var blocks1 = BlockUtils.GetBlocks(replyGet1000); System.Console.WriteLine($"Blocks: {blocks1.Count}"); var r2 = BlockUtils.HasAnyBlock(eventList); System.Console.WriteLine($"HasAnyBlock: {r2}"); var blocks2 = BlockUtils.GetBlocks(eventList); System.Console.WriteLine($"Blocks: {blocks2.Count}"); }
internal Transaction CreateCoinbaseTransaction(int height, byte[] recipient) { var transaction = new Transaction { Timestamp = DateTime.UtcNow, InEntries = new List <InEntry>(), OutEntries = new List <OutEntry> { new OutEntry { Amount = BlockUtils.GetCoinbaseAmount(height: 0), RecipientHash = ReadonlyBytes.CopyFrom(recipient), }, }, }; var data = transaction.Original = MessagePack.MessagePackSerializer.Serialize(transaction); transaction.Id = ReadonlyBytes.CopyFrom(BlockUtils.ComputeTransactionId(data)); return(transaction); }
private void EventName_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (EventName.SelectedItem != null) { SelectedEvent = (GExport)EventName.SelectedItem; AllowVariableList.Clear(); ParameterBox.Children.Clear(); for (int i = 0; i < SelectedEvent.Optionals?.Length; i++) { VariableBlock variableBlock = BlockUtils.CreateVariableBlock(SelectedEvent.Optionals[i].Name, SelectedEvent.Optionals[i].FriendlyName); BaseBlock baseBlock = variableBlock as BaseBlock; baseBlock.MouseLeftButtonDown += BaseBlock_MouseLeftButtonDown; AllowVariableList.Add(variableBlock); ParameterBox.Children.Add(baseBlock); } } }
/// <summary> /// Multiply quaternion with either another quaternion or a 3d vector. /// </summary> /// <returns> /// Vector if second argument is vector and quaternion if second argument is quaternion /// </returns> public JsValue QuatMult(CpuBlock c, JsValue thizArg, JsValue[] x) { if (x.Length < 1) { throw new Exception("Invalid value"); } var q1obj = ((ObjectInstance)thizArg); var q2obj = ((ObjectInstance)x[0]); var q1 = BlockUtils.ToQuat(q1obj); if (q2obj.HasProperty("w")) { var q2 = BlockUtils.ToQuat(q2obj); return(BlockUtils.Quat2Obj(c, q1 * q2)); } else { var v = BlockUtils.ToVector3(q2obj); return(BlockUtils.Vec2Obj(c, q1 * v)); } }
public override void BuildFace(Chunk chunk, Vector3[] vertices, Color32[] palette, ref BlockFace face, bool rotated) { bool backface = DirectionUtils.IsBackface(face.side); int d = DirectionUtils.Get(face.side); var pools = Globals.WorkPool.GetPool(chunk.ThreadID); var verts = pools.Vector3ArrayPool.PopExact(4); var uvs = pools.Vector2ArrayPool.PopExact(4); var cols = pools.Color32ArrayPool.PopExact(4); { if (vertices == null) { Vector3 pos = face.pos; verts[0] = pos + BlockUtils.PaddingOffsets[d][0]; verts[1] = pos + BlockUtils.PaddingOffsets[d][1]; verts[2] = pos + BlockUtils.PaddingOffsets[d][2]; verts[3] = pos + BlockUtils.PaddingOffsets[d][3]; } else { verts[0] = vertices[0]; verts[1] = vertices[1]; verts[2] = vertices[2]; verts[3] = vertices[3]; } BlockUtils.PrepareTexture(chunk, ref face.pos, uvs, face.side, textures, rotated); BlockUtils.PrepareColors(chunk, cols, face.light); RenderGeometryBatcher batcher = chunk.RenderGeometryHandler.Batcher; batcher.AddFace(face.materialID, verts, cols, uvs, backface); } pools.Color32ArrayPool.Push(cols); pools.Vector2ArrayPool.Push(uvs); pools.Vector3ArrayPool.Push(verts); }
void Update() { if (Active && !PieceSettled) { var objectDown = BlockUtils.HitTestObjectChildren(transform, Vector3.down); if (objectDown != null) { Boundary boundary = objectDown.GetComponent <Boundary>(); if (boundary == null || boundary.Type == Boundary.BoundaryType.Floor) { Board.PieceLanded = true; } else { Board.PieceLanded = false; } } else { Board.PieceLanded = false; } } }
static void ParseBlocks() { var oneBlock = BlockUtils.GetBlocks(replyGet1000); var b0 = oneBlock[0]; System.Console.WriteLine($"Start: {b0.StartLine}"); foreach (var entry in b0.ListEntries) { System.Console.WriteLine($" Entry: {entry.OriginalLine}"); } System.Console.WriteLine($"End: {b0.EndLine}"); var fourBlocks = BlockUtils.GetBlocks(eventList); foreach (var evBlock in fourBlocks) { if (evBlock == null) { continue; } System.Console.WriteLine($"Object ID: {evBlock.ObjectId}"); } }
private void S88COnMessageReceived(object sender, MessageEventArgs ev) { if (string.IsNullOrEmpty(ev.Message)) { return; } if (BlockUtils.HasAnyBlock(ev.Message)) { _s88Lines.Clear(); _s88Lines.AddRange(ev.Message.Split(new[] { '\r' }, StringSplitOptions.RemoveEmptyEntries)); } else { _s88Lines.Add(ev.Message.Trim()); } if (BlockUtils.HasAnyBlock(_s88Lines)) { var blocks = BlockUtils.GetBlocks(_s88Lines); HandleBlocksS88(blocks); _s88Lines.Clear(); } }
protected override void SaveBlockAttribute(XmlWriter writer) { writer.WriteAttributeString("FunctionName", GFunction.FunctionName); BlockUtils.SaveChildBlocks(writer, NextConnectHole.AttachedBlock); }
public override void BuildBlock(Chunk chunk, ref Vector3Int localPos, int materialID) { var pools = Globals.WorkPool.GetPool(chunk.ThreadID); RenderGeometryBatcher batcher = chunk.RenderGeometryHandler.Batcher; // Using the block positions hash is much better for random numbers than saving the offset and height in the block data int hash = localPos.GetHashCode(); float blockHeight = (hash & 63) * coef * Env.BlockSize; hash *= 39; float offsetX = (hash & 63) * coef * Env.BlockSizeHalf - Env.BlockSizeHalf * 0.5f; hash *= 39; float offsetZ = (hash & 63) * coef * Env.BlockSizeHalf - Env.BlockSizeHalf * 0.5f; // Converting the position to a vector adjusts it based on block size and gives us real world coordinates for x, y and z Vector3 vPos = localPos; vPos += new Vector3(offsetX, 0, offsetZ); float x1 = vPos.x - BlockUtils.blockPadding; float x2 = vPos.x + BlockUtils.blockPadding + Env.BlockSize; float y1 = vPos.y - BlockUtils.blockPadding; float y2 = vPos.y + BlockUtils.blockPadding + blockHeight; float z1 = vPos.z - BlockUtils.blockPadding; float z2 = vPos.z + BlockUtils.blockPadding + Env.BlockSize; var verts = pools.Vector3ArrayPool.PopExact(4); var uvs = pools.Vector2ArrayPool.PopExact(4); var colors = pools.Color32ArrayPool.PopExact(4); BlockUtils.PrepareTexture(chunk, ref localPos, uvs, Direction.north, texture, false); // TODO: How do I make sure that if I supply no color value, white is used? // TODO: These colors could be removed and memory would be saved { colors[0] = new Color32(255, 255, 255, 255); colors[1] = new Color32(255, 255, 255, 255); colors[2] = new Color32(255, 255, 255, 255); colors[3] = new Color32(255, 255, 255, 255); } { verts[0] = new Vector3(x1, y1, z2); verts[1] = new Vector3(x1, y2, z2); verts[2] = new Vector3(x2, y2, z1); verts[3] = new Vector3(x2, y1, z1); batcher.AddFace(materialID, verts, colors, uvs, false); } { verts[0] = new Vector3(x2, y1, z1); verts[1] = new Vector3(x2, y2, z1); verts[2] = new Vector3(x1, y2, z2); verts[3] = new Vector3(x1, y1, z2); batcher.AddFace(materialID, verts, colors, uvs, false); } { verts[0] = new Vector3(x2, y1, z2); verts[1] = new Vector3(x2, y2, z2); verts[2] = new Vector3(x1, y2, z1); verts[3] = new Vector3(x1, y1, z1); batcher.AddFace(materialID, verts, colors, uvs, false); } { verts[0] = new Vector3(x1, y1, z1); verts[1] = new Vector3(x1, y2, z1); verts[2] = new Vector3(x2, y2, z2); verts[3] = new Vector3(x2, y1, z2); batcher.AddFace(materialID, verts, colors, uvs, false); } pools.Color32ArrayPool.Push(colors); pools.Vector2ArrayPool.Push(uvs); pools.Vector3ArrayPool.Push(verts); }
// Find a zero of a real or complex function using the Newton-Raphson // (or secant or Halley’s) method. // // Math.newton(func, x0, fprime=null, tol=1.48e-08, maxiter=50, fprime2=null, // x1, rtol=0.0, full_output=false) // // Mimicks scipy's implementation of scipy.optimize.newton // // Parameters // func: function // The function whose zero is wanted. It must be a function of a // single variable // x0: float // An initial estimate of the zero that should be somewhere near // the actual zero. // fprime : function, optional // The derivative of the function when available and convenient. If it // is null (default), then the secant method is used. // tol : float, optional // The allowable error of the zero value. // maxiter : int, optional // Maximum number of iterations. // fprime2 : function, optional // The second order derivative of the function when available and // convenient. If it is null (default), then the normal Newton-Raphson // or the secant method is used. If it is not null, then Halley's method // is used. // x1 : float, optional // Another estimate of the zero that should be somewhere near the // actual zero. Used if `fprime` is not provided. // rtol : float, optional // Tolerance (relative) for termination. // full_output : bool, optional // If `full_output` is false (default), the root is returned. // If true, the dictionary {{"root": root}, {"converged": true/false}, // {"iter": numIter}} is returned. public JsValue Newton(CpuBlock cpu, JsValue ctx, JsValue[] x) { var eng = cpu.Interp; int l = x.Length; // Arguments and their default values: FunctionInstance func; float x0; JsValue fprime = null; float tol = 1.48e-08F; long maxiter = 50; JsValue fprime2 = null; float x1 = 0; float rtol = 0.0F; bool full_output = false; bool x1Provided = false; JsValue[] args = new JsValue[1]; if (l < 2) { throw new Exception("Invalid value"); } // Conditionally initialize the arguments void Parse() { int curArgIndex = 0; func = x[curArgIndex++] as FunctionInstance; if (!BlockUtils.TryGetFloat(x[curArgIndex++], out x0)) { throw new Exception("Invalid value"); } if (curArgIndex >= l) { return; } fprime = x[curArgIndex++]; if (curArgIndex >= l) { return; } if (!BlockUtils.TryGetFloat(x[curArgIndex++], out tol)) { throw new Exception("Invalid value"); } if (curArgIndex >= l) { return; } if (!BlockUtils.TryGetLong(x[curArgIndex++], out maxiter)) { throw new Exception("Invalid value"); } if (curArgIndex >= l) { return; } fprime2 = x[curArgIndex++]; if (curArgIndex >= l) { return; } x1Provided = BlockUtils.TryGetFloat(x[curArgIndex++], out x1); if (curArgIndex >= l) { return; } if (!BlockUtils.TryGetFloat(x[curArgIndex++], out rtol)) { throw new Exception("Invalid value"); } if (curArgIndex >= l) { return; } full_output = BlockUtils.GetBool(x[curArgIndex++]); } Parse(); if (tol <= 0) { throw new Exception("tol too small (" + tol + " <= 0)"); } if (maxiter < 1) { throw new Exception("maxiter must be greater than 0"); } float p0 = x0; long itr = 0; float p = 0; if (fprime is FunctionInstance fprimeFunc) { // Newton - Raphson method for (; itr < maxiter; ++itr) { // first evaluate fval args[0] = p0; float fval = (float)TypeConverter.ToNumber(func.Call(ctx, args)); // if fval is 0, a root has been found, then terminate if (fval == 0) { return(_newton_result_select(eng, full_output, p0, itr, converged: true)); } float fder = (float)TypeConverter.ToNumber(fprimeFunc.Call(ctx, args)); // stop iterating if the derivative is zero if (fder == 0) { return(_newton_result_select(eng, full_output, p0, itr + 1, converged: false)); } // Newton step float newton_step = fval / fder; if (fprime2 is FunctionInstance fp2func) { float fder2 = (float)TypeConverter.ToNumber(fp2func.Call(ctx, args)); // Halley's method: // newton_step /= (1.0 - 0.5 * newton_step * fder2 / fder) // Only do it if denominator stays close enough to 1 // Rationale: If 1-adj < 0, then Halley sends x in the // opposite direction to Newton. Doesn't happen if x is close // enough to root. float adj = newton_step * fder2 / fder / 2; if (Math.Abs(adj) < 1) { newton_step /= 1.0F - adj; } } p = p0 - newton_step; if (WithinTol(p, p0, atol: tol, rtol: rtol)) { return(_newton_result_select(eng, full_output, p, itr + 1, converged: true)); } p0 = p; } } else { // secant method float p1, q0, q1; if (x1Provided) { if (x1 == x0) { throw new Exception("x1 and x0 must be different"); } p1 = x1; } else { float eps = 1e-4F; p1 = x0 * (1 + eps); p1 += (p1 >= 0 ? eps : -eps); } args[0] = p0; q0 = (float)TypeConverter.ToNumber(func.Call(ctx, args)); args[0] = p1; q1 = (float)TypeConverter.ToNumber(func.Call(ctx, args)); if (Math.Abs(q1) < Math.Abs(q0)) { float temp = q1; q1 = q0; q0 = temp; temp = p0; p0 = p1; p1 = temp; } for (; itr < maxiter; ++itr) { if (q0 == q1) { p = (p1 + p0) / 2.0F; if (p1 != p0) { return(_newton_result_select(eng, full_output, p, itr + 1, converged: false)); } else { return(_newton_result_select(eng, full_output, p, itr + 1, converged: true)); } } else { // Secant Step if (Math.Abs(q1) > Math.Abs(q0)) { p = (-q0 / q1 * p1 + p0) / (1.0F - q0 / q1); } else { p = (-q1 / q0 * p0 + p1) / (1.0F - q1 / q0); } } if (WithinTol(p, p1, atol: tol, rtol: rtol)) { return(_newton_result_select(eng, full_output, p, itr + 1, converged: true)); } p0 = p1; q0 = q1; p1 = p; args[0] = p1; q1 = (float)TypeConverter.ToNumber(func.Call(ctx, args)); } } return(_newton_result_select(eng, full_output, p, itr + 1, converged: false)); }
void OnDrawGizmos() { Gizmos.DrawSphere(BlockUtils.GetCenter(gameObject), 1); }
public static BaseBlock LoadBlockFromXml(XmlElement element, BlockEditor blockEditor) { var command = BlockUtils.LoadGCommand(element); return(new EnumBlock(command)); }
protected override void SaveBlockAttribute(XmlWriter writer) { BlockUtils.SaveGCommand(writer, GCommand); }
private bool Check(int3 position) { return(chunkData.blocks[BlockUtils.GetBlockIndex(position)].IsEmpty()); }
public static void Replace(User user, string pTypeNames = "") { try { string[] splitted = pTypeNames.Split(' '); string toFind = splitted[0].ToLower(); string toReplace = string.Empty; if (splitted.Length >= 2) { toReplace = pTypeNames.Split(' ')[1].ToLower(); } WorldEditUserData weud = WorldEditManager.GetUserData(user.Name); if (weud.FirstPos == null || weud.SecondPos == null) { user.Player.SendTemporaryMessage($"Please set both points with the Wand Tool first!"); return; } Type blockTypeToFind = BlockUtils.GetBlockType(toFind); if (blockTypeToFind == null) { user.Player.SendTemporaryMessage($"No BlockType with name {toFind} found!"); return; } Type blockTypeToReplace = null; if (toReplace != string.Empty) { blockTypeToReplace = BlockUtils.GetBlockType(toReplace); if (blockTypeToReplace == null) { user.Player.SendTemporaryMessage($"No BlockType with name { toReplace } found!"); return; } } var vectors = weud.GetSortedVectors(); long changedBlocks = 0; //if toReplace is string empty we will replace everything except empty with toFind type weud.StartEditingBlocks(); if (toReplace != string.Empty) { for (int x = vectors.Lower.X; x != vectors.Higher.X; x = (x + 1) % Shared.Voxel.World.VoxelSize.X) { for (int y = vectors.Lower.Y; y < vectors.Higher.Y; y++) { for (int z = vectors.Lower.Z; z != vectors.Higher.Z; z = (z + 1) % Shared.Voxel.World.VoxelSize.Z) { var pos = new Vector3i(x, y, z); var block = Eco.World.World.GetBlock(pos); if (block != null && block.GetType() == blockTypeToFind) { weud.AddBlockChangedEntry(block, pos); WorldEditManager.SetBlock(blockTypeToReplace, pos); changedBlocks++; } } } } } else { for (int x = vectors.Lower.X; x != vectors.Higher.X; x = (x + 1) % Shared.Voxel.World.VoxelSize.X) { for (int y = vectors.Lower.Y; y < vectors.Higher.Y; y++) { for (int z = vectors.Lower.Z; z != vectors.Higher.Z; z = (z + 1) % Shared.Voxel.World.VoxelSize.Z) { var pos = new Vector3i(x, y, z); var block = Eco.World.World.GetBlock(pos); if (block != null && block.GetType() != typeof(EmptyBlock)) { weud.AddBlockChangedEntry(block, pos); WorldEditManager.SetBlock(blockTypeToFind, pos); changedBlocks++; } } } } } user.Player.SendTemporaryMessage($"{changedBlocks} blocks changed."); } catch (Exception e) { AsphaltLog.WriteError(e.ToStringPretty()); } }
protected override void SaveBlockAttribute(XmlWriter writer) { BlockUtils.SaveChildBlocks(writer, ChildConnectHole.AttachedBlock); }
protected override void SaveBlockAttribute(XmlWriter writer) { BlockUtils.SaveChildBlocks(writer, IfChildConnectHole.AttachedBlock, "IfChildBlocks"); BlockUtils.SaveChildBlocks(writer, ElseChildConnectHole.AttachedBlock, "ElseChildBlocks"); }
protected override void BuildBox(Chunk chunk, Block block, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { // Order of vertices when building faces: // 1--2 // | | // | | // 0--3 int sizeWithPadding = m_sideSize + Env.ChunkPadding2; int sizeWithPaddingPow2 = sizeWithPadding * sizeWithPadding; var pools = Globals.WorkPool.GetPool(chunk.ThreadID); var blocks = chunk.Blocks; var listeners = chunk.Neighbors; // Custom blocks have their own rules if (block.Custom) { for (int yy = minY; yy < maxY; yy++) { for (int zz = minZ; zz < maxZ; zz++) { for (int xx = minX; xx < maxX; xx++) { Vector3Int pos = new Vector3Int(xx, yy, zz); block.BuildBlock(chunk, ref pos, block.RenderMaterialID); } } } return; } int n, w, h, l, k, maskIndex; Vector3Int texturePos = new Vector3Int(minX, minY, minZ); Vector3[] face = pools.Vector3ArrayPool.PopExact(4); BlockFace[] mask = pools.BlockFaceArrayPool.PopExact(m_sideSize * m_sideSize); #region Top face if (listeners[(int)Direction.up] != null || // Don't render faces on edges for chunks with no neighbor (SideMask & Side.up) == 0 || maxY != m_sideSize) { Array.Clear(mask, 0, mask.Length); // x axis - width // z axis - height int neighborIndex = Helpers.GetChunkIndex1DFrom3D(minX, maxY, minZ, m_pow); int zOffset = sizeWithPadding - maxX + minX; // Build the mask for (int zz = minZ; zz < maxZ; ++zz, neighborIndex += zOffset) { n = minX + zz * m_sideSize; for (int xx = minX; xx < maxX; ++xx, ++n, ++neighborIndex) { int currentIndex = neighborIndex - sizeWithPaddingPow2; // (xx, maxY-1, zz); Block neighborBlock = blocks.GetBlock(neighborIndex); // Let's see whether we can merge faces if (block.CanBuildFaceWith(neighborBlock)) { mask[n] = new BlockFace { block = block, pos = texturePos, side = Direction.up, light = BlockUtils.CalculateColors(chunk, currentIndex, Direction.up), materialID = block.RenderMaterialID }; } } } // Build faces from the mask if it's possible for (int zz = minZ; zz < maxZ; ++zz) { n = minX + zz * m_sideSize; for (int xx = minX; xx < maxX;) { if (mask[n].block == null) { ++xx; ++n; continue; } // Compute width maskIndex = n + 1; for (w = 1; xx + w < m_sideSize;) { var blk = mask[maskIndex].block; if (blk == null || blk.Type != mask[n].block.Type || !mask[maskIndex].light.Equals(mask[n].light)) { break; } ++w; ++maskIndex; } // Compute height for (h = 1; zz + h < m_sideSize; h++) { maskIndex = n + h * m_sideSize; for (k = 0; k < w; k++, maskIndex++) { var blk = mask[maskIndex].block; if (blk == null || blk.Type != mask[n].block.Type || !mask[maskIndex].light.Equals(mask[n].light)) { goto cont; } } } cont: // Build the face bool rotated = mask[n].light.FaceRotationNecessary; if (!rotated) { face[0] = new Vector3(xx, maxY, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.up][0]; face[1] = new Vector3(xx, maxY, zz + h) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.up][1]; face[2] = new Vector3(xx + w, maxY, zz + h) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.up][2]; face[3] = new Vector3(xx + w, maxY, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.up][3]; } else { face[0] = new Vector3(xx, maxY, zz + h) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.up][1]; face[1] = new Vector3(xx + w, maxY, zz + h) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.up][2]; face[2] = new Vector3(xx + w, maxY, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.up][3]; face[3] = new Vector3(xx, maxY, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.up][0]; } block.BuildFace(chunk, face, Palette, ref mask[n], rotated); // Zero out the mask. We don't need to process the same fields again for (l = 0; l < h; ++l) { maskIndex = n + l * m_sideSize; for (k = 0; k < w; ++k, ++maskIndex) { mask[maskIndex] = new BlockFace(); } } xx += w; n += w; } } } #endregion #region Bottom face if (listeners[(int)Direction.down] != null || // Don't render faces on edges for chunks with no neighbor (SideMask & Side.down) == 0 || minY != 0) { Array.Clear(mask, 0, mask.Length); // x axis - width // z axis - height int currentIndex = Helpers.GetChunkIndex1DFrom3D(minX, minY, minZ, m_pow); int zOffset = sizeWithPadding - maxX + minX; // Build the mask for (int zz = minZ; zz < maxZ; ++zz, currentIndex += zOffset) { n = minX + zz * m_sideSize; for (int xx = minX; xx < maxX; ++xx, ++n, ++currentIndex) { int neighborIndex = currentIndex - sizeWithPaddingPow2; Block neighborBlock = blocks.GetBlock(neighborIndex); // Let's see whether we can merge faces if (block.CanBuildFaceWith(neighborBlock)) { mask[n] = new BlockFace { block = block, pos = texturePos, side = Direction.down, light = BlockUtils.CalculateColors(chunk, currentIndex, Direction.down), materialID = block.RenderMaterialID }; } } } // Build faces from the mask if it's possible for (int zz = minZ; zz < maxZ; ++zz) { n = minX + zz * m_sideSize; for (int xx = minX; xx < maxX;) { if (mask[n].block == null) { ++xx; ++n; continue; } // Compute width maskIndex = n + 1; for (w = 1; xx + w < m_sideSize;) { var blk = mask[maskIndex].block; if (blk == null || blk.Type != mask[n].block.Type || !mask[maskIndex].light.Equals(mask[n].light)) { break; } ++w; ++maskIndex; } // Compute height for (h = 1; zz + h < m_sideSize; h++) { maskIndex = n + h * m_sideSize; for (k = 0; k < w; k++, maskIndex++) { var blk = mask[maskIndex].block; if (blk == null || blk.Type != mask[n].block.Type || !mask[maskIndex].light.Equals(mask[n].light)) { goto cont; } } } cont: // Build the face bool rotated = mask[n].light.FaceRotationNecessary; if (!rotated) { face[0] = new Vector3(xx, minY, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.down][0]; face[1] = new Vector3(xx, minY, zz + h) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.down][1]; face[2] = new Vector3(xx + w, minY, zz + h) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.down][2]; face[3] = new Vector3(xx + w, minY, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.down][3]; } else { face[0] = new Vector3(xx, minY, zz + h) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.down][1]; face[1] = new Vector3(xx + w, minY, zz + h) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.down][2]; face[2] = new Vector3(xx + w, minY, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.down][3]; face[3] = new Vector3(xx, minY, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.down][0]; } block.BuildFace(chunk, face, Palette, ref mask[n], rotated); // Zero out the mask. We don't need to process the same fields again for (l = 0; l < h; ++l) { maskIndex = n + l * m_sideSize; for (k = 0; k < w; ++k, ++maskIndex) { mask[maskIndex] = new BlockFace(); } } xx += w; n += w; } } } #endregion #region Right face if (listeners[(int)Direction.east] != null || // Don't render faces on edges for chunks with no neighbor (SideMask & Side.east) == 0 || maxX != m_sideSize) { Array.Clear(mask, 0, mask.Length); // y axis - height // z axis - width int neighborIndex = Helpers.GetChunkIndex1DFrom3D(maxX, minY, minZ, m_pow); int yOffset = sizeWithPaddingPow2 - (maxZ - minZ) * sizeWithPadding; // Build the mask for (int yy = minY; yy < maxY; ++yy, neighborIndex += yOffset) { n = minZ + yy * m_sideSize; for (int zz = minZ; zz < maxZ; ++zz, ++n, neighborIndex += sizeWithPadding) { int currentIndex = neighborIndex - 1; Block neighborBlock = blocks.GetBlock(neighborIndex); // Let's see whether we can merge faces if (block.CanBuildFaceWith(neighborBlock)) { mask[n] = new BlockFace { block = block, pos = texturePos, side = Direction.east, light = BlockUtils.CalculateColors(chunk, currentIndex, Direction.east), materialID = block.RenderMaterialID }; } } } // Build faces from the mask if it's possible for (int yy = minY; yy < maxY; ++yy) { n = minZ + yy * m_sideSize; for (int zz = minZ; zz < maxZ;) { if (mask[n].block == null) { ++zz; ++n; continue; } // Compute width maskIndex = n + 1; for (w = 1; zz + w < m_sideSize;) { var blk = mask[maskIndex].block; if (blk == null || blk.Type != mask[n].block.Type || !mask[maskIndex].light.Equals(mask[n].light)) { break; } ++w; ++maskIndex; } // Compute height for (h = 1; yy + h < m_sideSize; h++) { maskIndex = n + h * m_sideSize; for (k = 0; k < w; k++, maskIndex++) { var blk = mask[maskIndex].block; if (blk == null || blk.Type != mask[n].block.Type || !mask[maskIndex].light.Equals(mask[n].light)) { goto cont; } } } cont: // Build the face bool rotated = mask[n].light.FaceRotationNecessary; if (!rotated) { face[0] = new Vector3(maxX, yy, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.east][0]; face[1] = new Vector3(maxX, yy + h, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.east][1]; face[2] = new Vector3(maxX, yy + h, zz + w) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.east][2]; face[3] = new Vector3(maxX, yy, zz + w) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.east][3]; } else { face[0] = new Vector3(maxX, yy + h, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.east][1]; face[1] = new Vector3(maxX, yy + h, zz + w) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.east][2]; face[2] = new Vector3(maxX, yy, zz + w) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.east][3]; face[3] = new Vector3(maxX, yy, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.east][0]; } block.BuildFace(chunk, face, Palette, ref mask[n], rotated); // Zero out the mask. We don't need to process the same fields again for (l = 0; l < h; ++l) { maskIndex = n + l * m_sideSize; for (k = 0; k < w; ++k, ++maskIndex) { mask[maskIndex] = new BlockFace(); } } zz += w; n += w; } } } #endregion #region Left face if (listeners[(int)Direction.west] != null || // Don't render faces on edges for chunks with no neighbor (SideMask & Side.west) == 0 || minX != 0) { Array.Clear(mask, 0, mask.Length); // y axis - height // z axis - width int currentIndex = Helpers.GetChunkIndex1DFrom3D(minX, minY, minZ, m_pow); int yOffset = sizeWithPaddingPow2 - (maxZ - minZ) * sizeWithPadding; // Build the mask for (int yy = minY; yy < maxY; ++yy, currentIndex += yOffset) { n = minZ + yy * m_sideSize; for (int zz = minZ; zz < maxZ; ++zz, ++n, currentIndex += sizeWithPadding) { int neighborIndex = currentIndex - 1; Block neighborBlock = blocks.GetBlock(neighborIndex); // Let's see whether we can merge faces if (block.CanBuildFaceWith(neighborBlock)) { mask[n] = new BlockFace { block = block, pos = texturePos, side = Direction.west, light = BlockUtils.CalculateColors(chunk, currentIndex, Direction.west), materialID = block.RenderMaterialID }; } } } // Build faces from the mask if it's possible for (int yy = minY; yy < maxY; ++yy) { n = minZ + yy * m_sideSize; for (int zz = minZ; zz < maxZ;) { if (mask[n].block == null) { ++zz; ++n; continue; } // Compute width maskIndex = n + 1; for (w = 1; zz + w < m_sideSize;) { var blk = mask[maskIndex].block; if (blk == null || blk.Type != mask[n].block.Type || !mask[maskIndex].light.Equals(mask[n].light)) { break; } ++w; ++maskIndex; } // Compute height for (h = 1; yy + h < m_sideSize; h++) { maskIndex = n + h * m_sideSize; for (k = 0; k < w; k++, maskIndex++) { var blk = mask[maskIndex].block; if (blk == null || blk.Type != mask[n].block.Type || !mask[maskIndex].light.Equals(mask[n].light)) { goto cont; } } } cont: // Build the face bool rotated = mask[n].light.FaceRotationNecessary; if (!rotated) { face[0] = new Vector3(minX, yy, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.west][0]; face[1] = new Vector3(minX, yy + h, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.west][1]; face[2] = new Vector3(minX, yy + h, zz + w) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.west][2]; face[3] = new Vector3(minX, yy, zz + w) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.west][3]; } else { face[0] = new Vector3(minX, yy + h, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.west][1]; face[1] = new Vector3(minX, yy + h, zz + w) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.west][2]; face[2] = new Vector3(minX, yy, zz + w) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.west][3]; face[3] = new Vector3(minX, yy, zz) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.west][0]; } block.BuildFace(chunk, face, Palette, ref mask[n], rotated); // Zero out the mask. We don't need to process the same fields again for (l = 0; l < h; ++l) { maskIndex = n + l * m_sideSize; for (k = 0; k < w; ++k, ++maskIndex) { mask[maskIndex] = new BlockFace(); } } zz += w; n += w; } } } #endregion #region Front face if (listeners[(int)Direction.north] != null || // Don't render faces on edges for chunks with no neighbor (SideMask & Side.north) == 0 || maxZ != m_sideSize) { Array.Clear(mask, 0, mask.Length); // x axis - width // y axis - height int neighborIndex = Helpers.GetChunkIndex1DFrom3D(minX, minY, maxZ, m_pow); int yOffset = sizeWithPaddingPow2 - maxX + minX; // Build the mask for (int yy = minY; yy < maxY; ++yy, neighborIndex += yOffset) { n = minX + yy * m_sideSize; for (int xx = minX; xx < maxX; ++xx, ++n, ++neighborIndex) { int currentIndex = neighborIndex - sizeWithPadding; Block neighborBlock = blocks.GetBlock(neighborIndex); // Let's see whether we can merge faces if (block.CanBuildFaceWith(neighborBlock)) { mask[n] = new BlockFace { block = block, pos = texturePos, side = Direction.north, light = BlockUtils.CalculateColors(chunk, currentIndex, Direction.north), materialID = block.RenderMaterialID }; } } } // Build faces from the mask if it's possible for (int yy = minY; yy < maxY; ++yy) { n = minX + yy * m_sideSize; for (int xx = minX; xx < maxX;) { if (mask[n].block == null) { ++xx; ++n; continue; } // Compute width maskIndex = n + 1; for (w = 1; xx + w < m_sideSize;) { var blk = mask[maskIndex].block; if (blk == null || blk.Type != mask[n].block.Type || !mask[maskIndex].light.Equals(mask[n].light)) { break; } ++w; ++maskIndex; } // Compute height for (h = 1; yy + h < m_sideSize; h++) { maskIndex = n + h * m_sideSize; for (k = 0; k < w; k++, maskIndex++) { var blk = mask[maskIndex].block; if (blk == null || blk.Type != mask[n].block.Type || !mask[maskIndex].light.Equals(mask[n].light)) { goto cont; } } } cont: // Build the face bool rotated = mask[n].light.FaceRotationNecessary; if (!rotated) { face[0] = new Vector3(xx, yy, maxZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.north][0]; face[1] = new Vector3(xx, yy + h, maxZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.north][1]; face[2] = new Vector3(xx + w, yy + h, maxZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.north][2]; face[3] = new Vector3(xx + w, yy, maxZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.north][3]; } else { face[0] = new Vector3(xx, yy + h, maxZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.north][1]; face[1] = new Vector3(xx + w, yy + h, maxZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.north][2]; face[2] = new Vector3(xx + w, yy, maxZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.north][3]; face[3] = new Vector3(xx, yy, maxZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.north][0]; } block.BuildFace(chunk, face, Palette, ref mask[n], rotated); // Zero out the mask. We don't need to process the same fields again for (l = 0; l < h; ++l) { maskIndex = n + l * m_sideSize; for (k = 0; k < w; ++k, ++maskIndex) { mask[maskIndex] = new BlockFace(); } } xx += w; n += w; } } } #endregion #region Back face if (listeners[(int)Direction.south] != null || // Don't render faces on edges for chunks with no neighbor (SideMask & Side.south) == 0 || minZ != 0) { Array.Clear(mask, 0, mask.Length); // x axis - width // y axis - height int currentIndex = Helpers.GetChunkIndex1DFrom3D(minX, minY, minZ, m_pow); int yOffset = sizeWithPaddingPow2 - maxX + minX; // Build the mask for (int yy = minY; yy < maxY; ++yy, currentIndex += yOffset) { n = minX + yy * m_sideSize; for (int xx = minX; xx < maxX; ++xx, ++n, ++currentIndex) { int neighborIndex = currentIndex - sizeWithPadding; Block neighborBlock = blocks.GetBlock(neighborIndex); // Let's see whether we can merge faces if (block.CanBuildFaceWith(neighborBlock)) { mask[n] = new BlockFace { block = block, pos = texturePos, side = Direction.south, light = BlockUtils.CalculateColors(chunk, currentIndex, Direction.south), materialID = block.RenderMaterialID }; } } } // Build faces from the mask if it's possible for (int yy = minY; yy < maxY; ++yy) { n = minX + yy * m_sideSize; for (int xx = minX; xx < maxX;) { if (mask[n].block == null) { ++xx; ++n; continue; } // Compute width maskIndex = n + 1; for (w = 1; xx + w < m_sideSize;) { var blk = mask[maskIndex].block; if (blk == null || blk.Type != mask[n].block.Type || !mask[maskIndex].light.Equals(mask[n].light)) { break; } ++w; ++maskIndex; } // Compute height for (h = 1; yy + h < m_sideSize; h++) { maskIndex = n + h * m_sideSize; for (k = 0; k < w; k++, maskIndex++) { var blk = mask[maskIndex].block; if (blk == null || blk.Type != mask[n].block.Type || !mask[maskIndex].light.Equals(mask[n].light)) { goto cont; } } } cont: // Build the face bool rotated = mask[n].light.FaceRotationNecessary; if (!rotated) { face[0] = new Vector3(xx, yy, minZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.south][0]; face[1] = new Vector3(xx, yy + h, minZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.south][1]; face[2] = new Vector3(xx + w, yy + h, minZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.south][2]; face[3] = new Vector3(xx + w, yy, minZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.south][3]; } else { face[0] = new Vector3(xx, yy + h, minZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.south][1]; face[1] = new Vector3(xx + w, yy + h, minZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.south][2]; face[2] = new Vector3(xx + w, yy, minZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.south][3]; face[3] = new Vector3(xx, yy, minZ) * m_scale + BlockUtils.PaddingOffsets[(int)Direction.south][0]; } block.BuildFace(chunk, face, Palette, ref mask[n], rotated); // Zero out the mask. We don't need to process the same fields again for (l = 0; l < h; ++l) { maskIndex = n + l * m_sideSize; for (k = 0; k < w; ++k, ++maskIndex) { mask[maskIndex] = new BlockFace(); } } xx += w; n += w; } } } #endregion pools.BlockFaceArrayPool.Push(mask); pools.Vector3ArrayPool.Push(face); }
public bool FixEntities(int blockID = -1) { if (selectionPrefab == null) { if (Copy() < 1) { Log.Out("Could not Copy Selection"); return(false); } } int width = selectionPrefab.size.x; int height = selectionPrefab.size.y; int length = selectionPrefab.size.z; int startX, startY, startZ; if (start.x < end.x) { startX = start.x; } else { startX = end.x; } if (start.y < end.y) { startY = start.y; } else { startY = end.y; } if (start.z < end.z) { startZ = start.z; } else { startZ = end.z; } Dictionary <int, BlockValue> blockList = new Dictionary <int, BlockValue> (); for (int xOffset = -1; xOffset < width + 2; xOffset++) { for (int zOffset = -1; zOffset < length + 2; zOffset++) { for (int yOffset = -1; yOffset < height + 2; yOffset++) { BlockValue bv = GameManager.Instance.World.GetBlock(startX + xOffset, startY + yOffset, startZ + zOffset); if (bv.type != BlockValue.Air.type) { if (!blockList.ContainsKey(bv.type)) { blockList [bv.type] = bv; } if (bv.type == blockID || bv.type == 1455 || bv.type == 588 || bv.type == 579) { BlockUtils.SetBlock(startX + xOffset, startY + yOffset, startZ + zOffset, "air"); } } } } } foreach (int blockType in blockList.Keys) { SdtdConsole.Instance.Output(blockType.ToString() + " - " + Block.list [blockType].GetBlockName()); } return(true); }