rornic / rustcraft

Another Minecraft clone, written in Rust.
Apache License 2.0
5 stars 0 forks source link

Seperate block textures into multiple files #34

Open ajh123 opened 3 months ago

ajh123 commented 3 months ago

Since 1.6.1 Minecraft no longer uses a texture atlas, instead they use individual textures for each block since its easy for them to add a new block and assign a texture. The texture which each side of a block is used is defined using a JSON file.

However, a texture atlas is still used - it is automatically generated when the game starts.

Furthermore, a registry is used to contain all blocks instead of an enum. All blocks have a namespaced ID (normally "minecraft:value") which will determine which JSON file to load.

This system makes it easy to support thousands of blocks by simply creating a new block and adding it to the registry.

This system makes mod support better since each mod will have their own namespace.

The Minecraft Wiki has an article about this.

rornic commented 3 months ago

Thanks for sharing this useful information @ajh123.

Refactoring the block setup is not a priority for me right now vs other things like optimising chunk rendering, but this will certainly be a neater way to set it up when it next needs changes.