feat(blocks): add ore block scaffolding (Coal, Iron, Gold, Diamond)

This commit is contained in:
2026-06-01 15:17:33 +02:00
parent 8166c25ba6
commit 4587f81071
6 changed files with 87 additions and 9 deletions

View File

@@ -4,19 +4,25 @@ public sealed class BlockRegistry
{
private readonly IBlock[] _byId;
public AirBlock Air { get; } = new();
public StoneBlock Stone { get; } = new();
public DirtBlock Dirt { get; } = new();
public GrassBlock Grass { get; } = new();
public SandBlock Sand { get; } = new();
public SnowBlock Snow { get; } = new();
public WaterBlock Water { get; } = new();
public AirBlock Air { get; } = new();
public StoneBlock Stone { get; } = new();
public DirtBlock Dirt { get; } = new();
public GrassBlock Grass { get; } = new();
public SandBlock Sand { get; } = new();
public SnowBlock Snow { get; } = new();
public WaterBlock Water { get; } = new();
public CoalOreBlock CoalOre { get; } = new();
public IronOreBlock IronOre { get; } = new();
public GoldOreBlock GoldOre { get; } = new();
public DiamondOreBlock DiamondOre { get; } = new();
public BlockRegistry()
{
// Index by id. Order does not matter; slot = block.Id.
IBlock[] blocks = new IBlock[]
{ this.Air, this.Stone, this.Dirt, this.Grass, this.Sand, this.Snow, this.Water };
{
this.Air, this.Stone, this.Dirt, this.Grass, this.Sand, this.Snow, this.Water,
this.CoalOre, this.IronOre, this.GoldOre, this.DiamondOre,
};
this._byId = new IBlock[blocks.Length];
foreach (IBlock block in blocks)
{

View File

@@ -0,0 +1,10 @@
namespace VoxelEngine.World.Blocks;
public sealed class CoalOreBlock : IBlock
{
public ushort Id => 7;
public string Name => "Coal Ore";
public bool IsOpaque => true;
public bool IsSolid => true;
public TileCoord GetTextureTile(BlockFace face) => new(0, 0); // placeholder
}

View File

@@ -0,0 +1,10 @@
namespace VoxelEngine.World.Blocks;
public sealed class DiamondOreBlock : IBlock
{
public ushort Id => 10;
public string Name => "Diamond Ore";
public bool IsOpaque => true;
public bool IsSolid => true;
public TileCoord GetTextureTile(BlockFace face) => new(0, 0); // placeholder
}

View File

@@ -0,0 +1,10 @@
namespace VoxelEngine.World.Blocks;
public sealed class GoldOreBlock : IBlock
{
public ushort Id => 9;
public string Name => "Gold Ore";
public bool IsOpaque => true;
public bool IsSolid => true;
public TileCoord GetTextureTile(BlockFace face) => new(0, 0); // placeholder
}

View File

@@ -0,0 +1,10 @@
namespace VoxelEngine.World.Blocks;
public sealed class IronOreBlock : IBlock
{
public ushort Id => 8;
public string Name => "Iron Ore";
public bool IsOpaque => true;
public bool IsSolid => true;
public TileCoord GetTextureTile(BlockFace face) => new(0, 0); // placeholder
}