Repository navigation
Support rendering of short_grass in rendered_palette.rs - #111
Merged
Merged
Conversation
masaishi
added a commit
to masaishi/fastnbt
that referenced
this pull request
Apr 22, 2024
This pull request adds support for specific blocks that are currently not handled properly due to unique blockstates. The changes include the addition of exception handlers when `make_palette`.
I'm not sure if my approach is the correct way to support new blocks. If my implementation is incorrect, please give me advice of the proper way to extend support for blocks with unique blockstates.
Below are the detailed implementations proposed for two blocks, explaining the error causes and the solutions applied.
- **pink_petals**
- **Error Description:** `Blockstate::Multipart` -> try_mappings
- **Implementation:** Added RegexMapping to map `minecraft:block/pink_petals`.
- **pointed_dripstone**
- **Error Description:** `Blockstate::Variants` -> renderer.get_top -> Variants::Single -> self.model_get_top -> el.faces.get("up").ok_or_else( || -> Error::MissingElements) -> try_mappings
- **Implementation:** Added RegexMapping to map `minecraft:block/pointed_dripstone_up_tip`.
- **mangrove_roots**
- **Error Description:** `Blockstate::Variants` -> renderer.get_top -> Variants::Single -> self.model_get_top -> el.faces.get("up").ok_or_else( || -> Error::MissingElements) -> try_mappings
- **Implementation:** Added RegexMapping to map `minecraft:block/mangrove_roots_top`.
- **(pumpkin|melon|attached_melon|attached_pumpkin|big_dripleaf)_stem**
- **Error Description (Except mushroom_stem):** `Blockstate::Variants` -> renderer.get_top -> Variants::Single -> self.model_get_top -> el.faces.get("up").ok_or_else( || -> Error::MissingElements) -> try_mappings
- **Implementation:** Added RegexMapping to map `minecraft:block/$1_stem`.
- **Note:** Some of the stems work correctly (such as `stripped_warped_stem`), so I used a specific stem names to handle.
- Correctly handled stems:
- `stripped_warped_stem`
- `crimson_stem`
- `warped_stem`
- `stripped_crimson_stem`
- Incorrectly handled stems:
- `pumpkin_stem`
- `melon_stem`
- `attached_melon_stem`
- `attached_pumpkin_stem`
- `big_dripleaf_stem`
- `mushroom_stem`
- **glow_lichen**
- **Error Description:** `Blockstate::Multipart` -> try_mappings
- **Implementation:** Added RegexMapping to map `minecraft:block/glow_lichen`.
- **composter**
- **Error Description:** `Blockstate::Multipart` -> try_mappings
- **Implementation:** Added RegexMapping to map `minecraft:block/composter_top`.
During testing with the Minecraft 1.20.4 world data, several blocks did not map correctly, potentially leading to incomplete or inaccurate renderings in generated maps. Here are some of the affected blocks and their respective counts from the process log:
- ~~"short_grass": 1105963,~~ (Support by owengage#111)
- ~~"pink_petals": 52293,~~
- ~~"pointed_dripstone": 1000,~~
- ~~"mangrove_roots": 373,~~
- ~~"melon_stem": 249,~~
- "chest": 125, (Does not exist png in textures/block/)
- "white_bed": 58, (Does not exist png in textures/block/)
- "brown_wall_banner": 55, (Does not exist png in textures/block/)
- ~~"glow_lichen": 51,~~
- ~~"pumpkin_stem": 48,~~
- ~~"composter": 47,~~
- ~~"attached_pumpkin_stem": 47,~~
- "scaffolding": 38, (I don't know why this block can't be rendered. make_palette works correctly and find the correct texture.)
- "cave_vines_plant": 33,
- "light_blue_bed": 30, (Does not exist png in textures/block/)
- "redstone_wire": 30,
- "hopper": 29,
- "deepslate_tile_wall": 23,
- "powered_rail": 15,
- "grindstone": 15,
- "chorus_plant": 13,
- "cobweb": 12,
- "cave_vines": 12,
- ~~"attached_melon_stem": 10,~~
- "campfire": 9,
- "shulker_box": 9,
- "ladder": 9,
- ~~"big_dripleaf_stem": 8,~~
- "lever": 7,
- "blue_bed": 6, (Does not exist png in textures/block/)
- "stone_brick_wall": 5,
- "comparator": 5,
- "small_dripleaf": 4,
- "oak_door": 4,
- "orange_bed": 4, (Does not exist png in textures/block/)
- "dispenser": 4,
- "oak_sign": 4,
- "pink_bed": 4, (Does not exist png in textures/block/)
- "brewing_stand": 4,
- "mossy_stone_brick_wall": 3,
- "yellow_bed": 3, (Does not exist png in textures/block/)
- "lightning_rod": 3,
- "dropper": 3,
- "iron_bars": 3,
- "lime_shulker_box": 2,
- "white_shulker_box": 2,
- "observer": 2,
- "repeater": 2,
- "jungle_door": 2,
- "red_bed": 2, (Does not exist png in textures/block/)
- "white_banner": 2,
- "white_wall_banner": 1,
- "blue_shulker_box": 1,
- "ender_chest": 1,
- "red_shulker_box": 1,
- "dragon_wall_head": 1,
- "green_shulker_box": 1,
- "bamboo_button": 1,
- "sculk_sensor": 1,
- "calibrated_sculk_sensor": 1,
- "tripwire": 1,
- "spruce_door": 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the
rendered_palette.rsfile to add support for rendering the newly renamed "short_grass" block in the game.Changes:
short_grassto the pick_grass match case inrendered_palette.rsto rendering grasses.Motivation:
The recent update in Minecraft version 1.20.3 Pre-Release 1 renamed "Grass" to "Short Grass". This necessitates our renderer to recognize and properly render the
short_grassblock. For more details on this update, please refer to the Minecraft Wiki: Short Grass Update Details.