1
0
mirror of https://github.com/GeyserMC/GeyserOptionalPack.git synced 2025-12-21 15:59:23 +00:00

Feature: Client side UI changes to remove Bedrock-only fields (#48)

* Removes fields in UIs that do not exist on Java edition. specifically in the cartography table, command block, and the creative mode inventory.

* Optimized the scoreboard length fix to only modify what is actually needed. Thanks to Tye Pavitt for the input there

* Add a brief explanation of UI modifications to the developer_documentation
This commit is contained in:
chris
2024-01-31 09:23:00 +01:00
committed by GitHub
parent e63dbe2c4d
commit 43ca366fb6
7 changed files with 105 additions and 23 deletions

View File

@@ -14,6 +14,10 @@ Download: https://ci.opencollab.dev/job/GeyserMC/job/GeyserOptionalPack/job/mast
- Shulker invisibility parity
- Spectral arrow entity texture
- Bypass for the scoreboard character limit
- Hides UI elements that do not exist on Java edition, such as:
- Text input field in the cartography table
- 2x2 crafting grid while in creative mode
- Tick-delay and rename fields in the command block menu
### Manually building

View File

@@ -14,6 +14,7 @@
* [Spectral arrow entities](#Spectral-arrow-entities)
* [Spyglass animations](#Spyglass-animations)
* [Zombie villager textures](#Zombie-villager-textures)
* [UI modifications](#ui-modifications)
<!--te-->
### Introduction
@@ -268,3 +269,45 @@ Unfortunately, the spyglass cannot actually be used in the offhand by Bedrock pl
Like villagers, zombie villagers in Java Edition have visible biome and profession variants. It appears that initial implementation of this was started in the Bedrock vanilla resources, given the presence of the entity with the identifier `minecraft:zombie_villager_v2`. However, the textures specified in this vanilla entity definition appear to be entirely blank TGA files. Luckily, the profession textures of zombie villagers and villagers are essentially identical, so the entity definition was updated to reference the villager profession textures.
Zombie villagers, like villagers, have a profession level. This is implemented by adding the same vanilla render controller used to create this effect in the villager entity, `controller.render.villager_v2_level`. The remainder of the entity definition is unchanged.
### UI modifications
Some inventories have added functionality on Bedrock, that does not exist on Java edition. For example, this includes:
- 2x2 crafting grid while in creative mode
- An option to rename maps in the cartography table
- Command block renaming or enabling/setting command block execution delays
To resolve this issue, this pack uses Json UI modification on these inventory UIs. Here's how:
`cartography_screen.json`
```json
{
"text_box_panel": {
"ignored": true
}
}
```
This hides the renaming field in the cartography table that cannot be used. This does not modify the textures or functionality,
but instead just alters the visual appearance for Bedrock players.
Hiding the 2x2 crafting grid is a bit more involved. We have to use bindings to only conditionally hide the 2x2 grid when we are in creative mode:
`inventory_screen.json`
```json
{
"crafting_panel_2x2": {
"modifications": [
{
"array_name": "bindings",
"operation": "insert_front",
"value": {
"binding_name": "(not #is_creative_mode)",
"binding_name_override": "#visible"
}
}
]
}
}
```
This uses the `#is_creative_mode` binding, and applies it to the crafting panel. Note that we insert this modification into the bindings array
instead of directly modifying the UI - this allows the GeyserOptionalPack to stay compatible with other resource packs that modify this screen.

View File

@@ -0,0 +1,5 @@
{
"text_box_panel": {
"ignored": true
}
}

View File

@@ -0,0 +1,23 @@
{
"left_scroll_panel_content/content_stack_panel/offset2": {
"ignored": true
},
"left_scroll_panel_content/content_stack_panel/offset_execute_on_first_tick": {
"ignored": true
},
"left_scroll_panel_content/content_stack_panel/option_label_execute_on_first_tick": {
"ignored": true
},
"left_scroll_panel_content/content_stack_panel/execute_on_first_tick_toggle": {
"ignored": true
},
"left_scroll_panel_content/content_stack_panel/offset_tick_delay": {
"ignored": true
},
"left_scroll_panel_content/content_stack_panel/option_label_tick_delay": {
"ignored": true
},
"left_scroll_panel_content/content_stack_panel/tick_delay_text": {
"ignored": true
}
}

14
ui/inventory_screen.json Normal file
View File

@@ -0,0 +1,14 @@
{
"crafting_panel_2x2": {
"modifications": [
{
"array_name": "bindings",
"operation": "insert_front",
"value": {
"binding_name": "(not #is_creative_mode)",
"binding_name_override": "#visible"
}
}
]
}
}

View File

@@ -0,0 +1,14 @@
{
"survival_panel_pocket": {
"modifications": [
{
"array_name": "bindings",
"operation": "insert_front",
"value": {
"binding_name": "(not #is_creative_mode)",
"binding_name_override": "#visible"
}
}
]
}
}

View File

@@ -1,26 +1,5 @@
{
"namespace": "scoreboard",
"scoreboard_sidebar_player": {
"type": "label",
"layer": 2,
"text": "#player_name_sidebar",
"size": [
"default",
10
],
"max_size": [
250,
10
],
"font_scale_factor": 1.0,
"locked_alpha": 1.0,
"color": "$player_name_color",
"bindings": [
{
"binding_name": "#player_name_sidebar",
"binding_type": "collection",
"binding_collection_name": "scoreboard_players"
}
]
"max_size": [ 250, 10 ]
}
}
}