forked from Vogtinator/crafti
-
Notifications
You must be signed in to change notification settings - Fork 0
Block Name
Bluebotlabz edited this page Jul 2, 2022
·
2 revisions
Each regular block has a static, unchanged name the way in which this is actually quite simple, essentially, there are two main files which matter, the terrain.h and the terrain.cpp
In the terrain.h file, the block IDs are determined by what is set in this file:
typedef uint8_t BLOCK;
typedef uint16_t BLOCK_WDATA;
constexpr BLOCK BLOCK_AIR = 0;
constexpr BLOCK BLOCK_STONE = 1;
constexpr BLOCK BLOCK_DIRT = 2;
constexpr BLOCK BLOCK_SAND = 3;
constexpr BLOCK BLOCK_WOOD = 4;
...
// Regular blocks end here
constexpr BLOCK BLOCK_NORMAL_LAST = BLOCK_CACTUS;and interestingly enough, the name of a block is determined in a similar way in terrain.cpp:
const char *block_names[BLOCK_NORMAL_LAST + 1] =
{
"Air",
"Stone",
"Dirt",
"Sand",
"Wood",
...
};You may notice the pattern, basically, the block name is directly determined by the array in terrain.cpp, as you can see, the 0th item in the array Air, corresponds to BLOCK_AIR which is, coincidentially, zero.
So essentially, the item index in the array, directly determiens the name of the block with the same ID
- Home
- Building Crafti
- Crafti Versions
- Crafti Textures
-
Crafti Development
-
Inventory
- Adding blocks to inventory
- Changing inventory parameters
-
Blocks
- Regular Blocks
- Special Blocks
- Special Block Definitions
- Special Block Textures
- Special Block Name
- Special Block Renderers/Logic
- Special Block Data
- Tick() and Saving Data
- Tutorial: Redstone Wool
- Advanced Block Documentation
- Warning
- All Included Renderers
- Block Meshes
- Block Collision
- Block Transparency
- Block Renderer Texture "Cropping"
- All Block Renderer Parameters
- All Block Renderer Functions
- Block Data Structure
- Redstone
- How Redstone works in Crafti
- Redstone in special blocks
- World
- Chunks
- World Generation
- Structure Generation
- Localisation
- Setting the game's language
- Adding a language
-
Inventory