forked from Vogtinator/crafti
-
Notifications
You must be signed in to change notification settings - Fork 0
Block Renderers
Bluebotlabz edited this page Jul 2, 2022
·
2 revisions
Each block requires a renderer to be set for it, these have to be written on a case-by-case basis for special blocks, however, a number of renderers already exist for regular blocks.
Renderers are selected in blockrenderer.cpp as shown:
map[BLOCK_AIR] = null_renderer;
map[BLOCK_BOOKSHELF] = oriented_renderer;
map[BLOCK_CAKE] = std::make_shared<CakeRenderer>();
map[BLOCK_CRAFTING_TABLE] = oriented_renderer;
map[BLOCK_DIRT] = color_renderer;
map[BLOCK_DOOR] = std::make_shared<DoorRenderer>();
map[BLOCK_FURNACE] = oriented_renderer;
map[BLOCK_GLASS] = opacity_renderer;
map[BLOCK_GRASS] = color_renderer;
map[BLOCK_LEAVES] = std::make_shared<LeavesRenderer>();
map[BLOCK_TNT] = std::make_shared<TNTRenderer>();
map[BLOCK_PLANKS_NORMAL] = color_renderer;
map[BLOCK_PUMPKIN] = oriented_renderer;
map[BLOCK_REDSTONE_LAMP] = std::make_shared<LampRenderer>();
map[BLOCK_REDSTONE_SWITCH] = std::make_shared<SwitchRenderer>();
map[BLOCK_REDSTONE_WIRE] = std::make_shared<WireRenderer>();
map[BLOCK_REDSTONE_TORCH] = std::make_shared<RedstoneTorchRenderer>();
map[BLOCK_PRESSURE_PLATE] = std::make_shared<PressurePlateRenderer>();
map[BLOCK_SAND] = color_renderer;
map[BLOCK_STONE] = color_renderer;
map[BLOCK_TORCH] = std::make_shared<TorchRenderer>();
map[BLOCK_WATER] = std::make_shared<FluidRenderer>(13, 12, "Water");
map[BLOCK_LAVA] = std::make_shared<FluidRenderer>(13, 14, "Lava");
map[BLOCK_WHEAT] = std::make_shared<WheatRenderer>();
map[BLOCK_WOOD] = color_renderer;
map[BLOCK_WOOL] = std::make_shared<WoolRenderer>();
map[BLOCK_SLAB] = std::make_shared<SlabRenderer>();
map[BLOCK_CACTUS] = std::make_shared<CactusRenderer>();
map[BLOCK_CARPET] = std::make_shared<CarpetRenderer>();The format is essentially: map[YOUR_BLOCK_NAME] = renderer;
All regular block renderers are:
| Renderer Name | Description |
|---|---|
| null_renderer | Not actually used for blocks, basically makes the block nonexistant (like air, it is literally the renderer for air) |
| oriented_renderer | The renderer for blocks which need to be oriented with the front towards the player |
| color_renderer | The standard renderer for blocks |
| opacity_renderer | A renderer which supports opacity, used with Glass |
Additionally, YOUR_BLOCK_NAME is the same object that was created with the block's 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