diff --git a/.idea/.idea.Blocktest/.idea/jsonSchemas.xml b/.idea/.idea.Blocktest/.idea/jsonSchemas.xml
new file mode 100644
index 0000000..6f1e7a0
--- /dev/null
+++ b/.idea/.idea.Blocktest/.idea/jsonSchemas.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Blocktest.sln.DotSettings b/Blocktest.sln.DotSettings
index 2c6cd24..7c90753 100644
--- a/Blocktest.sln.DotSettings
+++ b/Blocktest.sln.DotSettings
@@ -1,6 +1,9 @@
True
True
+ True
+ True
True
True
- True
\ No newline at end of file
+ True
+ True
\ No newline at end of file
diff --git a/Blocktest/Code/Block System/BlockSpritesManager.cs b/Blocktest/Code/Block System/BlockSpritesManager.cs
index 49faa06..37e1436 100644
--- a/Blocktest/Code/Block System/BlockSpritesManager.cs
+++ b/Blocktest/Code/Block System/BlockSpritesManager.cs
@@ -1,32 +1,12 @@
+using System.Linq;
using Shared.Code.Block_System;
namespace Blocktest.Block_System;
public sealed class BlockSpritesManager {
/// Array which stores all blocksprites instances for referencing as if they were globals.
- private static BlockSprites[] _allBlocksSprites;
-
- /// List used to store the names of blocks. The indexes are the corresponding block's ID.
- private static string[] _blockSpriteNames;
-
- /// Array which stores all blocksprites instances for referencing as if they were globals.
- public static BlockSprites[] AllBlocksSprites {
- get => _allBlocksSprites;
- private set => _allBlocksSprites = value;
- }
- /// List used to store the names of blocks. The indexes are the corresponding block's ID.
- public static string[] BlockSpriteNames {
- get => _blockSpriteNames;
- private set => _blockSpriteNames = value;
- }
+ public static Dictionary AllBlocksSprites { get; private set; }
public static void LoadBlockSprites() {
- AllBlocksSprites = new BlockSprites[BlockManagerShared.AllBlocks.Length];
- BlockSpriteNames = new string[BlockManagerShared.AllBlocks.Length];
-
- foreach (BlockShared block in BlockManagerShared.AllBlocks) {
- BlockSprites newBlockSprites = new(block);
- BlockSpriteNames[block.BlockId] = block.BlockName;
- AllBlocksSprites[block.BlockId] = newBlockSprites;
- }
+ AllBlocksSprites = BlockManagerShared.AllBlocks.ToDictionary(uid => uid.Key, block => new BlockSprites(block.Value));
}
}
\ No newline at end of file
diff --git a/Blocktest/Code/Block System/RenderableTile.cs b/Blocktest/Code/Block System/RenderableTile.cs
index 348ac7a..7094ecb 100644
--- a/Blocktest/Code/Block System/RenderableTile.cs
+++ b/Blocktest/Code/Block System/RenderableTile.cs
@@ -9,7 +9,7 @@ public class RenderableTile : TileShared {
public RenderableTile(TileShared tile, bool background) : base(tile.SourceBlock,
tile.Transform.Position / GlobalsShared.GridSize) {
Renderable = new Renderable(Transform, background ? Layer.BackgroundBlocks : Layer.ForegroundBlocks,
- BlockSpritesManager.AllBlocksSprites[tile.SourceBlock.BlockId].BlockSprite, tile.Color);
+ BlockSpritesManager.AllBlocksSprites[tile.SourceBlock.BlockUid].BlockSprite, tile.Color);
}
///
@@ -38,7 +38,7 @@ public void UpdateAdjacencies(Vector2Int position, TilemapShared tilemap) {
bitmask += 8;
}
- Renderable.Appearance = BlockSpritesManager.AllBlocksSprites[SourceBlock.BlockId].SpriteSheet
+ Renderable.Appearance = BlockSpritesManager.AllBlocksSprites[SourceBlock.BlockUid].SpriteSheet
.OrderedSprites[bitmask];
}
@@ -52,7 +52,7 @@ private bool HasSmoothableTile(Vector2Int position, TilemapShared tilemap) {
if (tilemap.TryGetTile(position, out TileShared? tile)) {
return SourceBlock.SmoothSelf
? IsSameTileType(tile)
- : tile.SourceBlock.BlockId != 0; // Don't smooth with air, possibly find nicer way to do this later.
+ : tile.SourceBlock.BlockUid != "air"; // Don't smooth with air, possibly find nicer way to do this later.
}
return false;
}
diff --git a/Blocktest/Code/Block System/RenderableTilemap.cs b/Blocktest/Code/Block System/RenderableTilemap.cs
index 21e45b0..66f070f 100644
--- a/Blocktest/Code/Block System/RenderableTilemap.cs
+++ b/Blocktest/Code/Block System/RenderableTilemap.cs
@@ -28,11 +28,9 @@ public RenderableTilemap(TilemapShared newTilemap, Camera camera) {
private void OnTilemapChanged(TileShared tile, Vector2Int location) {
_camera.RenderedComponents.Remove(_renderables[location.X, location.Y].Renderable);
+
foreach (Vector2Int dir in Adjacencies) {
- if (location.X + dir.X < 0 ||
- location.X + dir.X >= _tilemap.TilemapSize.X ||
- location.Y + dir.Y < 0 ||
- location.Y + dir.Y >= _tilemap.TilemapSize.Y) {
+ if (!_tilemap.TryGetTile(location + dir, out TileShared? adjacentTile)) {
continue;
}
_renderables[location.X + dir.X, location.Y + dir.Y].UpdateAdjacencies(location + dir, _tilemap);
diff --git a/Blocktest/Code/Scenes/GameScene.cs b/Blocktest/Code/Scenes/GameScene.cs
index 6bfc836..462ce33 100644
--- a/Blocktest/Code/Scenes/GameScene.cs
+++ b/Blocktest/Code/Scenes/GameScene.cs
@@ -1,3 +1,4 @@
+using System.Linq;
using Blocktest.Block_System;
using Blocktest.Misc;
using Blocktest.Networking;
@@ -15,6 +16,7 @@ public sealed class GameScene : IScene {
private readonly Client _networkingClient;
private readonly SpriteBatch _spriteBatch;
private int _blockSelected = 1; //ID of the block to place
+ private string[] _blockStrings;
private readonly RenderableTilemap _backgroundTilemapSprites;
private readonly RenderableTilemap _foregroundTilemapSprites;
@@ -28,7 +30,6 @@ public sealed class GameScene : IScene {
public GameScene(BlocktestGame game, bool doConnect, string? ip) {
_connect = doConnect;
_spriteBatch = new SpriteBatch(game.GraphicsDevice);
- game.Content.Load("Fonts/OpenSans");
_game = game;
_camera = new Camera(Vector2.Zero, new Vector2(512, 256), game.GraphicsDevice);
@@ -38,27 +39,16 @@ public GameScene(BlocktestGame game, bool doConnect, string? ip) {
_backgroundTilemapSprites = new RenderableTilemap(GlobalsShared.BackgroundTilemap, _camera);
_foregroundTilemapSprites = new RenderableTilemap(GlobalsShared.ForegroundTilemap, _camera);
_networkingClient = new Client();
-
+
+ _blockStrings = BlockManagerShared.AllBlocks.Keys.ToArray();
+
if (_connect && ip != null) {
_networkingClient.Start(ip, 9050, "testKey");
return;
}
- WorldDownload testDownload = new();
-
- int[,,] newWorld = new int[GlobalsShared.MaxX, GlobalsShared.MaxY, 2];
- for (int i = 0; i < GlobalsShared.MaxX; i++) {
- newWorld[i, 0, 1] = 4;
- newWorld[i, 1, 1] = 2;
- newWorld[i, 2, 1] = 2;
- newWorld[i, 3, 1] = 2;
- newWorld[i, 4, 1] = 2;
- newWorld[i, 5, 1] = 3;
- }
- testDownload.World = newWorld;
- testDownload.TickNum = 1;
+ var testDownload = WorldDownload.Default();
testDownload.Process();
-
}
public void Update(GameTime gameTime) {
@@ -90,7 +80,7 @@ public void Update(GameTime gameTime) {
if (currentKeyboardState.IsKeyDown(Keys.Q) &&
_previousKeyboardState.IsKeyUp(Keys.Q)) {
_blockSelected++;
- if (_blockSelected >= BlockManagerShared.AllBlocks.Length) {
+ if (_blockSelected >= BlockManagerShared.AllBlocks.Count) {
_blockSelected = 1;
}
}
@@ -131,7 +121,7 @@ public void Update(GameTime gameTime) {
TickNum = _networkingClient.ClientTickBuffer.CurrTick,
Position = tilePos,
Foreground = foreground,
- BlockId = _blockSelected
+ BlockUid = _blockStrings[_blockSelected]
};
_networkingClient.ClientTickBuffer.AddPacket(testChange);
diff --git a/Blocktest/packages.lock.json b/Blocktest/packages.lock.json
index 666688e..259290e 100644
--- a/Blocktest/packages.lock.json
+++ b/Blocktest/packages.lock.json
@@ -26,11 +26,17 @@
"resolved": "2.2.0",
"contentHash": "u06nYzGcXCBcnF7cRe8Xa0KxBxGx8grhujZmb3PUiMVbds8d/I6qJ+waGn0IeC7Tdwmt0P6l3v7MqdYog5rJQg=="
},
+ "YamlDotNet": {
+ "type": "Transitive",
+ "resolved": "13.7.0",
+ "contentHash": "RKkoQSCyk/94N20SL3U15hWAqBVXHu+59upcPi8R2uhrcAalyVa4Y/vYdXQ7MXQ71Lut//DH0tLcYByAkGmXhA=="
+ },
"shared": {
"type": "Project",
"dependencies": {
"LiteNetLib": "[1.1.0, )",
- "MonoGame.Framework.DesktopGL": "[3.8.1.303, )"
+ "MonoGame.Framework.DesktopGL": "[3.8.1.303, )",
+ "YamlDotNet": "[13.7.0, )"
}
}
}
diff --git a/DedicatedServer/Code/WorldHandler.cs b/DedicatedServer/Code/WorldHandler.cs
index 6c10ffb..137c039 100644
--- a/DedicatedServer/Code/WorldHandler.cs
+++ b/DedicatedServer/Code/WorldHandler.cs
@@ -25,21 +25,8 @@ public WorldHandler() {
BlockManagerShared.Initialize();
GlobalsShared.BackgroundTilemap = new TilemapShared(GlobalsShared.MaxX, GlobalsShared.MaxY, true);
GlobalsShared.ForegroundTilemap = new TilemapShared(GlobalsShared.MaxX, GlobalsShared.MaxY, false);
-
-
- int[,,] newWorld = new int[GlobalsShared.MaxX, GlobalsShared.MaxY, 2];
- for (int i = 0; i < GlobalsShared.MaxX; i++) {
- newWorld[i, 0, 1] = 4;
- newWorld[i, 1, 1] = 2;
- newWorld[i, 2, 1] = 2;
- newWorld[i, 3, 1] = 2;
- newWorld[i, 4, 1] = 2;
- newWorld[i, 5, 1] = 3;
- }
- WorldDownload testDownload = new() {
- World = newWorld,
- TickNum = 1
- };
+
+ var testDownload = WorldDownload.Default();
testDownload.Process();
_server = new Server();
diff --git a/Shared/Code/Block System/BlockManagerShared.cs b/Shared/Code/Block System/BlockManagerShared.cs
index efdd758..cfc3749 100644
--- a/Shared/Code/Block System/BlockManagerShared.cs
+++ b/Shared/Code/Block System/BlockManagerShared.cs
@@ -1,66 +1,44 @@
+using System.Collections.Generic;
+using System.IO;
using System.Linq;
+using YamlDotNet.Serialization;
+
namespace Shared.Code.Block_System;
///
-/// The BlockManager contains all of the block types in an array of blocks and a
-/// list of block names.
+/// The BlockManager contains all of the block types in a dictionary of blocks indexed by their name
///
public abstract class BlockManagerShared {
/// Array which stores all block instances for referencing as if they were globals.
- private static BlockShared[] _allBlocks;
-
-
- /// List used to store the names of blocks. The indexes are the corresponding block's ID.
- private static string[] _blockNames;
-
- /// Array which stores all block instances for referencing as if they were globals.
- public static BlockShared[] AllBlocks {
- get => _allBlocks;
- private set => _allBlocks = value;
- }
-
- /// List used to store the names of blocks. The indexes are the corresponding block's ID.
- public static string[] BlockNames {
- get => _blockNames;
- private set => _blockNames = value;
- }
+ public static Dictionary AllBlocks { get; private set; }
///
- /// Compiles all block subtypes into an array of blocks and a
- /// list of block names.
+ /// Compiles all block subtypes into a dictionary of blocks indexed by their name
///
public static void Initialize() {
- // This mess gets all subtypes of Block and puts the types in a list.
- Type[] allBlockTypes = (
- from domainAssembly in AppDomain.CurrentDomain.GetAssemblies()
- from assemblyType in domainAssembly.GetTypes()
- where assemblyType.IsSubclassOf(typeof(BlockShared))
- select assemblyType).ToArray();
-
- AllBlocks = new BlockShared[allBlockTypes.Length];
- BlockNames = new string[allBlockTypes.Length];
-
- // For loops to populate main allBlocks array.
- for (int i = 0; i < allBlockTypes.Length; i++) {
- Type newBlockType = allBlockTypes[i];
- BlockShared? newBlock = (BlockShared?)Activator.CreateInstance(newBlockType);
- if (newBlock == null) {
- Console.WriteLine($"Failed to create instance of {newBlockType}!");
+ var deserialize = new DeserializerBuilder().Build();
+ var assembly = typeof(BlockManagerShared).Assembly;
+ var assemblyNames = assembly.GetManifestResourceNames();
+ var blockNames = assemblyNames.Where(x => x.StartsWith("Shared.Content.Blocks."));
+
+ AllBlocks = new Dictionary();
+ foreach (string resourceName in blockNames) {
+ using var stream = assembly.GetManifestResourceStream(resourceName);
+ if (stream == null) {
continue;
}
- newBlock.Initialize();
- if (newBlock.BlockId == -1) {
- newBlock.BlockId = i;
+ using StreamReader reader = new(stream);
+ string yaml = reader.ReadToEnd();
+ var block = deserialize.Deserialize(yaml);
+ if (block == null) {
+ continue;
}
- if (AllBlocks[newBlock.BlockId] != null) {
- Console.WriteLine(
- $"Block {newBlock} conflicts with block {AllBlocks[newBlock.BlockId]}! (Block ID: {newBlock.BlockId})");
- } else if (newBlock.BlockId > AllBlocks.Length || newBlock.BlockId < 0) {
- Console.WriteLine($"Block {newBlock} has invalid ID {newBlock.BlockId}! (Max ID {AllBlocks.Length})");
+ block.BlockUid = block.BlockName.ToLower().Replace(" ", "_");
+
+ if (!AllBlocks.TryAdd(block.BlockUid, block)) {
+ Console.WriteLine($"File {resourceName} contains duplicate definition of block {block.BlockName}!");
}
- BlockNames[newBlock.BlockId] = newBlock.BlockName;
- AllBlocks[newBlock.BlockId] = newBlock;
}
}
}
\ No newline at end of file
diff --git a/Shared/Code/Block System/BlockShared.cs b/Shared/Code/Block System/BlockShared.cs
index a73ff12..1f12236 100644
--- a/Shared/Code/Block System/BlockShared.cs
+++ b/Shared/Code/Block System/BlockShared.cs
@@ -4,10 +4,11 @@ namespace Shared.Code.Block_System;
/// Each block is a different type of tile which can be placed. The behaviours specified in each block class subtype
/// will be used for every tile of that type.
///
-public abstract class BlockShared {
- /// The block's ID (index in the allblocks list).
- /// Leave as -1 for automatic assignment based on init order (probably not a good idea)
- public int BlockId = -1;
+public sealed class BlockShared {
+ ///
+ /// The block's unique string ID, generated from the name without spaces and turned to lowercase.
+ ///
+ public string BlockUid = "error";
/// The block's name.
public string BlockName = "Error";
@@ -24,24 +25,19 @@ public abstract class BlockShared {
/* METHODS */
- ///
- /// Called whenever a block is first loaded by the block manager.
- ///
- public virtual void Initialize() { }
-
///
/// Called whenever a block is placed.
///
/// The position of the block being placed.
/// Whether the block being placed is in the foreground or not.
- public virtual void OnPlace(Vector2Int position, bool foreground) { }
+ public void OnPlace(Vector2Int position, bool foreground) { }
///
/// Called whenever a block is broken.
///
/// The position of the block being broken.
/// Whether the block being broken is in the foreground or not.
- public virtual void OnBreak(Vector2Int position, bool foreground) { }
+ public void OnBreak(Vector2Int position, bool foreground) { }
///
public override string ToString() => BlockName;
diff --git a/Shared/Code/Block System/TileShared.cs b/Shared/Code/Block System/TileShared.cs
index 948ecc1..8261a4c 100644
--- a/Shared/Code/Block System/TileShared.cs
+++ b/Shared/Code/Block System/TileShared.cs
@@ -17,7 +17,7 @@ public class TileShared : INetSerializable {
///
/// The type of block this tile is.
///
- public readonly BlockShared SourceBlock;
+ public BlockShared SourceBlock;
public readonly Transform Transform;
@@ -37,12 +37,12 @@ public void Serialize(NetDataWriter writer) {
writer.Put(Color.G);
writer.Put(Color.B);
writer.Put(Transform);
- writer.Put(SourceBlock.BlockId);
+ writer.Put(SourceBlock.BlockUid);
}
public void Deserialize(NetDataReader reader) {
Color = new Color(reader.GetByte(), reader.GetByte(), reader.GetByte());
Transform.Deserialize(reader);
- SourceBlock.BlockId = reader.GetInt();
+ SourceBlock = BlockManagerShared.AllBlocks[reader.GetString()];
}
}
\ No newline at end of file
diff --git a/Shared/Code/Block System/TilemapShared.cs b/Shared/Code/Block System/TilemapShared.cs
index 2f25188..225979e 100644
--- a/Shared/Code/Block System/TilemapShared.cs
+++ b/Shared/Code/Block System/TilemapShared.cs
@@ -20,7 +20,7 @@ public sealed class TilemapShared {
///
public readonly TileShared?[,] TileGrid;
- public bool Background;
+ public readonly bool Background;
public event Action? OnTileChanged;
@@ -35,7 +35,7 @@ public TilemapShared(int sizeX, int sizeY, bool background) {
TileGrid = new TileShared[sizeX, sizeY];
for (int x = 0; x < sizeX; x++) {
for (int y = 0; y < sizeY; y++) {
- TileGrid[x, y] = new TileShared(BlockManagerShared.AllBlocks[0], new Vector2Int(x, y)); //Fill with air
+ TileGrid[x, y] = new TileShared(BlockManagerShared.AllBlocks["air"], new Vector2Int(x, y)); //Fill with air
}
}
Background = background;
@@ -66,7 +66,7 @@ public TileShared SetTile(Vector2Int location, TileShared newTile) {
/// Deletes a at a specific location (sets block to air).
///
///
- public void DeleteTile(Vector2Int location) => SetBlock(location, BlockManagerShared.AllBlocks[0]);
+ public void DeleteTile(Vector2Int location) => SetBlock(location, BlockManagerShared.AllBlocks["air"]);
public bool TryGetTile(Vector2Int location, [NotNullWhen(true)] out T? result) where T : TileShared {
result = null;
diff --git a/Shared/Code/Blocks/Air.cs b/Shared/Code/Blocks/Air.cs
deleted file mode 100644
index 242cfdb..0000000
--- a/Shared/Code/Blocks/Air.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class Air : BlockShared {
- public override void Initialize() {
- BlockName = "Air";
- BlockId = 0;
- BlockSmoothing = false;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/Asphalt.cs b/Shared/Code/Blocks/Asphalt.cs
deleted file mode 100644
index b41ebd5..0000000
--- a/Shared/Code/Blocks/Asphalt.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class Asphalt : BlockShared {
- public override void Initialize() {
- BlockName = "Asphalt";
- BlockId = 10;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/Brick.cs b/Shared/Code/Blocks/Brick.cs
deleted file mode 100644
index 1649f03..0000000
--- a/Shared/Code/Blocks/Brick.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class Brick : BlockShared {
- public override void Initialize() {
- BlockName = "Brick";
- BlockId = 11;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/Concrete.cs b/Shared/Code/Blocks/Concrete.cs
deleted file mode 100644
index 38bda6e..0000000
--- a/Shared/Code/Blocks/Concrete.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class Concrete : BlockShared {
- public override void Initialize() {
- BlockName = "Concrete";
- BlockId = 15;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/Dirt.cs b/Shared/Code/Blocks/Dirt.cs
deleted file mode 100644
index e0460a4..0000000
--- a/Shared/Code/Blocks/Dirt.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class Dirt : BlockShared {
- public override void Initialize() {
- BlockName = "Dirt";
- BlockId = 1;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/Glass.cs b/Shared/Code/Blocks/Glass.cs
deleted file mode 100644
index 8b89ae3..0000000
--- a/Shared/Code/Blocks/Glass.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Blocks
-{
- public class Glass : BlockShared
- {
- public override void Initialize()
- {
- BlockName = "Glass";
- BlockId = 23;
- BlockSmoothing = false;
- base.Initialize();
- }
- }
-}
-
diff --git a/Shared/Code/Blocks/GlassPane.cs b/Shared/Code/Blocks/GlassPane.cs
deleted file mode 100644
index 9cac5ec..0000000
--- a/Shared/Code/Blocks/GlassPane.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class GlassPane : BlockShared {
- public override void Initialize() {
- BlockName = "Glass Pane";
- BlockId = 5;
- BlockSmoothing = true;
- SmoothSelf = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/Grass.cs b/Shared/Code/Blocks/Grass.cs
deleted file mode 100644
index 0ed6f3a..0000000
--- a/Shared/Code/Blocks/Grass.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class Grass : BlockShared {
- public override void Initialize() {
- BlockName = "Grass";
- BlockId = 2;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/HardenedWhiteSand.cs b/Shared/Code/Blocks/HardenedWhiteSand.cs
deleted file mode 100644
index 2b8cf63..0000000
--- a/Shared/Code/Blocks/HardenedWhiteSand.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class HardenedWhiteSand : BlockShared {
- public override void Initialize() {
- BlockName = "Hardened White Sand";
- BlockId = 18;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/LargeStoneBrick.cs b/Shared/Code/Blocks/LargeStoneBrick.cs
deleted file mode 100644
index a79dcba..0000000
--- a/Shared/Code/Blocks/LargeStoneBrick.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class LargeStoneBrick : BlockShared {
- public override void Initialize() {
- BlockName = "Large Stone Brick";
- BlockId = 6;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/Log.cs b/Shared/Code/Blocks/Log.cs
deleted file mode 100644
index fb12eb0..0000000
--- a/Shared/Code/Blocks/Log.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class Log : BlockShared {
- public override void Initialize() {
- BlockName = "Log";
- BlockId = 7;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/PuceStone.cs b/Shared/Code/Blocks/PuceStone.cs
deleted file mode 100644
index a031b17..0000000
--- a/Shared/Code/Blocks/PuceStone.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class Pucestone : BlockShared {
- public override void Initialize() {
- BlockName = "Pucestone";
- BlockId = 19;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/PucestoneSlab.cs b/Shared/Code/Blocks/PucestoneSlab.cs
deleted file mode 100644
index 0f0bad6..0000000
--- a/Shared/Code/Blocks/PucestoneSlab.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class PucestoneSlab : BlockShared {
- public override void Initialize() {
- BlockName = "Pucestone Slab";
- BlockId = 22;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/PurpleGrass.cs b/Shared/Code/Blocks/PurpleGrass.cs
deleted file mode 100644
index bd8615a..0000000
--- a/Shared/Code/Blocks/PurpleGrass.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class PurpleGrass : BlockShared {
- public override void Initialize() {
- BlockName = "Purple Grass";
- BlockId = 17;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/Pykrete.cs b/Shared/Code/Blocks/Pykrete.cs
deleted file mode 100644
index 7f496a8..0000000
--- a/Shared/Code/Blocks/Pykrete.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class Pykrete : BlockShared {
- public override void Initialize() {
- BlockName = "Pykrete";
- BlockId = 9;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/Salt.cs b/Shared/Code/Blocks/Salt.cs
deleted file mode 100644
index 25e3cf3..0000000
--- a/Shared/Code/Blocks/Salt.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class Salt : BlockShared {
- public override void Initialize() {
- BlockName = "Salt";
- BlockId = 20;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/SmoothMetal.cs b/Shared/Code/Blocks/SmoothMetal.cs
deleted file mode 100644
index b32a670..0000000
--- a/Shared/Code/Blocks/SmoothMetal.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class SmoothMetal : BlockShared {
- public override void Initialize() {
- BlockName = "Smooth Metal";
- BlockId = 13;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/Stone.cs b/Shared/Code/Blocks/Stone.cs
deleted file mode 100644
index 7063a13..0000000
--- a/Shared/Code/Blocks/Stone.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class Stone : BlockShared {
- public override void Initialize() {
- BlockName = "Stone";
- BlockId = 3;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/StoneBrick.cs b/Shared/Code/Blocks/StoneBrick.cs
deleted file mode 100644
index 9991f12..0000000
--- a/Shared/Code/Blocks/StoneBrick.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class StoneBrick : BlockShared {
- public override void Initialize() {
- BlockName = "Stone Brick";
- BlockId = 8;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/StonePathBrick.cs b/Shared/Code/Blocks/StonePathBrick.cs
deleted file mode 100644
index edc8981..0000000
--- a/Shared/Code/Blocks/StonePathBrick.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class StonePathBrick : BlockShared {
- public override void Initialize() {
- BlockName = "Stone Path Brick";
- BlockId = 14;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/WhiteSand.cs b/Shared/Code/Blocks/WhiteSand.cs
deleted file mode 100644
index 0ef9062..0000000
--- a/Shared/Code/Blocks/WhiteSand.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class WhiteSand : BlockShared {
- public override void Initialize() {
- BlockName = "White Sand";
- BlockId = 16;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/WhiteSandstoneBrick.cs b/Shared/Code/Blocks/WhiteSandstoneBrick.cs
deleted file mode 100644
index 47feec6..0000000
--- a/Shared/Code/Blocks/WhiteSandstoneBrick.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class WhiteSandstoneBrick : BlockShared {
- public override void Initialize() {
- BlockName = "White Sandstone Brick";
- BlockId = 21;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/Wood.cs b/Shared/Code/Blocks/Wood.cs
deleted file mode 100644
index 30714f7..0000000
--- a/Shared/Code/Blocks/Wood.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class Wood : BlockShared {
- public override void Initialize() {
- BlockName = "Wood";
- BlockId = 4;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/Blocks/WoodPanel.cs b/Shared/Code/Blocks/WoodPanel.cs
deleted file mode 100644
index 907bcd4..0000000
--- a/Shared/Code/Blocks/WoodPanel.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Shared.Code.Block_System;
-namespace Shared.Code.Blocks;
-
-public class WoodPanel : BlockShared {
- public override void Initialize() {
- BlockName = "Wood Panel";
- BlockId = 12;
- BlockSmoothing = true;
- base.Initialize();
- }
-}
\ No newline at end of file
diff --git a/Shared/Code/BuildSystem.cs b/Shared/Code/BuildSystem.cs
index 2089703..a0102a6 100644
--- a/Shared/Code/BuildSystem.cs
+++ b/Shared/Code/BuildSystem.cs
@@ -5,7 +5,7 @@ public static class BuildSystem {
///
/// An array containing an entry for every block in the world. Used for saving games.
///
- public static int[,,] CurrentWorld { get; } = new int[GlobalsShared.MaxX, GlobalsShared.MaxY, 2];
+ public static string[,,] CurrentWorld { get; } = new string[GlobalsShared.MaxX, GlobalsShared.MaxY, 2];
///
/// The method called whenever an object is removed.
@@ -18,7 +18,7 @@ public static void BreakBlockCell(bool foreground, Vector2Int tilePosition) {
}
TilemapShared tilemap = foreground ? GlobalsShared.ForegroundTilemap : GlobalsShared.BackgroundTilemap;
- BlockShared toPlace = BlockManagerShared.AllBlocks[0];
+ BlockShared toPlace = BlockManagerShared.AllBlocks["air"];
TileShared newTile = new(toPlace, tilePosition);
int z = foreground ? 1 : 0; // Convert foreground bool to int
@@ -27,7 +27,7 @@ public static void BreakBlockCell(bool foreground, Vector2Int tilePosition) {
}
tilemap.SetTile(tilePosition, newTile);
- CurrentWorld[tilePosition.X, tilePosition.Y, z] = 1;
+ CurrentWorld[tilePosition.X, tilePosition.Y, z] = "air";
}
///
@@ -45,11 +45,11 @@ public static void PlaceBlockCell(BlockShared toPlace, bool foreground, Vector2I
if (foreground) {
GlobalsShared.ForegroundTilemap.SetTile(tilePosition, newTile);
- CurrentWorld[tilePosition.X, tilePosition.Y, 1] = toPlace.BlockId + 1;
+ CurrentWorld[tilePosition.X, tilePosition.Y, 1] = toPlace.BlockUid;
} else if (toPlace.CanPlaceBackground) {
newTile.Color = GlobalsShared.BackgroundColor;
GlobalsShared.BackgroundTilemap.SetTile(tilePosition, newTile);
- CurrentWorld[tilePosition.X, tilePosition.Y, 0] = toPlace.BlockId + 1;
+ CurrentWorld[tilePosition.X, tilePosition.Y, 0] = toPlace.BlockUid;
}
}
@@ -60,27 +60,27 @@ public static void PlaceBlockCell(BlockShared toPlace, bool foreground, Vector2I
/// An array containing an entry for every block in the world. Used for loading games. MUST be the
/// same dimensions as currentWorld
///
- public static void LoadNewWorld(int[,,] newWorld) {
+ public static void LoadNewWorld(string?[,,] newWorld) {
for (int x = 0; x < newWorld.GetLength(0); x++)
for (int y = 0; y < newWorld.GetLength(1); y++)
for (int z = 0; z < 2; z++) {
Vector2Int tilePosition = new(x, y);
- int blockNum = newWorld[x, y, z];
- LoadNewBlock(blockNum, tilePosition, z);
+ string? blockUid = newWorld[x, y, z];
+ LoadNewBlock(blockUid, tilePosition, z);
}
}
///
/// Loads a new block from an int
///
- /// The blockid + 1
+ /// The blockUid
/// The position of the tile in the tilemap
/// Whether the block is in the foreground, expressed as an int
- private static void LoadNewBlock(int blockNum, Vector2Int tilePosition, int foregroundInt) {
- CurrentWorld[tilePosition.X, tilePosition.Y, foregroundInt] = blockNum;
+ private static void LoadNewBlock(string? blockUid, Vector2Int tilePosition, int foregroundInt) {
+ CurrentWorld[tilePosition.X, tilePosition.Y, foregroundInt] = blockUid;
bool foreground = Convert.ToBoolean(foregroundInt);
- if (blockNum > 1) {
- BlockShared newBlock = BlockManagerShared.AllBlocks[blockNum - 1];
+ if (blockUid is not null) {
+ BlockShared newBlock = BlockManagerShared.AllBlocks[blockUid];
PlaceBlockCell(newBlock, foreground, tilePosition);
} else {
BreakBlockCell(foreground, tilePosition);
diff --git a/Shared/Code/Packets/TileChange.cs b/Shared/Code/Packets/TileChange.cs
index 59d4569..6187c10 100644
--- a/Shared/Code/Packets/TileChange.cs
+++ b/Shared/Code/Packets/TileChange.cs
@@ -10,7 +10,7 @@ namespace Shared.Code.Packets;
/// Should be reworked when chunks are added.
///
public sealed class TileChange : IPacket {
- public int BlockId;
+ public string BlockUid;
public bool Foreground;
public Vector2Int Position;
public ushort TickNum;
@@ -18,7 +18,7 @@ public sealed class TileChange : IPacket {
public ushort GetTickNum() => TickNum;
public void Process() {
- BuildSystem.PlaceBlockCell(BlockManagerShared.AllBlocks[BlockId], Foreground, Position);
+ BuildSystem.PlaceBlockCell(BlockManagerShared.AllBlocks[BlockUid], Foreground, Position);
}
public void Serialize(NetDataWriter writer) {
@@ -26,7 +26,7 @@ public void Serialize(NetDataWriter writer) {
writer.Put(Position.X);
writer.Put(Position.Y);
writer.Put(Foreground);
- writer.Put(BlockId);
+ writer.Put(BlockUid);
}
public void Deserialize(NetDataReader reader) {
@@ -34,7 +34,7 @@ public void Deserialize(NetDataReader reader) {
int x = reader.GetInt();
int y = reader.GetInt();
Foreground = reader.GetBool();
- BlockId = reader.GetInt();
+ BlockUid = reader.GetString();
Position = new Vector2Int(x, y);
}
diff --git a/Shared/Code/Packets/WorldDownload.cs b/Shared/Code/Packets/WorldDownload.cs
index 5ffa0d6..51ef544 100644
--- a/Shared/Code/Packets/WorldDownload.cs
+++ b/Shared/Code/Packets/WorldDownload.cs
@@ -10,7 +10,7 @@ namespace Shared.Code.Packets;
///
public sealed class WorldDownload : IPacket {
public ushort TickNum;
- public int[,,] World = new int[GlobalsShared.MaxX, GlobalsShared.MaxY, 2];
+ public string?[,,] World = new string[GlobalsShared.MaxX, GlobalsShared.MaxY, 2];
public ushort GetTickNum() => TickNum;
@@ -34,9 +34,27 @@ public void Deserialize(NetDataReader reader) {
for (int x = 0; x < GlobalsShared.MaxX; x++) {
for (int y = 0; y < GlobalsShared.MaxY; y++) {
for (int z = 0; z < 2; z++) {
- World[x, y, z] = reader.GetInt();
+ World[x, y, z] = reader.GetString();
}
}
}
}
+
+ public static WorldDownload Default() {
+ string?[,,] newWorld = new string[GlobalsShared.MaxX, GlobalsShared.MaxY, 2];
+
+ for (int i = 0; i < GlobalsShared.MaxX; i++) {
+ newWorld[i, 0, 1] = "stone";
+ newWorld[i, 1, 1] = "dirt";
+ newWorld[i, 2, 1] = "dirt";
+ newWorld[i, 3, 1] = "dirt";
+ newWorld[i, 4, 1] = "dirt";
+ newWorld[i, 5, 1] = "grass";
+ }
+
+ return new WorldDownload {
+ World = newWorld,
+ TickNum = 1
+ };
+ }
}
\ No newline at end of file
diff --git a/Shared/Content/Blocks/Air.yml b/Shared/Content/Blocks/Air.yml
new file mode 100644
index 0000000..3cd5e06
--- /dev/null
+++ b/Shared/Content/Blocks/Air.yml
@@ -0,0 +1 @@
+BlockName: Air
diff --git a/Shared/Content/Blocks/Asphalt.yml b/Shared/Content/Blocks/Asphalt.yml
new file mode 100644
index 0000000..64b4348
--- /dev/null
+++ b/Shared/Content/Blocks/Asphalt.yml
@@ -0,0 +1,2 @@
+BlockName: Asphalt
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/Brick.yml b/Shared/Content/Blocks/Brick.yml
new file mode 100644
index 0000000..804f961
--- /dev/null
+++ b/Shared/Content/Blocks/Brick.yml
@@ -0,0 +1,2 @@
+BlockName: Brick
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/Concrete.yml b/Shared/Content/Blocks/Concrete.yml
new file mode 100644
index 0000000..f1d2f33
--- /dev/null
+++ b/Shared/Content/Blocks/Concrete.yml
@@ -0,0 +1,2 @@
+BlockName: Concrete
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/Dirt.yml b/Shared/Content/Blocks/Dirt.yml
new file mode 100644
index 0000000..31fb378
--- /dev/null
+++ b/Shared/Content/Blocks/Dirt.yml
@@ -0,0 +1,2 @@
+BlockName: Dirt
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/Glass.yml b/Shared/Content/Blocks/Glass.yml
new file mode 100644
index 0000000..51cedd3
--- /dev/null
+++ b/Shared/Content/Blocks/Glass.yml
@@ -0,0 +1 @@
+BlockName: Glass
\ No newline at end of file
diff --git a/Shared/Content/Blocks/GlassPane.yml b/Shared/Content/Blocks/GlassPane.yml
new file mode 100644
index 0000000..ab8e597
--- /dev/null
+++ b/Shared/Content/Blocks/GlassPane.yml
@@ -0,0 +1,2 @@
+BlockName: Glass Pane
+BlockSmoothing: true
diff --git a/Shared/Content/Blocks/Grass.yml b/Shared/Content/Blocks/Grass.yml
new file mode 100644
index 0000000..99b8b76
--- /dev/null
+++ b/Shared/Content/Blocks/Grass.yml
@@ -0,0 +1,2 @@
+BlockName: Grass
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/HardenedWhiteSand.yml b/Shared/Content/Blocks/HardenedWhiteSand.yml
new file mode 100644
index 0000000..4bcebba
--- /dev/null
+++ b/Shared/Content/Blocks/HardenedWhiteSand.yml
@@ -0,0 +1,2 @@
+BlockName: Hardened White Sand
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/LargeStoneBrick.yml b/Shared/Content/Blocks/LargeStoneBrick.yml
new file mode 100644
index 0000000..361d31d
--- /dev/null
+++ b/Shared/Content/Blocks/LargeStoneBrick.yml
@@ -0,0 +1,2 @@
+BlockName: Large Stone Brick
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/Log.yml b/Shared/Content/Blocks/Log.yml
new file mode 100644
index 0000000..4b6bb06
--- /dev/null
+++ b/Shared/Content/Blocks/Log.yml
@@ -0,0 +1,2 @@
+BlockName: Log
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/Pucestone.yml b/Shared/Content/Blocks/Pucestone.yml
new file mode 100644
index 0000000..c116a82
--- /dev/null
+++ b/Shared/Content/Blocks/Pucestone.yml
@@ -0,0 +1,2 @@
+BlockName: Pucestone
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/PucestoneSlab.yml b/Shared/Content/Blocks/PucestoneSlab.yml
new file mode 100644
index 0000000..0a3c412
--- /dev/null
+++ b/Shared/Content/Blocks/PucestoneSlab.yml
@@ -0,0 +1,2 @@
+BlockName: Pucestone Slab
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/PurpleGrass.yml b/Shared/Content/Blocks/PurpleGrass.yml
new file mode 100644
index 0000000..b95b9a5
--- /dev/null
+++ b/Shared/Content/Blocks/PurpleGrass.yml
@@ -0,0 +1,2 @@
+BlockName: Purple Grass
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/Pykrete.yml b/Shared/Content/Blocks/Pykrete.yml
new file mode 100644
index 0000000..5cf3ed9
--- /dev/null
+++ b/Shared/Content/Blocks/Pykrete.yml
@@ -0,0 +1,2 @@
+BlockName: Pykrete
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/Salt.yml b/Shared/Content/Blocks/Salt.yml
new file mode 100644
index 0000000..b5f3220
--- /dev/null
+++ b/Shared/Content/Blocks/Salt.yml
@@ -0,0 +1,2 @@
+BlockName: Salt
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/SmoothMetal.yml b/Shared/Content/Blocks/SmoothMetal.yml
new file mode 100644
index 0000000..8b0f46d
--- /dev/null
+++ b/Shared/Content/Blocks/SmoothMetal.yml
@@ -0,0 +1,2 @@
+BlockName: Smooth Metal
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/Stone.yml b/Shared/Content/Blocks/Stone.yml
new file mode 100644
index 0000000..c5288c4
--- /dev/null
+++ b/Shared/Content/Blocks/Stone.yml
@@ -0,0 +1,2 @@
+BlockName: Stone
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/StoneBrick.yml b/Shared/Content/Blocks/StoneBrick.yml
new file mode 100644
index 0000000..143a3a0
--- /dev/null
+++ b/Shared/Content/Blocks/StoneBrick.yml
@@ -0,0 +1,2 @@
+BlockName: Stone Brick
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/StonePathBrick.yml b/Shared/Content/Blocks/StonePathBrick.yml
new file mode 100644
index 0000000..97d1e8a
--- /dev/null
+++ b/Shared/Content/Blocks/StonePathBrick.yml
@@ -0,0 +1,2 @@
+BlockName: Stone Path Brick
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/WhiteSand.yml b/Shared/Content/Blocks/WhiteSand.yml
new file mode 100644
index 0000000..3caeed0
--- /dev/null
+++ b/Shared/Content/Blocks/WhiteSand.yml
@@ -0,0 +1,2 @@
+BlockName: White Sand
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/WhiteSandstoneBrick.yml b/Shared/Content/Blocks/WhiteSandstoneBrick.yml
new file mode 100644
index 0000000..1e47431
--- /dev/null
+++ b/Shared/Content/Blocks/WhiteSandstoneBrick.yml
@@ -0,0 +1,2 @@
+BlockName: White Sandstone Brick
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Content/Blocks/Wood.yml b/Shared/Content/Blocks/Wood.yml
new file mode 100644
index 0000000..f59640d
--- /dev/null
+++ b/Shared/Content/Blocks/Wood.yml
@@ -0,0 +1,2 @@
+BlockName: Wood
+BlockSmoothing: true
diff --git a/Shared/Content/Blocks/WoodPanel.yml b/Shared/Content/Blocks/WoodPanel.yml
new file mode 100644
index 0000000..d0ceb2d
--- /dev/null
+++ b/Shared/Content/Blocks/WoodPanel.yml
@@ -0,0 +1,2 @@
+BlockName: Wood Panel
+BlockSmoothing: true
\ No newline at end of file
diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj
index 8fd53b3..091f9f9 100644
--- a/Shared/Shared.csproj
+++ b/Shared/Shared.csproj
@@ -6,5 +6,10 @@
+
+
+
+
+
diff --git a/Shared/blocks.schema.json b/Shared/blocks.schema.json
new file mode 100644
index 0000000..8ad16df
--- /dev/null
+++ b/Shared/blocks.schema.json
@@ -0,0 +1,26 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "title": "Block",
+ "description": "A block for use in Blocktest",
+ "type": "object",
+ "required": ["BlockName"],
+ "properties": {
+ "BlockName": {
+ "type": "string",
+ "description": "The name of the block"
+ },
+ "BlockSmoothing": {
+ "type": "boolean",
+ "description": "Whether the block is capable of smoothing with other blocks",
+ "default": false
+ },
+ "SmoothSelf": {
+ "type": "boolean",
+ "default": false
+ },
+ "CanPlaceBackground": {
+ "type": "boolean",
+ "default": true
+ }
+ }
+}