Tutorial: Adding a Block Type

Add a named constant in BlockTypes.hpp and see it rendered by GETerrainRenderer.

Block type IDs are icon indices — think before adding new ones A block's type ID doubles as an icon index into object-m.png (441 addressable tiles). New "named" block types should reference an existing icon unless you also add art. IDs used by mobile-eggbert .txt loading paths are frozen to match that format.

Step 1 — Add a Named Constant

File: include/GalaxyEggbert/BlockTypes.hpp

static constexpr uint16_t MyBlock = 42;  // icon index in object-m.png

Step 2 — Use It When Authoring a World

world.setBlock(x, y, z, Block::make(BlockTypes::MyBlock));

See Authoring a New .vwr World for the full generator pattern.

Step 3 — (Optional) Make It Animated

If the block should animate, add it to the frame tables in GETerrainRenderer (ported from mobile-eggbert's Tables.cpp) and to BlockTypes::tileAnimBase()'s classification, following the existing pattern for Lava/Crusher/Saw/Spike/Water/Fan/Marine/Temp.

Step 4 — Rebuild and Verify

cmake --build build-cna --target GalaxyEggbertCNA -j2
./build-cna/GalaxyEggbertCNA

Navigate the invisible collision point near your new block and confirm it renders with the expected texture. If it appears untextured or seams appear, check GETileAtlas's UV computation for that icon index.