Beispiel #1
0
    /// <summary>
    /// Updates the block of a chunk described by the given block update parameters.
    /// </summary>
    /// <param name="blockUpdate">The parameters of which block to update and what to update it to.</param>
    private static void ApplyBlockUpdate(Block.BlockUpdate blockUpdate)
    {
        Vector3Int chunkPos    = blockUpdate.WorldPos.WorldPosToChunkPos();
        Vector3Int internalPos = blockUpdate.WorldPos.WorldPosToInternalPos();

        if (TryGetChunk(chunkPos, out Chunk chunk) == true && chunk.HasGeneratedChunkData == true)
        {
            chunk.PlaceBlock(internalPos, blockUpdate.Block);
        }
    }
Beispiel #2
0
 /// <summary>
 /// Sets the block using the given block update parameters.
 /// </summary>
 /// <param name="blockUpdate">The block update parameters containing a world position and a block type.</param>
 private void ApplyBlockUpdate(Block.BlockUpdate blockUpdate)
 {
     this.SetBlock(blockUpdate.WorldPos.WorldPosToInternalPos(), blockUpdate.Block);
 }
Beispiel #3
0
 /// <summary>
 /// Adds an action to the queue for the world thread to run.
 /// </summary>
 /// <param name="action">The action to add.</param>
 public static void AddBlockUpdateToQueue(Block.BlockUpdate blockUpdate)
 {
     blockUpdateQueue.Enqueue(blockUpdate);
 }
 public BlockUpdateSaveData(Block.BlockUpdate blockUpdate)
 {
     this.WorldPos = new Vector3IntSaveData(blockUpdate.WorldPos);
     this.ID       = blockUpdate.Block.ID;
 }