From ea32b3b542c55f9610a25759c0a41b9f491f1f48 Mon Sep 17 00:00:00 2001 From: Aksiome <54895777+aksiome@users.noreply.github.com> Date: Tue, 26 Nov 2024 19:28:56 +0100 Subject: [PATCH 01/12] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20Dump=20to=202.2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.yml | 2 +- .../function/get_entity/registry/17.mcfunction | 1 + .../function/get_entity/registry/46.mcfunction | 2 ++ .../function/get_entity/registry/56.mcfunction | 1 + .../function/get_entity/registry/72.mcfunction | 17 +++++++++++++++++ .../data/bs.hitbox/predicate/salmon/large.json | 10 ++++++++++ .../data/bs.hitbox/predicate/salmon/small.json | 10 ++++++++++ .../tags/entity_type/size/group_64.json | 4 +++- .../tags/entity_type/size/group_8.json | 4 +++- .../bs.move/tags/block/can_pass_through.json | 3 +-- .../bs.view/tags/block/can_see_through.json | 3 +-- docs/CHANGELOG.md | 1 + docs/_static/switcher.json | 5 +++++ docs/modules/move.md | 4 ---- 14 files changed, 56 insertions(+), 11 deletions(-) create mode 100644 datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/72.mcfunction create mode 100644 datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/large.json create mode 100644 datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/small.json diff --git a/.env.yml b/.env.yml index 464d3f4dbc..853252b841 100644 --- a/.env.yml +++ b/.env.yml @@ -1,4 +1,4 @@ -mc_version: "1.21.2" +mc_version: "1.21.3" documentation_url: "https://bookshelf.docs.gunivers.net/" diff --git a/datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/17.mcfunction b/datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/17.mcfunction index a488f7ddb2..4a534ded66 100644 --- a/datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/17.mcfunction +++ b/datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/17.mcfunction @@ -14,4 +14,5 @@ # ------------------------------------------------------------------------------------------------------------ # dolphin group +execute unless predicate bs.hitbox:is_baby run return run data modify storage bs:out hitbox set value {width:0.585,height:0.39} data modify storage bs:out hitbox set value {width:0.9,height:0.6} diff --git a/datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/46.mcfunction b/datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/46.mcfunction index 33199266d3..6f6790b755 100644 --- a/datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/46.mcfunction +++ b/datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/46.mcfunction @@ -14,4 +14,6 @@ # ------------------------------------------------------------------------------------------------------------ # salmon group +execute unless predicate bs.hitbox:salmon/large run return run data modify storage bs:out hitbox set value {width:1.05,height:0.6} +execute unless predicate bs.hitbox:salmon/small run return run data modify storage bs:out hitbox set value {width:0.35,height:0.2} data modify storage bs:out hitbox set value {width:0.7,height:0.4} diff --git a/datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/56.mcfunction b/datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/56.mcfunction index 370a673d91..3713705586 100644 --- a/datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/56.mcfunction +++ b/datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/56.mcfunction @@ -14,4 +14,5 @@ # ------------------------------------------------------------------------------------------------------------ # squid group +execute unless predicate bs.hitbox:is_baby run return run data modify storage bs:out hitbox set value {width:0.4,height:0.4} data modify storage bs:out hitbox set value {width:0.8,height:0.8} diff --git a/datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/72.mcfunction b/datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/72.mcfunction new file mode 100644 index 0000000000..3661171ad3 --- /dev/null +++ b/datapacks/Bookshelf/data/bs.hitbox/function/get_entity/registry/72.mcfunction @@ -0,0 +1,17 @@ +# ------------------------------------------------------------------------------------------------------------ +# Copyright (c) 2024 Gunivers +# +# This file is part of the Bookshelf project (https://github.com/Gunivers/Bookshelf). +# +# This source code is subject to the terms of the Mozilla Public License, v. 2.0. +# If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Conditions: +# - You may use this file in compliance with the MPL v2.0 +# - Any modifications must be documented and disclosed under the same license +# +# For more details, refer to the MPL v2.0. +# ------------------------------------------------------------------------------------------------------------ + +# creaking group +data modify storage bs:out hitbox set value {width:0.9,height:2.7} diff --git a/datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/large.json b/datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/large.json new file mode 100644 index 0000000000..0b5dbf7305 --- /dev/null +++ b/datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/large.json @@ -0,0 +1,10 @@ +{ + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:salmon", + "variant": "large" + } + } +} diff --git a/datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/small.json b/datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/small.json new file mode 100644 index 0000000000..11fc3fd9be --- /dev/null +++ b/datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/small.json @@ -0,0 +1,10 @@ +{ + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type_specific": { + "type": "minecraft:salmon", + "variant": "small" + } + } +} diff --git a/datapacks/Bookshelf/data/bs.hitbox/tags/entity_type/size/group_64.json b/datapacks/Bookshelf/data/bs.hitbox/tags/entity_type/size/group_64.json index 2f7d051626..719adf8b1f 100644 --- a/datapacks/Bookshelf/data/bs.hitbox/tags/entity_type/size/group_64.json +++ b/datapacks/Bookshelf/data/bs.hitbox/tags/entity_type/size/group_64.json @@ -7,6 +7,8 @@ "minecraft:player", "minecraft:goat", "minecraft:villager", - "minecraft:armadillo" + "minecraft:armadillo", + "minecraft:creaking", + "minecraft:creaking_transient" ] } diff --git a/datapacks/Bookshelf/data/bs.hitbox/tags/entity_type/size/group_8.json b/datapacks/Bookshelf/data/bs.hitbox/tags/entity_type/size/group_8.json index ac8e7cfd46..5cf9eaab74 100644 --- a/datapacks/Bookshelf/data/bs.hitbox/tags/entity_type/size/group_8.json +++ b/datapacks/Bookshelf/data/bs.hitbox/tags/entity_type/size/group_8.json @@ -31,6 +31,8 @@ "minecraft:turtle", "minecraft:vex", "minecraft:warden", - "minecraft:wither" + "minecraft:wither", + "minecraft:creaking", + "minecraft:creaking_transient" ] } diff --git a/datapacks/Bookshelf/data/bs.move/tags/block/can_pass_through.json b/datapacks/Bookshelf/data/bs.move/tags/block/can_pass_through.json index 5270652b4c..d3fab70779 100644 --- a/datapacks/Bookshelf/data/bs.move/tags/block/can_pass_through.json +++ b/datapacks/Bookshelf/data/bs.move/tags/block/can_pass_through.json @@ -10,8 +10,7 @@ "#minecraft:rails", "#minecraft:saplings", "#minecraft:signs", - "#minecraft:small_flowers", - "#minecraft:tall_flowers", + "#minecraft:flowers", "minecraft:big_dripleaf_stem", "minecraft:brain_coral_fan", "minecraft:brain_coral_wall_fan", diff --git a/datapacks/Bookshelf/data/bs.view/tags/block/can_see_through.json b/datapacks/Bookshelf/data/bs.view/tags/block/can_see_through.json index 5270652b4c..d3fab70779 100644 --- a/datapacks/Bookshelf/data/bs.view/tags/block/can_see_through.json +++ b/datapacks/Bookshelf/data/bs.view/tags/block/can_see_through.json @@ -10,8 +10,7 @@ "#minecraft:rails", "#minecraft:saplings", "#minecraft:signs", - "#minecraft:small_flowers", - "#minecraft:tall_flowers", + "#minecraft:flowers", "minecraft:big_dripleaf_stem", "minecraft:brain_coral_fan", "minecraft:brain_coral_wall_fan", diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 541a6ffc32..1d5c368c75 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -40,6 +40,7 @@ Bookshelf is now based on **Minecraft 1.21.2**. - **[#265](https://github.com/Gunivers/Bookshelf/pull/265)** Optimized `bs.schedule` module for improved performance. - **[#265](https://github.com/Gunivers/Bookshelf/pull/265)** Enabled `bs.move` module to function effectively at higher coordinate ranges. Collision detection has also been improved and should be more robust. - **[#265](https://github.com/Gunivers/Bookshelf/pull/265)** Load tags do not load modules in isolation anymore. This can now be done using the `exclusive_load` tag. +- **[#276](https://github.com/Gunivers/Bookshelf/pull/276)** Add new hitboxes (new babies and salmon variants). ### πŸ› Fixes diff --git a/docs/_static/switcher.json b/docs/_static/switcher.json index eb40cfce46..4e9579a3e9 100644 --- a/docs/_static/switcher.json +++ b/docs/_static/switcher.json @@ -10,6 +10,11 @@ "url": "https://bookshelf.docs.gunivers.net/en/latest/", "preferred": true }, + { + "name": "2.2.0", + "version": "v2.2.0", + "url": "https://bookshelf.docs.gunivers.net/en/v2.2.0/" + }, { "name": "2.1.1", "version": "v2.1.1", diff --git a/docs/modules/move.md b/docs/modules/move.md index d37d2638b2..ecf42a461b 100644 --- a/docs/modules/move.md +++ b/docs/modules/move.md @@ -15,10 +15,6 @@ Make your entity move exactly the way you want them to! -- Heraclitus ``` -```{important} -This module limits the world size to 2,147,480 to prevent scoreboard overflow. -``` - --- ## πŸ”§ Functions From d4c1a32ffb57439b3c4f86e8d3b169b92c1925a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Giraudet?= Date: Sat, 30 Nov 2024 19:45:00 +0100 Subject: [PATCH 02/12] Push button component --- .../data/bs.component/.metadata/module.json | 9 +++++++ .../create_block_display_button.mcfunction | 27 +++++++++++++++++++ .../create_item_display_button.mcfunction | 27 +++++++++++++++++++ .../button/create_simple_button.mcfunction | 21 +++++++++++++++ .../function/button/setup_button.mcfunction | 24 +++++++++++++++++ .../function/create_block_display_button.json | 16 +++++++++++ .../function/create_item_display_button.json | 16 +++++++++++ .../tags/function/create_simple_button.json | 16 +++++++++++ 8 files changed, 156 insertions(+) create mode 100644 datapacks/Bookshelf/data/bs.component/.metadata/module.json create mode 100644 datapacks/Bookshelf/data/bs.component/function/button/create_block_display_button.mcfunction create mode 100644 datapacks/Bookshelf/data/bs.component/function/button/create_item_display_button.mcfunction create mode 100644 datapacks/Bookshelf/data/bs.component/function/button/create_simple_button.mcfunction create mode 100644 datapacks/Bookshelf/data/bs.component/function/button/setup_button.mcfunction create mode 100644 datapacks/Bookshelf/data/bs.component/tags/function/create_block_display_button.json create mode 100644 datapacks/Bookshelf/data/bs.component/tags/function/create_item_display_button.json create mode 100644 datapacks/Bookshelf/data/bs.component/tags/function/create_simple_button.json diff --git a/datapacks/Bookshelf/data/bs.component/.metadata/module.json b/datapacks/Bookshelf/data/bs.component/.metadata/module.json new file mode 100644 index 0000000000..903bd7a667 --- /dev/null +++ b/datapacks/Bookshelf/data/bs.component/.metadata/module.json @@ -0,0 +1,9 @@ +{ + "name": "bs.component", + "display_name": "Component", + "description": "Create and manage graphical components based on Minecraft entities.", + "documentation": "https://bookshelf.docs.gunivers.net/en/latest/modules/component.html", + "dependencies": [ + "bs.interaction" + ] +} diff --git a/datapacks/Bookshelf/data/bs.component/function/button/create_block_display_button.mcfunction b/datapacks/Bookshelf/data/bs.component/function/button/create_block_display_button.mcfunction new file mode 100644 index 0000000000..4809473723 --- /dev/null +++ b/datapacks/Bookshelf/data/bs.component/function/button/create_block_display_button.mcfunction @@ -0,0 +1,27 @@ +# ------------------------------------------------------------------------------------------------------------ +# Copyright (c) 2024 Gunivers +# +# This file is part of the Bookshelf project (https://github.com/Gunivers/Bookshelf). +# +# This source code is subject to the terms of the Mozilla Public License, v. 2.0. +# If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Conditions: +# - You may use this file in compliance with the MPL v2.0 +# - Any modifications must be documented and disclosed under the same license +# +# For more details, refer to the MPL v2.0. +# ------------------------------------------------------------------------------------------------------------ + +# Create the base properties +$data modify storage bs:ctx _ set value { width: $(width), height: $(height), on_click: "$(on_click)" , block_state: { Name: $(block), Properties: $(properties) }, Tags: ["bs.component.block_display"], transformation: { translation: [-0.5f, 0.5f, -0.5f]}, with: {}} +$data modify storage bs:ctx _ merge value $(with) +data modify storage bs:ctx _.with.hover set from storage bs:ctx _.hover +data modify storage bs:ctx _.with.hover_leave set from storage bs:ctx _.hover_leave + +# Summon the item display +execute summon block_display run data modify entity @s {} merge from storage bs:ctx _ + +# Create the button at the item display's position +execute as @n[tag=bs.component.block_display] at @s anchored feet positioned ^ ^ ^ run function bs.component:button/create_simple_button with storage bs:ctx _ +tag @n[tag=bs.component.block_display] remove bs.component.block_display diff --git a/datapacks/Bookshelf/data/bs.component/function/button/create_item_display_button.mcfunction b/datapacks/Bookshelf/data/bs.component/function/button/create_item_display_button.mcfunction new file mode 100644 index 0000000000..3fb40b58a0 --- /dev/null +++ b/datapacks/Bookshelf/data/bs.component/function/button/create_item_display_button.mcfunction @@ -0,0 +1,27 @@ +# ------------------------------------------------------------------------------------------------------------ +# Copyright (c) 2024 Gunivers +# +# This file is part of the Bookshelf project (https://github.com/Gunivers/Bookshelf). +# +# This source code is subject to the terms of the Mozilla Public License, v. 2.0. +# If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Conditions: +# - You may use this file in compliance with the MPL v2.0 +# - Any modifications must be documented and disclosed under the same license +# +# For more details, refer to the MPL v2.0. +# ------------------------------------------------------------------------------------------------------------ + +# Create the base properties +$data modify storage bs:ctx _ set value { width: $(width), height: $(height), on_click: "$(on_click)" , item: { id: $(item) }, Tags: ["bs.component.item_display"], transformation: { translation: [0f, 0.5f, 0f]}, with: {}} +$data modify storage bs:ctx _ merge value $(with) +data modify storage bs:ctx _.with.hover set from storage bs:ctx _.hover +data modify storage bs:ctx _.with.hover_leave set from storage bs:ctx _.hover_leave + +# Summon the item display +execute summon item_display run data modify entity @s {} merge from storage bs:ctx _ + +# Create the button at the item display's position +execute as @n[tag=bs.component.item_display] at @s anchored feet positioned ^ ^ ^ run function bs.component:button/create_simple_button with storage bs:ctx _ +tag @n[tag=bs.component.item_display] remove bs.component.item_display diff --git a/datapacks/Bookshelf/data/bs.component/function/button/create_simple_button.mcfunction b/datapacks/Bookshelf/data/bs.component/function/button/create_simple_button.mcfunction new file mode 100644 index 0000000000..8bf68f57a8 --- /dev/null +++ b/datapacks/Bookshelf/data/bs.component/function/button/create_simple_button.mcfunction @@ -0,0 +1,21 @@ +# ------------------------------------------------------------------------------------------------------------ +# Copyright (c) 2024 Gunivers +# +# This file is part of the Bookshelf project (https://github.com/Gunivers/Bookshelf). +# +# This source code is subject to the terms of the Mozilla Public License, v. 2.0. +# If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Conditions: +# - You may use this file in compliance with the MPL v2.0 +# - Any modifications must be documented and disclosed under the same license +# +# For more details, refer to the MPL v2.0. +# ------------------------------------------------------------------------------------------------------------ + +tag @s add bs.component.icon +$data modify storage bs.ctx _ set value { width: $(width), height: $(height), on_click: "$(on_click)", hover: "function #bs.interaction:callback/glow", hover_leave: "function #bs.interaction:callback/unglow" } +data modify storage bs.ctx _.hover set from storage bs.ctx _.with.hover +data modify storage bs.ctx _.hover_leave set from storage bs.ctx _.with.hover_leave +execute summon minecraft:interaction run function bs.component:button/setup_button with storage bs.ctx _ +tag @s remove bs.component.icon diff --git a/datapacks/Bookshelf/data/bs.component/function/button/setup_button.mcfunction b/datapacks/Bookshelf/data/bs.component/function/button/setup_button.mcfunction new file mode 100644 index 0000000000..35f961008e --- /dev/null +++ b/datapacks/Bookshelf/data/bs.component/function/button/setup_button.mcfunction @@ -0,0 +1,24 @@ +# ------------------------------------------------------------------------------------------------------------ +# Copyright (c) 2024 Gunivers +# +# This file is part of the Bookshelf project (https://github.com/Gunivers/Bookshelf). +# +# This source code is subject to the terms of the Mozilla Public License, v. 2.0. +# If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Conditions: +# - You may use this file in compliance with the MPL v2.0 +# - Any modifications must be documented and disclosed under the same license +# +# For more details, refer to the MPL v2.0. +# ------------------------------------------------------------------------------------------------------------ + +# Set properties +$data merge entity @s {width: $(width), height: $(height), Tags: ["bs.component.button"]} + +# Setup the click event +$function #bs.interaction:on_right_click { run: "$(on_click)", executor: "source" } + +# Setup hover events for glow effect +$function #bs.interaction:on_hover { run: "$(hover)", executor: { selector: "@e[tag=bs.component.icon, limit=1]", lazy: false }} +$function #bs.interaction:on_hover_leave { run: "$(hover_leave)", executor: { selector: "@e[tag=bs.component.icon, limit=1]", lazy: false }} diff --git a/datapacks/Bookshelf/data/bs.component/tags/function/create_block_display_button.json b/datapacks/Bookshelf/data/bs.component/tags/function/create_block_display_button.json new file mode 100644 index 0000000000..9792aeba1f --- /dev/null +++ b/datapacks/Bookshelf/data/bs.component/tags/function/create_block_display_button.json @@ -0,0 +1,16 @@ +{ + "__bookshelf__": { + "feature": true, + "documentation": "https://bookshelf.docs.gunivers.net/en/latest/modules/component.html#create-button", + "authors": [ + "theogiraudet" + ], + "created": { + "date": "2024/11/28", + "minecraft_version": "1.21.3" + } + }, + "values": [ + "bs.component:button/create_block_display_button" + ] +} diff --git a/datapacks/Bookshelf/data/bs.component/tags/function/create_item_display_button.json b/datapacks/Bookshelf/data/bs.component/tags/function/create_item_display_button.json new file mode 100644 index 0000000000..b9bddf19ff --- /dev/null +++ b/datapacks/Bookshelf/data/bs.component/tags/function/create_item_display_button.json @@ -0,0 +1,16 @@ +{ + "__bookshelf__": { + "feature": true, + "documentation": "https://bookshelf.docs.gunivers.net/en/latest/modules/component.html#create-button", + "authors": [ + "theogiraudet" + ], + "created": { + "date": "2024/11/28", + "minecraft_version": "1.21.3" + } + }, + "values": [ + "bs.component:button/create_item_display_button" + ] +} diff --git a/datapacks/Bookshelf/data/bs.component/tags/function/create_simple_button.json b/datapacks/Bookshelf/data/bs.component/tags/function/create_simple_button.json new file mode 100644 index 0000000000..f0600aa10d --- /dev/null +++ b/datapacks/Bookshelf/data/bs.component/tags/function/create_simple_button.json @@ -0,0 +1,16 @@ +{ + "__bookshelf__": { + "feature": true, + "documentation": "https://bookshelf.docs.gunivers.net/en/latest/modules/component.html#create-button", + "authors": [ + "theogiraudet" + ], + "created": { + "date": "2024/11/23", + "minecraft_version": "1.21.3" + } + }, + "values": [ + "bs.component:button/create_simple_button" + ] +} From cebb44fafa09e8a84d6efc582b947e22c699a879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Giraudet?= Date: Mon, 24 Feb 2025 22:49:48 +0100 Subject: [PATCH 03/12] Update to the new architecture --- .../data/bs.component/.metadata/module.json | 9 --------- .../data/bs.hitbox/predicate/salmon/large.json | 10 ---------- .../data/bs.hitbox/predicate/salmon/small.json | 10 ---------- modules/bs.component/README.md | 10 ++++++++++ .../create_block_display_button.mcfunction | 4 ++-- .../create_item_display_button.mcfunction | 4 ++-- .../button/create_simple_button.mcfunction | 4 ++-- .../function/button/setup_button.mcfunction | 4 ++-- .../function/create_block_display_button.json | 0 .../function/create_item_display_button.json | 0 .../tags/function/create_simple_button.json | 0 modules/bs.component/module.json | 17 +++++++++++++++++ 12 files changed, 35 insertions(+), 37 deletions(-) delete mode 100644 datapacks/Bookshelf/data/bs.component/.metadata/module.json delete mode 100644 datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/large.json delete mode 100644 datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/small.json create mode 100644 modules/bs.component/README.md rename {datapacks/Bookshelf => modules/bs.component}/data/bs.component/function/button/create_block_display_button.mcfunction (96%) rename {datapacks/Bookshelf => modules/bs.component}/data/bs.component/function/button/create_item_display_button.mcfunction (96%) rename {datapacks/Bookshelf => modules/bs.component}/data/bs.component/function/button/create_simple_button.mcfunction (95%) rename {datapacks/Bookshelf => modules/bs.component}/data/bs.component/function/button/setup_button.mcfunction (95%) rename {datapacks/Bookshelf => modules/bs.component}/data/bs.component/tags/function/create_block_display_button.json (100%) rename {datapacks/Bookshelf => modules/bs.component}/data/bs.component/tags/function/create_item_display_button.json (100%) rename {datapacks/Bookshelf => modules/bs.component}/data/bs.component/tags/function/create_simple_button.json (100%) create mode 100644 modules/bs.component/module.json diff --git a/datapacks/Bookshelf/data/bs.component/.metadata/module.json b/datapacks/Bookshelf/data/bs.component/.metadata/module.json deleted file mode 100644 index 903bd7a667..0000000000 --- a/datapacks/Bookshelf/data/bs.component/.metadata/module.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "bs.component", - "display_name": "Component", - "description": "Create and manage graphical components based on Minecraft entities.", - "documentation": "https://bookshelf.docs.gunivers.net/en/latest/modules/component.html", - "dependencies": [ - "bs.interaction" - ] -} diff --git a/datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/large.json b/datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/large.json deleted file mode 100644 index 0b5dbf7305..0000000000 --- a/datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/large.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "type_specific": { - "type": "minecraft:salmon", - "variant": "large" - } - } -} diff --git a/datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/small.json b/datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/small.json deleted file mode 100644 index 11fc3fd9be..0000000000 --- a/datapacks/Bookshelf/data/bs.hitbox/predicate/salmon/small.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "type_specific": { - "type": "minecraft:salmon", - "variant": "small" - } - } -} diff --git a/modules/bs.component/README.md b/modules/bs.component/README.md new file mode 100644 index 0000000000..cbedd7bc75 --- /dev/null +++ b/modules/bs.component/README.md @@ -0,0 +1,10 @@ +# πŸ… Bookshelf Component + +This module provides a set of components that can be used to simplify the development of complex GUI in Minecraft. + +For more details and usage examples, check out the Bookshelf [documentation](https://docs.mcbookshelf.dev/en/latest/modules/component.html). + + +## πŸ“– About Bookshelf + +This module is part of the [Bookshelf Project](https://docs.mcbookshelf.dev/en/latest/index.html), a modular library datapack designed to simplify complex systems in Minecraft. Explore the full range of modules and discover how Bookshelf can simplify your Minecraft creations! diff --git a/datapacks/Bookshelf/data/bs.component/function/button/create_block_display_button.mcfunction b/modules/bs.component/data/bs.component/function/button/create_block_display_button.mcfunction similarity index 96% rename from datapacks/Bookshelf/data/bs.component/function/button/create_block_display_button.mcfunction rename to modules/bs.component/data/bs.component/function/button/create_block_display_button.mcfunction index 4809473723..901dee064e 100644 --- a/datapacks/Bookshelf/data/bs.component/function/button/create_block_display_button.mcfunction +++ b/modules/bs.component/data/bs.component/function/button/create_block_display_button.mcfunction @@ -1,7 +1,7 @@ # ------------------------------------------------------------------------------------------------------------ -# Copyright (c) 2024 Gunivers +# Copyright (c) 2025 Gunivers # -# This file is part of the Bookshelf project (https://github.com/Gunivers/Bookshelf). +# This file is part of the Bookshelf project (https://github.com/mcbookshelf/Bookshelf). # # This source code is subject to the terms of the Mozilla Public License, v. 2.0. # If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/datapacks/Bookshelf/data/bs.component/function/button/create_item_display_button.mcfunction b/modules/bs.component/data/bs.component/function/button/create_item_display_button.mcfunction similarity index 96% rename from datapacks/Bookshelf/data/bs.component/function/button/create_item_display_button.mcfunction rename to modules/bs.component/data/bs.component/function/button/create_item_display_button.mcfunction index 3fb40b58a0..35bd6fd582 100644 --- a/datapacks/Bookshelf/data/bs.component/function/button/create_item_display_button.mcfunction +++ b/modules/bs.component/data/bs.component/function/button/create_item_display_button.mcfunction @@ -1,7 +1,7 @@ # ------------------------------------------------------------------------------------------------------------ -# Copyright (c) 2024 Gunivers +# Copyright (c) 2025 Gunivers # -# This file is part of the Bookshelf project (https://github.com/Gunivers/Bookshelf). +# This file is part of the Bookshelf project (https://github.com/mcbookshelf/Bookshelf). # # This source code is subject to the terms of the Mozilla Public License, v. 2.0. # If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/datapacks/Bookshelf/data/bs.component/function/button/create_simple_button.mcfunction b/modules/bs.component/data/bs.component/function/button/create_simple_button.mcfunction similarity index 95% rename from datapacks/Bookshelf/data/bs.component/function/button/create_simple_button.mcfunction rename to modules/bs.component/data/bs.component/function/button/create_simple_button.mcfunction index 8bf68f57a8..49fab296d8 100644 --- a/datapacks/Bookshelf/data/bs.component/function/button/create_simple_button.mcfunction +++ b/modules/bs.component/data/bs.component/function/button/create_simple_button.mcfunction @@ -1,7 +1,7 @@ # ------------------------------------------------------------------------------------------------------------ -# Copyright (c) 2024 Gunivers +# Copyright (c) 2025 Gunivers # -# This file is part of the Bookshelf project (https://github.com/Gunivers/Bookshelf). +# This file is part of the Bookshelf project (https://github.com/mcbookshelf/Bookshelf). # # This source code is subject to the terms of the Mozilla Public License, v. 2.0. # If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/datapacks/Bookshelf/data/bs.component/function/button/setup_button.mcfunction b/modules/bs.component/data/bs.component/function/button/setup_button.mcfunction similarity index 95% rename from datapacks/Bookshelf/data/bs.component/function/button/setup_button.mcfunction rename to modules/bs.component/data/bs.component/function/button/setup_button.mcfunction index 35f961008e..68c0286ffe 100644 --- a/datapacks/Bookshelf/data/bs.component/function/button/setup_button.mcfunction +++ b/modules/bs.component/data/bs.component/function/button/setup_button.mcfunction @@ -1,7 +1,7 @@ # ------------------------------------------------------------------------------------------------------------ -# Copyright (c) 2024 Gunivers +# Copyright (c) 2025 Gunivers # -# This file is part of the Bookshelf project (https://github.com/Gunivers/Bookshelf). +# This file is part of the Bookshelf project (https://github.com/mcbookshelf/Bookshelf). # # This source code is subject to the terms of the Mozilla Public License, v. 2.0. # If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/datapacks/Bookshelf/data/bs.component/tags/function/create_block_display_button.json b/modules/bs.component/data/bs.component/tags/function/create_block_display_button.json similarity index 100% rename from datapacks/Bookshelf/data/bs.component/tags/function/create_block_display_button.json rename to modules/bs.component/data/bs.component/tags/function/create_block_display_button.json diff --git a/datapacks/Bookshelf/data/bs.component/tags/function/create_item_display_button.json b/modules/bs.component/data/bs.component/tags/function/create_item_display_button.json similarity index 100% rename from datapacks/Bookshelf/data/bs.component/tags/function/create_item_display_button.json rename to modules/bs.component/data/bs.component/tags/function/create_item_display_button.json diff --git a/datapacks/Bookshelf/data/bs.component/tags/function/create_simple_button.json b/modules/bs.component/data/bs.component/tags/function/create_simple_button.json similarity index 100% rename from datapacks/Bookshelf/data/bs.component/tags/function/create_simple_button.json rename to modules/bs.component/data/bs.component/tags/function/create_simple_button.json diff --git a/modules/bs.component/module.json b/modules/bs.component/module.json new file mode 100644 index 0000000000..477ee34f59 --- /dev/null +++ b/modules/bs.component/module.json @@ -0,0 +1,17 @@ +{ + "extend": "../config.json", + "data_pack": { + "name": "bs.component", + "load": "." + }, + "meta": { + "name": "Component", + "slug": "bookshelf-component", + "description": "A set of components that can be used to simplify the development of complex GUI in Minecraft.", + "documentation": "https://docs.mcbookshelf.dev/en/latest/modules/component.html", + "tags": ["runtime"], + "dependencies": [ + "bs.interaction" + ] + } +} From 132782f170d17d878a11808ed1e9a22f018e90fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Giraudet?= Date: Tue, 25 Feb 2025 20:48:03 +0100 Subject: [PATCH 04/12] Progress --- docs/modules.md | 1 + docs/modules/component.md | 70 +++++++++++++++++++ .../create_block_display_button.mcfunction | 4 +- .../create_item_display_button.mcfunction | 2 +- 4 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 docs/modules/component.md diff --git a/docs/modules.md b/docs/modules.md index 517ffef5c8..55d5980461 100644 --- a/docs/modules.md +++ b/docs/modules.md @@ -42,6 +42,7 @@ Here are some of the key terms used throughout the documentation. modules/bitwise modules/block modules/color +modules/component modules/environment modules/generation modules/health diff --git a/docs/modules/component.md b/docs/modules/component.md new file mode 100644 index 0000000000..de3ee1aca0 --- /dev/null +++ b/docs/modules/component.md @@ -0,0 +1,70 @@ +# πŸ‘† Component + +**`#bs.component:help`** + +Create easily graphical components in Minecraft. + +```{epigraph} +"About ten years ago, most push buttons went β€œ3D”. Using shades of grey, they appear to pop out of the screen. This is not just to look cool: it’s important because 3D buttons afford pushing." + +-- joel Spolsky +``` + +The Component API is a high-level API to create GUIs components. +This API use the Interaction API under the hood to create the components and the events. +You can so fallback on the Interaction API to create more complex components. + +--- + +## πŸ”§ Functions + +You can find below all functions available in this API. + +--- + +### Clear Events + +```{function} #bs.interaction:clear_events + +Clear events registered for the specified interaction entity. + +:Inputs: + **Execution `as `**: Interaction entity for which the events will be cleared. + + **Function macro**: + :::{treeview} + - {nbt}`compound` **Arguments**: + - {nbt}`compound` **with**: Parameters to filter which events to clear. Clear all events if empty. + - {nbt}`string` **type**: Specify the type of events to clear. + - {nbt}`int` **id**: Specify the ID of events to clear. + ::: + +:Outputs: + **Return**: The number of events removed. + + **State**: The specified events for the interaction entity will be removed. +``` + +*Clear hover events for the interaction entity:* + +```mcfunction +summon minecraft:interaction ~ ~ ~ { Tags: ["bs.entity.interaction"], width: 1f, height: 1f } + +# Register hover events for the interaction +execute as @n[tag=bs.entity.interaction] run function #bs.interaction:on_hover { run: "say Hovered", executor: "target" } + +# Clear hover events for the interaction +execute as @n[tag=bs.entity.interaction] run function #bs.interaction:clear_events { with: { type: "hover" } } +``` + +> **Credits**: theogiraudet + +--- + +
+ +**πŸ’¬ Did it help you?** + +Feel free to leave your questions and feedbacks below! + +
diff --git a/modules/bs.component/data/bs.component/function/button/create_block_display_button.mcfunction b/modules/bs.component/data/bs.component/function/button/create_block_display_button.mcfunction index 901dee064e..018f53863a 100644 --- a/modules/bs.component/data/bs.component/function/button/create_block_display_button.mcfunction +++ b/modules/bs.component/data/bs.component/function/button/create_block_display_button.mcfunction @@ -14,7 +14,7 @@ # ------------------------------------------------------------------------------------------------------------ # Create the base properties -$data modify storage bs:ctx _ set value { width: $(width), height: $(height), on_click: "$(on_click)" , block_state: { Name: $(block), Properties: $(properties) }, Tags: ["bs.component.block_display"], transformation: { translation: [-0.5f, 0.5f, -0.5f]}, with: {}} +$data modify storage bs:ctx _ set value { width: $(width), height: $(height), on_click: "$(on_click)" , block_state: { Name: $(block), Properties: $(properties) }, Tags: ["bs.component.block_display", "smithed.entity", "smithed.strict"], transformation: { translation: [-0.5f, 0.5f, -0.5f]}, with: {}} $data modify storage bs:ctx _ merge value $(with) data modify storage bs:ctx _.with.hover set from storage bs:ctx _.hover data modify storage bs:ctx _.with.hover_leave set from storage bs:ctx _.hover_leave @@ -22,6 +22,6 @@ data modify storage bs:ctx _.with.hover_leave set from storage bs:ctx _.hover_le # Summon the item display execute summon block_display run data modify entity @s {} merge from storage bs:ctx _ -# Create the button at the item display's position +# Create the button at the block display's position execute as @n[tag=bs.component.block_display] at @s anchored feet positioned ^ ^ ^ run function bs.component:button/create_simple_button with storage bs:ctx _ tag @n[tag=bs.component.block_display] remove bs.component.block_display diff --git a/modules/bs.component/data/bs.component/function/button/create_item_display_button.mcfunction b/modules/bs.component/data/bs.component/function/button/create_item_display_button.mcfunction index 35bd6fd582..98e22cf7af 100644 --- a/modules/bs.component/data/bs.component/function/button/create_item_display_button.mcfunction +++ b/modules/bs.component/data/bs.component/function/button/create_item_display_button.mcfunction @@ -14,7 +14,7 @@ # ------------------------------------------------------------------------------------------------------------ # Create the base properties -$data modify storage bs:ctx _ set value { width: $(width), height: $(height), on_click: "$(on_click)" , item: { id: $(item) }, Tags: ["bs.component.item_display"], transformation: { translation: [0f, 0.5f, 0f]}, with: {}} +$data modify storage bs:ctx _ set value { width: $(width), height: $(height), on_click: "$(on_click)" , item: { id: $(item) }, Tags: ["bs.component.item_display", "smithed.entity", "smithed.strict"], transformation: { translation: [0f, 0.5f, 0f]}, with: {}} $data modify storage bs:ctx _ merge value $(with) data modify storage bs:ctx _.with.hover set from storage bs:ctx _.hover data modify storage bs:ctx _.with.hover_leave set from storage bs:ctx _.hover_leave From 8be82c740b32d53b91b3263725a21f4115aba4a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Giraudet?= Date: Tue, 25 Feb 2025 23:26:37 +0100 Subject: [PATCH 05/12] Push documentation progression --- docs/modules/component.md | 142 ++++++++++++++++++++++++++++++++++---- 1 file changed, 127 insertions(+), 15 deletions(-) diff --git a/docs/modules/component.md b/docs/modules/component.md index de3ee1aca0..416bcb68e4 100644 --- a/docs/modules/component.md +++ b/docs/modules/component.md @@ -22,40 +22,152 @@ You can find below all functions available in this API. --- -### Clear Events +### Create Button -```{function} #bs.interaction:clear_events +:::::{tab-set} +::::{tab-item} Block Display Button -Clear events registered for the specified interaction entity. +```{function} #bs.component:create_block_button + +Create a button represented by a block display. +The button trigger a given event when left clicked and by default glows when hovered and plays a sound when clicked. :Inputs: - **Execution `as `**: Interaction entity for which the events will be cleared. + **Execution `at `**: The position of the button. **Function macro**: :::{treeview} - {nbt}`compound` **Arguments**: - - {nbt}`compound` **with**: Parameters to filter which events to clear. Clear all events if empty. - - {nbt}`string` **type**: Specify the type of events to clear. - - {nbt}`int` **id**: Specify the ID of events to clear. + - {nbt}`float` **width**: The width of the button. This will also be used as the width of the interaction hitbox. + - {nbt}`float` **height**: The height of the button. This will also be used as the width of the interaction hitbox. + - {nbt}`string` **on_click**: The event to trigger when the button is left clicked. + - {nbt}`string` **block**: The block to use to display the button. + - {nbt}`compound` **properties**: The properties of the block to display. Same as block display NBT `properties`. + - {nbt}`compound` **with**: Optional parameters. + - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glow the block by default. + - {nbt}`string` **hover_leave**: The event to trigger when the mouse leave the button. Unglow the block by default. + - {nbt}`boolean` **click_sound**: If false, disable the click sound. + - {nbt}`compound` **display_data**: the display data. See [Display format](https://minecraft.wiki/w/Entity_format#Display). ::: :Outputs: - **Return**: The number of events removed. + **State**: A clickable button, represented by the defined block display. +``` + +*Add a new button represented by a 1Γ—1 slime block that trigger "say Clicked" when clicked:* + +```mcfunction +function #bs.component:create_block_button { width: 1f, height: 1f, on_click: "say Clicked", block: "minecraft:slime_block", properties: {}, with: {} } + +# Same command but with more readable syntax +function #bs.component:create_block_button { \ + width: 1f, \ + height: 1f, \ + on_click: "say Clicked", \ + block: "minecraft:slime_block", \ + properties: {}, \ + with: {} \ +} +``` +:::: +::::{tab-item} Item Display Button + +```{function} #bs.component:create_item_button + +Create a button represented by an item display. +The button trigger a given event when left clicked and by default glows when hovered and plays a sound when clicked. - **State**: The specified events for the interaction entity will be removed. +:Inputs: + **Execution `at `**: The position of the button. + + **Function macro**: + :::{treeview} + - {nbt}`compound` **Arguments**: + - {nbt}`float` **width**: The width of the button. This will also be used as the width of the interaction hitbox. + - {nbt}`float` **height**: The height of the button. This will also be used as the width of the interaction hitbox. + - {nbt}`string` **on_click**: The event to trigger when the button is left clicked. + - {nbt}`string` **item**: The item to use to display the button. + - {nbt}`compound` **with**: Optional parameters. + - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glow the item by default. + - {nbt}`string` **hover_leave**: The event to trigger when the mouse leave the button. Unglow the item by default. + - {nbt}`boolean` **click_sound**: If false, disable the click sound. + - {nbt}`string` **item_display**: The model to display. Can be `none`, `thirdperson_lefthand`, `thirdperson_righthand`, `firstperson_lefthand`, `firstperson_righthand`, `head`, `gui`, `ground`, or `fixed`. Defaults to `none`. + - {nbt}`compound` **item**: the properties of the item to display. Empty by default. + - {nbt}`compound` **components**: the data components of the item. See [Data component format](https://minecraft.wiki/w/Data_component_format). + - {nbt}`compound` **display_data**: the display data. See [Display format](https://minecraft.wiki/w/Entity_format#Display). + ::: + +:Outputs: + **State**: A clickable button, represented by the defined item display. ``` -*Clear hover events for the interaction entity:* +*Add a new button represented by a 1Γ—1 slimeball that trigger "say Clicked" when clicked:* ```mcfunction -summon minecraft:interaction ~ ~ ~ { Tags: ["bs.entity.interaction"], width: 1f, height: 1f } +function #bs.component:create_block_button { width: 1f, height: 1f, on_click: "say Clicked", item: "minecraft:slimeball", with: {} } + +# Same command but with more readable syntax +function #bs.component:create_item_button { \ + width: 1f, \ + height: 1f, \ + on_click: "say Clicked", \ + item: "minecraft:slimeball", \ + with: {} \ +} +``` +:::: +::::{tab-item} Item Display Button + +```{function} #bs.component:create_text_button -# Register hover events for the interaction -execute as @n[tag=bs.entity.interaction] run function #bs.interaction:on_hover { run: "say Hovered", executor: "target" } +Create a button represented by an text display. +The button trigger a given event when left clicked and by default glows when hovered and plays a sound when clicked. + +:Inputs: + **Execution `at `**: The position of the button. -# Clear hover events for the interaction -execute as @n[tag=bs.entity.interaction] run function #bs.interaction:clear_events { with: { type: "hover" } } + **Function macro**: + :::{treeview} + - {nbt}`compound` **Arguments**: + - {nbt}`float` **width**: The width of the button. This will also be used as the width of the interaction hitbox. + - {nbt}`float` **height**: The height of the button. This will also be used as the width of the interaction hitbox. + - {nbt}`string` **on_click**: The event to trigger when the button is left clicked. + - {nbt}`string` **text**: The text to display on the button. Should be [raw JSON text](https://minecraft.wiki/w/Text_component_format). + - {nbt}`compound` **with**: Optional parameters. + - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glow the text by default. + - {nbt}`string` **hover_leave**: The event to trigger when the mouse leave the button. Unglow the text by default. + - {nbt}`boolean` **click_sound**: If false, disable the click sound. + - {nbt}`string` **alignment**: The alignment of the text. Can be `center`, `left`, or `right`. Defaults to `center`. + - {nbt}`int` **background**: The background color of the text. Default to `1073741824`. + - {nbt}`boolean` **default_background**: If true, use the default background color. Defaults to `false`. + - {nbt}`int` **line_width**: The maximum width of the text (note: new line can be also added with `\n` characters). Defaults to `200`. + - {nbt}`boolean` **see_through**: If true, the text can be seen through blocks. Defaults to `false`. + - {nbt}`boolean` **shadow**: If true, the text has a shadow. Defaults to `false`. + - {nbt}`int` **text_opacity**: The opacity of the text. Defaults to `255` (completely opaque). + - {nbt}`compound` **display_data**: the display data. See [Display format](https://minecraft.wiki/w/Entity_format#Display). + ::: + + +:Outputs: + **State**: A clickable button, represented by the defined text display. +``` + +*Add a new button represented by the "Hello World!" text that trigger "say Hello World!" when clicked:* + +```mcfunction +function #bs.component:create_text_button { width: 1f, height: 1f, on_click: "say Hello World!", text: "Hello World!", with: {} } + +# Same command but with more readable syntax +function #bs.component:create_text_button { \ + width: 1f, \ + height: 1f, \ + on_click: "say Hello World!", \ + text: "Hello World!", \ + with: {} \ +} ``` +:::: +::::: > **Credits**: theogiraudet From 96ae707c822506c1c8d83b15e2f3ed7ef78029a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Giraudet?= Date: Tue, 25 Feb 2025 23:42:22 +0100 Subject: [PATCH 06/12] Fix doc --- docs/modules/component.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/docs/modules/component.md b/docs/modules/component.md index 416bcb68e4..f8052ac02b 100644 --- a/docs/modules/component.md +++ b/docs/modules/component.md @@ -5,7 +5,7 @@ Create easily graphical components in Minecraft. ```{epigraph} -"About ten years ago, most push buttons went β€œ3D”. Using shades of grey, they appear to pop out of the screen. This is not just to look cool: it’s important because 3D buttons afford pushing." +"About ten years ago, most push buttons went "3D". Using shades of grey, they appear to pop out of the screen. This is not just to look cool: it's important because 3D buttons afford pushing." -- joel Spolsky ``` @@ -47,7 +47,7 @@ The button trigger a given event when left clicked and by default glows when hov - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glow the block by default. - {nbt}`string` **hover_leave**: The event to trigger when the mouse leave the button. Unglow the block by default. - {nbt}`boolean` **click_sound**: If false, disable the click sound. - - {nbt}`compound` **display_data**: the display data. See [Display format](https://minecraft.wiki/w/Entity_format#Display). + - {nbt}`compound` **display_data**: the display data. See `Display format `_. ::: :Outputs: @@ -93,8 +93,8 @@ The button trigger a given event when left clicked and by default glows when hov - {nbt}`boolean` **click_sound**: If false, disable the click sound. - {nbt}`string` **item_display**: The model to display. Can be `none`, `thirdperson_lefthand`, `thirdperson_righthand`, `firstperson_lefthand`, `firstperson_righthand`, `head`, `gui`, `ground`, or `fixed`. Defaults to `none`. - {nbt}`compound` **item**: the properties of the item to display. Empty by default. - - {nbt}`compound` **components**: the data components of the item. See [Data component format](https://minecraft.wiki/w/Data_component_format). - - {nbt}`compound` **display_data**: the display data. See [Display format](https://minecraft.wiki/w/Entity_format#Display). + - {nbt}`compound` **components**: the data components of the item. See `Data component format `_. + - {nbt}`compound` **display_data**: the display data. See `Display format `_. ::: :Outputs: @@ -104,7 +104,7 @@ The button trigger a given event when left clicked and by default glows when hov *Add a new button represented by a 1Γ—1 slimeball that trigger "say Clicked" when clicked:* ```mcfunction -function #bs.component:create_block_button { width: 1f, height: 1f, on_click: "say Clicked", item: "minecraft:slimeball", with: {} } +function #bs.component:create_item_button { width: 1f, height: 1f, on_click: "say Clicked", item: "minecraft:slimeball", with: {} } # Same command but with more readable syntax function #bs.component:create_item_button { \ @@ -116,7 +116,7 @@ function #bs.component:create_item_button { \ } ``` :::: -::::{tab-item} Item Display Button +::::{tab-item} Text Display Button ```{function} #bs.component:create_text_button @@ -132,7 +132,7 @@ The button trigger a given event when left clicked and by default glows when hov - {nbt}`float` **width**: The width of the button. This will also be used as the width of the interaction hitbox. - {nbt}`float` **height**: The height of the button. This will also be used as the width of the interaction hitbox. - {nbt}`string` **on_click**: The event to trigger when the button is left clicked. - - {nbt}`string` **text**: The text to display on the button. Should be [raw JSON text](https://minecraft.wiki/w/Text_component_format). + - {nbt}`string` **text**: The text to display on the button. Should be `raw JSON text `_. - {nbt}`compound` **with**: Optional parameters. - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glow the text by default. - {nbt}`string` **hover_leave**: The event to trigger when the mouse leave the button. Unglow the text by default. @@ -143,11 +143,10 @@ The button trigger a given event when left clicked and by default glows when hov - {nbt}`int` **line_width**: The maximum width of the text (note: new line can be also added with `\n` characters). Defaults to `200`. - {nbt}`boolean` **see_through**: If true, the text can be seen through blocks. Defaults to `false`. - {nbt}`boolean` **shadow**: If true, the text has a shadow. Defaults to `false`. - - {nbt}`int` **text_opacity**: The opacity of the text. Defaults to `255` (completely opaque). - - {nbt}`compound` **display_data**: the display data. See [Display format](https://minecraft.wiki/w/Entity_format#Display). + - {nbt}`int` **text_opacity**: The opacity of the text. Default to `255` (completely opaque). + - {nbt}`compound` **display_data**: the display data. See `Display format `_. ::: - :Outputs: **State**: A clickable button, represented by the defined text display. ``` From 155ee8ed670ebc9ee9ed7c01f54b366b781ebb13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Giraudet?= Date: Tue, 25 Feb 2025 23:46:15 +0100 Subject: [PATCH 07/12] Remove link --- docs/modules/component.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/modules/component.md b/docs/modules/component.md index f8052ac02b..5e319d4363 100644 --- a/docs/modules/component.md +++ b/docs/modules/component.md @@ -47,7 +47,7 @@ The button trigger a given event when left clicked and by default glows when hov - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glow the block by default. - {nbt}`string` **hover_leave**: The event to trigger when the mouse leave the button. Unglow the block by default. - {nbt}`boolean` **click_sound**: If false, disable the click sound. - - {nbt}`compound` **display_data**: the display data. See `Display format `_. + - {nbt}`compound` **display_data**: the display data. See Display format in the Minecraft Wiki. ::: :Outputs: @@ -93,8 +93,8 @@ The button trigger a given event when left clicked and by default glows when hov - {nbt}`boolean` **click_sound**: If false, disable the click sound. - {nbt}`string` **item_display**: The model to display. Can be `none`, `thirdperson_lefthand`, `thirdperson_righthand`, `firstperson_lefthand`, `firstperson_righthand`, `head`, `gui`, `ground`, or `fixed`. Defaults to `none`. - {nbt}`compound` **item**: the properties of the item to display. Empty by default. - - {nbt}`compound` **components**: the data components of the item. See `Data component format `_. - - {nbt}`compound` **display_data**: the display data. See `Display format `_. + - {nbt}`compound` **components**: the data components of the item. See Data component format in the Minecraft Wiki. + - {nbt}`compound` **display_data**: the display data. See Display format in the Minecraft Wiki. ::: :Outputs: @@ -132,7 +132,7 @@ The button trigger a given event when left clicked and by default glows when hov - {nbt}`float` **width**: The width of the button. This will also be used as the width of the interaction hitbox. - {nbt}`float` **height**: The height of the button. This will also be used as the width of the interaction hitbox. - {nbt}`string` **on_click**: The event to trigger when the button is left clicked. - - {nbt}`string` **text**: The text to display on the button. Should be `raw JSON text `_. + - {nbt}`string` **text**: The text to display on the button. Should be a raw JSON text (see Text component format in the Minecraft Wiki). - {nbt}`compound` **with**: Optional parameters. - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glow the text by default. - {nbt}`string` **hover_leave**: The event to trigger when the mouse leave the button. Unglow the text by default. @@ -144,7 +144,7 @@ The button trigger a given event when left clicked and by default glows when hov - {nbt}`boolean` **see_through**: If true, the text can be seen through blocks. Defaults to `false`. - {nbt}`boolean` **shadow**: If true, the text has a shadow. Defaults to `false`. - {nbt}`int` **text_opacity**: The opacity of the text. Default to `255` (completely opaque). - - {nbt}`compound` **display_data**: the display data. See `Display format `_. + - {nbt}`compound` **display_data**: the display data. See Display format in the Minecraft Wiki. ::: :Outputs: From 2a6f98f1c6722c1b701ff7e004689a5deee1e223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Giraudet?= Date: Tue, 25 Feb 2025 23:46:39 +0100 Subject: [PATCH 08/12] Replace boolean by bool --- docs/modules/component.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/modules/component.md b/docs/modules/component.md index 5e319d4363..c98cc68b2c 100644 --- a/docs/modules/component.md +++ b/docs/modules/component.md @@ -46,7 +46,7 @@ The button trigger a given event when left clicked and by default glows when hov - {nbt}`compound` **with**: Optional parameters. - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glow the block by default. - {nbt}`string` **hover_leave**: The event to trigger when the mouse leave the button. Unglow the block by default. - - {nbt}`boolean` **click_sound**: If false, disable the click sound. + - {nbt}`bool` **click_sound**: If false, disable the click sound. - {nbt}`compound` **display_data**: the display data. See Display format in the Minecraft Wiki. ::: @@ -90,7 +90,7 @@ The button trigger a given event when left clicked and by default glows when hov - {nbt}`compound` **with**: Optional parameters. - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glow the item by default. - {nbt}`string` **hover_leave**: The event to trigger when the mouse leave the button. Unglow the item by default. - - {nbt}`boolean` **click_sound**: If false, disable the click sound. + - {nbt}`bool` **click_sound**: If false, disable the click sound. - {nbt}`string` **item_display**: The model to display. Can be `none`, `thirdperson_lefthand`, `thirdperson_righthand`, `firstperson_lefthand`, `firstperson_righthand`, `head`, `gui`, `ground`, or `fixed`. Defaults to `none`. - {nbt}`compound` **item**: the properties of the item to display. Empty by default. - {nbt}`compound` **components**: the data components of the item. See Data component format in the Minecraft Wiki. @@ -136,13 +136,13 @@ The button trigger a given event when left clicked and by default glows when hov - {nbt}`compound` **with**: Optional parameters. - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glow the text by default. - {nbt}`string` **hover_leave**: The event to trigger when the mouse leave the button. Unglow the text by default. - - {nbt}`boolean` **click_sound**: If false, disable the click sound. + - {nbt}`bool` **click_sound**: If false, disable the click sound. - {nbt}`string` **alignment**: The alignment of the text. Can be `center`, `left`, or `right`. Defaults to `center`. - {nbt}`int` **background**: The background color of the text. Default to `1073741824`. - - {nbt}`boolean` **default_background**: If true, use the default background color. Defaults to `false`. + - {nbt}`bool` **default_background**: If true, use the default background color. Defaults to `false`. - {nbt}`int` **line_width**: The maximum width of the text (note: new line can be also added with `\n` characters). Defaults to `200`. - - {nbt}`boolean` **see_through**: If true, the text can be seen through blocks. Defaults to `false`. - - {nbt}`boolean` **shadow**: If true, the text has a shadow. Defaults to `false`. + - {nbt}`bool` **see_through**: If true, the text can be seen through blocks. Defaults to `false`. + - {nbt}`bool` **shadow**: If true, the text has a shadow. Defaults to `false`. - {nbt}`int` **text_opacity**: The opacity of the text. Default to `255` (completely opaque). - {nbt}`compound` **display_data**: the display data. See Display format in the Minecraft Wiki. ::: From 71b9f6889ab096d18720bf986f3b1109333d5385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Giraudet?= Date: Wed, 26 Feb 2025 18:55:29 +0100 Subject: [PATCH 09/12] Fix mistakes --- docs/modules/component.md | 68 +++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/docs/modules/component.md b/docs/modules/component.md index c98cc68b2c..f3e1de1874 100644 --- a/docs/modules/component.md +++ b/docs/modules/component.md @@ -2,23 +2,23 @@ **`#bs.component:help`** -Create easily graphical components in Minecraft. +Create graphical components in Minecraft easily. ```{epigraph} "About ten years ago, most push buttons went "3D". Using shades of grey, they appear to pop out of the screen. This is not just to look cool: it's important because 3D buttons afford pushing." --- joel Spolsky +-- Joel Spolsky ``` -The Component API is a high-level API to create GUIs components. -This API use the Interaction API under the hood to create the components and the events. -You can so fallback on the Interaction API to create more complex components. +The Component API is a high-level API to create GUI components. +This API uses the Interaction API under the hood to create components and events. +You can fall back to the Interaction API to create more complex components. --- ## πŸ”§ Functions -You can find below all functions available in this API. +You can find all available functions in this API below. --- @@ -30,7 +30,7 @@ You can find below all functions available in this API. ```{function} #bs.component:create_block_button Create a button represented by a block display. -The button trigger a given event when left clicked and by default glows when hovered and plays a sound when clicked. +The button triggers a given event when left-clicked and by default glows when hovered and plays a sound when clicked. :Inputs: **Execution `at `**: The position of the button. @@ -40,21 +40,21 @@ The button trigger a given event when left clicked and by default glows when hov - {nbt}`compound` **Arguments**: - {nbt}`float` **width**: The width of the button. This will also be used as the width of the interaction hitbox. - {nbt}`float` **height**: The height of the button. This will also be used as the width of the interaction hitbox. - - {nbt}`string` **on_click**: The event to trigger when the button is left clicked. + - {nbt}`string` **on_click**: The event to trigger when the button is left-clicked. - {nbt}`string` **block**: The block to use to display the button. - {nbt}`compound` **properties**: The properties of the block to display. Same as block display NBT `properties`. - {nbt}`compound` **with**: Optional parameters. - - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glow the block by default. - - {nbt}`string` **hover_leave**: The event to trigger when the mouse leave the button. Unglow the block by default. - - {nbt}`bool` **click_sound**: If false, disable the click sound. - - {nbt}`compound` **display_data**: the display data. See Display format in the Minecraft Wiki. + - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glows the block by default. + - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the button. Unglows the block by default. + - {nbt}`bool` **click_sound**: If false, disables the click sound. + - {nbt}`compound` **display_data**: The display data. See Display format in the Minecraft Wiki. ::: :Outputs: **State**: A clickable button, represented by the defined block display. ``` -*Add a new button represented by a 1Γ—1 slime block that trigger "say Clicked" when clicked:* +*Add a new button represented by a 1Γ—1 slime block that triggers "say Clicked" when clicked:* ```mcfunction function #bs.component:create_block_button { width: 1f, height: 1f, on_click: "say Clicked", block: "minecraft:slime_block", properties: {}, with: {} } @@ -75,7 +75,7 @@ function #bs.component:create_block_button { \ ```{function} #bs.component:create_item_button Create a button represented by an item display. -The button trigger a given event when left clicked and by default glows when hovered and plays a sound when clicked. +The button triggers a given event when left-clicked and by default glows when hovered and plays a sound when clicked. :Inputs: **Execution `at `**: The position of the button. @@ -85,23 +85,23 @@ The button trigger a given event when left clicked and by default glows when hov - {nbt}`compound` **Arguments**: - {nbt}`float` **width**: The width of the button. This will also be used as the width of the interaction hitbox. - {nbt}`float` **height**: The height of the button. This will also be used as the width of the interaction hitbox. - - {nbt}`string` **on_click**: The event to trigger when the button is left clicked. + - {nbt}`string` **on_click**: The event to trigger when the button is left-clicked. - {nbt}`string` **item**: The item to use to display the button. - {nbt}`compound` **with**: Optional parameters. - - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glow the item by default. - - {nbt}`string` **hover_leave**: The event to trigger when the mouse leave the button. Unglow the item by default. - - {nbt}`bool` **click_sound**: If false, disable the click sound. + - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glows the item by default. + - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the button. Unglows the item by default. + - {nbt}`bool` **click_sound**: If false, disables the click sound. - {nbt}`string` **item_display**: The model to display. Can be `none`, `thirdperson_lefthand`, `thirdperson_righthand`, `firstperson_lefthand`, `firstperson_righthand`, `head`, `gui`, `ground`, or `fixed`. Defaults to `none`. - - {nbt}`compound` **item**: the properties of the item to display. Empty by default. - - {nbt}`compound` **components**: the data components of the item. See Data component format in the Minecraft Wiki. - - {nbt}`compound` **display_data**: the display data. See Display format in the Minecraft Wiki. + - {nbt}`compound` **item**: The properties of the item to display. Empty by default. + - {nbt}`compound` **components**: The data components of the item. See Data component format in the Minecraft Wiki. + - {nbt}`compound` **display_data**: The display data. See Display format in the Minecraft Wiki. ::: :Outputs: **State**: A clickable button, represented by the defined item display. ``` -*Add a new button represented by a 1Γ—1 slimeball that trigger "say Clicked" when clicked:* +*Add a new button represented by a 1Γ—1 slimeball that triggers "say Clicked" when clicked:* ```mcfunction function #bs.component:create_item_button { width: 1f, height: 1f, on_click: "say Clicked", item: "minecraft:slimeball", with: {} } @@ -120,8 +120,8 @@ function #bs.component:create_item_button { \ ```{function} #bs.component:create_text_button -Create a button represented by an text display. -The button trigger a given event when left clicked and by default glows when hovered and plays a sound when clicked. +Create a button represented by a text display. +The button triggers a given event when left-clicked and by default glows when hovered and plays a sound when clicked. :Inputs: **Execution `at `**: The position of the button. @@ -131,27 +131,27 @@ The button trigger a given event when left clicked and by default glows when hov - {nbt}`compound` **Arguments**: - {nbt}`float` **width**: The width of the button. This will also be used as the width of the interaction hitbox. - {nbt}`float` **height**: The height of the button. This will also be used as the width of the interaction hitbox. - - {nbt}`string` **on_click**: The event to trigger when the button is left clicked. + - {nbt}`string` **on_click**: The event to trigger when the button is left-clicked. - {nbt}`string` **text**: The text to display on the button. Should be a raw JSON text (see Text component format in the Minecraft Wiki). - {nbt}`compound` **with**: Optional parameters. - - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glow the text by default. - - {nbt}`string` **hover_leave**: The event to trigger when the mouse leave the button. Unglow the text by default. - - {nbt}`bool` **click_sound**: If false, disable the click sound. + - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glows the text by default. + - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the button. Unglows the text by default. + - {nbt}`bool` **click_sound**: If false, disables the click sound. - {nbt}`string` **alignment**: The alignment of the text. Can be `center`, `left`, or `right`. Defaults to `center`. - - {nbt}`int` **background**: The background color of the text. Default to `1073741824`. - - {nbt}`bool` **default_background**: If true, use the default background color. Defaults to `false`. - - {nbt}`int` **line_width**: The maximum width of the text (note: new line can be also added with `\n` characters). Defaults to `200`. + - {nbt}`int` **background**: The background color of the text. Defaults to `1073741824`. + - {nbt}`bool` **default_background**: If true, uses the default background color. Defaults to `false`. + - {nbt}`int` **line_width**: The maximum width of the text (note: new lines can also be added with `\n` characters). Defaults to `200`. - {nbt}`bool` **see_through**: If true, the text can be seen through blocks. Defaults to `false`. - {nbt}`bool` **shadow**: If true, the text has a shadow. Defaults to `false`. - - {nbt}`int` **text_opacity**: The opacity of the text. Default to `255` (completely opaque). - - {nbt}`compound` **display_data**: the display data. See Display format in the Minecraft Wiki. + - {nbt}`int` **text_opacity**: The opacity of the text. Defaults to `255` (completely opaque). + - {nbt}`compound` **display_data**: The display data. See Display format in the Minecraft Wiki. ::: :Outputs: **State**: A clickable button, represented by the defined text display. ``` -*Add a new button represented by the "Hello World!" text that trigger "say Hello World!" when clicked:* +*Add a new button represented by the "Hello World!" text that triggers "say Hello World!" when clicked:* ```mcfunction function #bs.component:create_text_button { width: 1f, height: 1f, on_click: "say Hello World!", text: "Hello World!", with: {} } From 8d65528a82015d66286ca6bfdbcb2611374fe822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Giraudet?= Date: Wed, 26 Feb 2025 21:36:37 +0100 Subject: [PATCH 10/12] Push shape --- docs/modules/component.md | 554 +++++++++++++++++++++++++++++++++++--- 1 file changed, 524 insertions(+), 30 deletions(-) diff --git a/docs/modules/component.md b/docs/modules/component.md index f3e1de1874..212d585b5e 100644 --- a/docs/modules/component.md +++ b/docs/modules/component.md @@ -46,8 +46,11 @@ The button triggers a given event when left-clicked and by default glows when ho - {nbt}`compound` **with**: Optional parameters. - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glows the block by default. - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the button. Unglows the block by default. + - {nbt}`string` **tooltip**: The tooltip to display when the button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. + - {nbt}`bool` **disabled**: If true, the button is disabled (unclickable). Defaults to `false`. + - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the button is disabled. Defaults to `true`. - {nbt}`bool` **click_sound**: If false, disables the click sound. - - {nbt}`compound` **display_data**: The display data. See Display format in the Minecraft Wiki. + - {nbt}`compound` **entity_data**: Other entity NBTs. ::: :Outputs: @@ -58,16 +61,6 @@ The button triggers a given event when left-clicked and by default glows when ho ```mcfunction function #bs.component:create_block_button { width: 1f, height: 1f, on_click: "say Clicked", block: "minecraft:slime_block", properties: {}, with: {} } - -# Same command but with more readable syntax -function #bs.component:create_block_button { \ - width: 1f, \ - height: 1f, \ - on_click: "say Clicked", \ - block: "minecraft:slime_block", \ - properties: {}, \ - with: {} \ -} ``` :::: ::::{tab-item} Item Display Button @@ -90,11 +83,14 @@ The button triggers a given event when left-clicked and by default glows when ho - {nbt}`compound` **with**: Optional parameters. - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glows the item by default. - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the button. Unglows the item by default. + - {nbt}`string` **tooltip**: The tooltip to display when the button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. + - {nbt}`bool` **disabled**: If true, the button is disabled (unclickable). Defaults to `false`. + - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the button is disabled. Defaults to `true`. - {nbt}`bool` **click_sound**: If false, disables the click sound. - {nbt}`string` **item_display**: The model to display. Can be `none`, `thirdperson_lefthand`, `thirdperson_righthand`, `firstperson_lefthand`, `firstperson_righthand`, `head`, `gui`, `ground`, or `fixed`. Defaults to `none`. - {nbt}`compound` **item**: The properties of the item to display. Empty by default. - {nbt}`compound` **components**: The data components of the item. See Data component format in the Minecraft Wiki. - - {nbt}`compound` **display_data**: The display data. See Display format in the Minecraft Wiki. + - {nbt}`compound` **entity_data**: Other entity NBTs. ::: :Outputs: @@ -105,15 +101,6 @@ The button triggers a given event when left-clicked and by default glows when ho ```mcfunction function #bs.component:create_item_button { width: 1f, height: 1f, on_click: "say Clicked", item: "minecraft:slimeball", with: {} } - -# Same command but with more readable syntax -function #bs.component:create_item_button { \ - width: 1f, \ - height: 1f, \ - on_click: "say Clicked", \ - item: "minecraft:slimeball", \ - with: {} \ -} ``` :::: ::::{tab-item} Text Display Button @@ -136,6 +123,9 @@ The button triggers a given event when left-clicked and by default glows when ho - {nbt}`compound` **with**: Optional parameters. - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glows the text by default. - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the button. Unglows the text by default. + - {nbt}`string` **tooltip**: The tooltip to display when the button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. + - {nbt}`bool` **disabled**: If true, the button is disabled (unclickable). Defaults to `false`. + - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the button is disabled. Defaults to `true`. - {nbt}`bool` **click_sound**: If false, disables the click sound. - {nbt}`string` **alignment**: The alignment of the text. Can be `center`, `left`, or `right`. Defaults to `center`. - {nbt}`int` **background**: The background color of the text. Defaults to `1073741824`. @@ -144,7 +134,7 @@ The button triggers a given event when left-clicked and by default glows when ho - {nbt}`bool` **see_through**: If true, the text can be seen through blocks. Defaults to `false`. - {nbt}`bool` **shadow**: If true, the text has a shadow. Defaults to `false`. - {nbt}`int` **text_opacity**: The opacity of the text. Defaults to `255` (completely opaque). - - {nbt}`compound` **display_data**: The display data. See Display format in the Minecraft Wiki. + - {nbt}`compound` **entity_data**: Other entity NBTs. ::: :Outputs: @@ -155,15 +145,292 @@ The button triggers a given event when left-clicked and by default glows when ho ```mcfunction function #bs.component:create_text_button { width: 1f, height: 1f, on_click: "say Hello World!", text: "Hello World!", with: {} } +``` +:::: +::::: + +> **Credits**: theogiraudet + +--- + +### Create Checkbox + +:::::{tab-set} +::::{tab-item} Block Display Checkbox + +```{function} #bs.component:create_block_checkbox + +Create a checkbox represented by a block display. +The checkbox can be selected or deselected and triggers a given event for each state. +By default, the checkbox is not selected, will glow when selected, unglow when deselected and play a sound when clicked. + +:Inputs: + **Execution `at `**: The position of the checkbox. + + **Function macro**: + :::{treeview} + - {nbt}`compound` **Arguments**: + - {nbt}`float` **width**: The width of the checkbox. This will also be used as the width of the interaction hitbox. + - {nbt}`float` **height**: The height of the checkbox. This will also be used as the width of the interaction hitbox. + - {nbt}`string` **on_selected**: The event to trigger when the checkbox is selected. + - {nbt}`string` **on_deselected**: The event to trigger when the checkbox is deselected. + - {nbt}`string` **block**: The block to use to display the checkbox. + - {nbt}`compound` **properties**: The properties of the block to display. Same as block display NBT `properties`. + - {nbt}`compound` **with**: Optional parameters. + - {nbt}`string` **hover**: The event to trigger when the checkbox is hovered. Do nothing by default. + - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the checkbox. Do nothing by default. + - {nbt}`bool` **selected**: If true, the checkbox is selected by default. Defaults to `false`. + - {nbt}`bool` **disabled**: If true, the checkbox is disabled (unclickable). Defaults to `false`. + - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the checkbox is disabled. Defaults to `true`. + - {nbt}`string` **tooltip**: The tooltip to display when the checkbox is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. + - {nbt}`bool` **click_sound**: If false, disables the click sound. + - {nbt}`bool` **glow**: If true, the checkbox will glow when selected. Defaults to `true`. + - {nbt}`compound` **entity_data**: Other entity NBTs. + ::: + +:Outputs: + **State**: A clickable checkbox, represented by the defined block display. +``` + +*Add a new checkbox represented by a 1Γ—1 slime block that triggers "say Selected" when selected and "say Deselected" when deselected:* + +```mcfunction +function #bs.component:create_block_checkbox { width: 1f, height: 1f, on_selected: "say Selected", on_deselected: "say Deselected", block: "minecraft:slime_block", properties: {}, with: {} } +``` +:::: +::::{tab-item} Item Display Checkbox + +```{function} #bs.component:create_item_checkbox + +Create a checkbox represented by an item display. +The checkbox can be selected or deselected and triggers a given event for each state. +By default, the checkbox is not selected, will glow when selected, unglow when deselected and play a sound when clicked. + +:Inputs: + **Execution `at `**: The position of the checkbox. + + **Function macro**: + :::{treeview} + - {nbt}`compound` **Arguments**: + - {nbt}`float` **width**: The width of the checkbox. This will also be used as the width of the interaction hitbox. + - {nbt}`float` **height**: The height of the checkbox. This will also be used as the width of the interaction hitbox. + - {nbt}`string` **on_selected**: The event to trigger when the checkbox is selected. + - {nbt}`string` **on_deselected**: The event to trigger when the checkbox is deselected. + - {nbt}`string` **item**: The item to use to display the checkbox. + - {nbt}`compound` **with**: Optional parameters. + - {nbt}`string` **hover**: The event to trigger when the checkbox is hovered. Do nothing by default. + - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the checkbox. Do nothing by default. + - {nbt}`bool` **selected**: If true, the checkbox is selected by default. Defaults to `false`. + - {nbt}`bool` **disabled**: If true, the checkbox is disabled (unclickable). Defaults to `false`. + - {nbt}`string` **tooltip**: The tooltip to display when the checkbox is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. + - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the checkbox is disabled. Defaults to `true`. + - {nbt}`bool` **click_sound**: If false, disables the click sound. + - {nbt}`bool` **glow**: If true, the checkbox will glow when selected. Defaults to `true`. + - {nbt}`string` **item_display**: The model to display. Can be `none`, `thirdperson_lefthand`, `thirdperson_righthand`, `firstperson_lefthand`, `firstperson_righthand`, `head`, `gui`, `ground`, or `fixed`. Defaults to `none`. + - {nbt}`compound` **item**: The properties of the item to display. Empty by default. + - {nbt}`compound` **components**: The data components of the item. See Data component format in the Minecraft Wiki. + - {nbt}`compound` **entity_data**: Other entity NBTs. + ::: + +:Outputs: + **State**: A clickable checkbox, represented by the defined item display. +``` + +*Add a new checkbox represented by a 1Γ—1 slimeball that triggers "say Selected" when selected and "say Deselected" when deselected:* + +```mcfunction +function #bs.component:create_item_checkbox { width: 1f, height: 1f, on_selected: "say Selected", on_deselected: "say Deselected", item: "minecraft:slimeball", with: {} } +``` +:::: +::::{tab-item} Text Display Checkbox + +```{function} #bs.component:create_text_checkbox + +Create a checkbox represented by a text display. +The checkbox can be selected or deselected and triggers a given event for each state. +By default, the checkbox is not selected, will glow when selected, unglow when deselected and play a sound when clicked. + +:Inputs: + **Execution `at `**: The position of the checkbox. + + **Function macro**: + :::{treeview} + - {nbt}`compound` **Arguments**: + - {nbt}`float` **width**: The width of the checkbox. This will also be used as the width of the interaction hitbox. + - {nbt}`float` **height**: The height of the checkbox. This will also be used as the width of the interaction hitbox. + - {nbt}`string` **on_selected**: The event to trigger when the checkbox is selected. + - {nbt}`string` **on_deselected**: The event to trigger when the checkbox is deselected. + - {nbt}`string` **text**: The text to display on the button. Should be a raw JSON text (see Text component format in the Minecraft Wiki). + - {nbt}`compound` **with**: Optional parameters. + - {nbt}`string` **hover**: The event to trigger when the checkbox is hovered. Do nothing by default. + - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the checkbox. Do nothing by default. + - {nbt}`bool` **selected**: If true, the checkbox is selected by default. Defaults to `false`. + - {nbt}`string` **tooltip**: The tooltip to display when the checkbox is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. + - {nbt}`bool` **disabled**: If true, the checkbox is disabled (unclickable). Defaults to `false`. + - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the checkbox is disabled. Defaults to `true`. + - {nbt}`bool` **click_sound**: If false, disables the click sound. + - {nbt}`bool` **glow**: If true, the checkbox will glow when selected. Defaults to `true`. + - {nbt}`string` **alignment**: The alignment of the text. Can be `center`, `left`, or `right`. Defaults to `center`. + - {nbt}`int` **background**: The background color of the text. Defaults to `1073741824`. + - {nbt}`bool` **default_background**: If true, uses the default background color. Defaults to `false`. + - {nbt}`int` **line_width**: The maximum width of the text (note: new lines can also be added with `\n` characters). Defaults to `200`. + - {nbt}`bool` **see_through**: If true, the text can be seen through blocks. Defaults to `false`. + - {nbt}`bool` **shadow**: If true, the text has a shadow. Defaults to `false`. + - {nbt}`int` **text_opacity**: The opacity of the text. Defaults to `255` (completely opaque). + - {nbt}`compound` **entity_data**: Other entity NBTs. + ::: + +:Outputs: + **State**: A clickable checkbox, represented by the defined text display. +``` + +*Add a new checkbox represented by the "Hello World!" text that triggers "say Selected" when selected and "say Deselected" when deselected:* + +```mcfunction +function #bs.component:create_text_checkbox { width: 1f, height: 1f, on_selected: "say Selected", on_deselected: "say Deselected", text: "Hello World!", with: {} } +``` +:::: +::::: + +> **Credits**: theogiraudet + +--- + +### Create Radio Button + +:::::{tab-set} +::::{tab-item} Block Display Radio Button + +```{function} #bs.component:create_block_radio_button + +Create a radio button represented by a block display. +By default, do nothing when clicked and must be put in a group to be functional. +When in group and selected, will glow and play a sound. +By default, the radio button is not deselected. + +:Inputs: + **Execution `at `**: The position of the radio button. + + **Function macro**: + :::{treeview} + - {nbt}`compound` **Arguments**: + - {nbt}`float` **width**: The width of the radio button. This will also be used as the width of the interaction hitbox. + - {nbt}`float` **height**: The height of the radio button. This will also be used as the width of the interaction hitbox. + - {nbt}`string` **on_selected**: The event to trigger when the radio button is selected. + - {nbt}`string` **block**: The block to use to display the radio button. + - {nbt}`compound` **properties**: The properties of the block to display. Same as block display NBT `properties`. + - {nbt}`compound` **with**: Optional parameters. + - {nbt}`string` **hover**: The event to trigger when the radio button is hovered. Do nothing by default. + - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the radio button. Do nothing by default. + - {nbt}`bool` **selected**: If true, the radio button is selected by default. Defaults to `false`. + - {nbt}`string` **tooltip**: The tooltip to display when the radio button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. + - {nbt}`bool` **disabled**: If true, the radio button is disabled (unclickable). Defaults to `false`. + - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the radio button is disabled. Defaults to `true`. + - {nbt}`bool` **click_sound**: If false, disables the click sound. + - {nbt}`bool` **glow**: If true, the radio button will glow when selected. Defaults to `true`. + - {nbt}`compound` **entity_data**: Other entity NBTs. + ::: + +:Outputs: + **State**: A clickable radio button, represented by the defined block display. +``` + +*Add a new radio button represented by a 1Γ—1 slime block that triggers "say Selected" when selected and in a group with other radio buttons:* + +```mcfunction +function #bs.component:create_block_radio_button { width: 1f, height: 1f, block: "minecraft:slime_block", properties: {}, with: {} } +``` +:::: +::::{tab-item} Item Display Radio Button + +```{function} #bs.component:create_item_radio_button + +Create a radio button represented by an item display. +By default, do nothing when clicked and must be put in a group to be functional. +When in group and selected, will glow and play a sound. +By default, the radio button is not deselected. + +:Inputs: + **Execution `at `**: The position of the radio button. + + **Function macro**: + :::{treeview} + - {nbt}`compound` **Arguments**: + - {nbt}`float` **width**: The width of the radio button. This will also be used as the width of the interaction hitbox. + - {nbt}`float` **height**: The height of the radio button. This will also be used as the width of the interaction hitbox. + - {nbt}`string` **on_selected**: The event to trigger when the radio button is selected. + - {nbt}`string` **item**: The item to use to display the radio button. + - {nbt}`compound` **with**: Optional parameters. + - {nbt}`string` **hover**: The event to trigger when the radio button is hovered. Do nothing by default. + - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the radio button. Do nothing by default. + - {nbt}`bool` **selected**: If true, the radio button is selected by default. Defaults to `false`. + - {nbt}`string` **tooltip**: The tooltip to display when the radio button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. + - {nbt}`bool` **disabled**: If true, the radio button is disabled (unclickable). Defaults to `false`. + - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the radio button is disabled. Defaults to `true`. + - {nbt}`bool` **click_sound**: If false, disables the click sound. + - {nbt}`bool` **glow**: If true, the radio button will glow when selected. Defaults to `true`. + - {nbt}`string` **item_display**: The model to display. Can be `none`, `thirdperson_lefthand`, `thirdperson_righthand`, `firstperson_lefthand`, `firstperson_righthand`, `head`, `gui`, `ground`, or `fixed`. Defaults to `none`. + - {nbt}`compound` **item**: The properties of the item to display. Empty by default. + - {nbt}`compound` **components**: The data components of the item. See Data component format in the Minecraft Wiki. + - {nbt}`compound` **entity_data**: Other entity NBTs. + ::: + +:Outputs: + **State**: A clickable radio button, represented by the defined item display. +``` + +*Add a new radio button represented by a 1Γ—1 slimeball that triggers "say Selected" when selected and in a group with other radio buttons:* + +```mcfunction +function #bs.component:create_item_radio_button { width: 1f, height: 1f, on_selected: "say Selected", item: "minecraft:slimeball", with: {} } +``` +:::: +::::{tab-item} Text Display Radio Button + +```{function} #bs.component:create_text_radio_button + +Create a radio button represented by a text display. +By default, do nothing when clicked and must be put in a group to be functional. +When in group and selected, will glow and play a sound. +By default, the radio button is not deselected. + +:Inputs: + **Execution `at `**: The position of the radio button. + + **Function macro**: + :::{treeview} + - {nbt}`compound` **Arguments**: + - {nbt}`float` **width**: The width of the radio button. This will also be used as the width of the interaction hitbox. + - {nbt}`float` **height**: The height of the radio button. This will also be used as the width of the interaction hitbox. + - {nbt}`string` **on_selected**: The event to trigger when the radio button is selected. + - {nbt}`string` **text**: The text to display on the button. Should be a raw JSON text (see Text component format in the Minecraft Wiki). + - {nbt}`compound` **with**: Optional parameters. + - {nbt}`string` **hover**: The event to trigger when the radio button is hovered. Do nothing by default. + - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the radio button. Do nothing by default. + - {nbt}`bool` **selected**: If true, the radio button is selected by default. Defaults to `false`. + - {nbt}`string` **tooltip**: The tooltip to display when the radio button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. + - {nbt}`bool` **disabled**: If true, the radio button is disabled (unclickable). Defaults to `false`. + - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the radio button is disabled. Defaults to `true`. + - {nbt}`bool` **click_sound**: If false, disables the click sound. + - {nbt}`bool` **glow**: If true, the radio button will glow when selected. Defaults to `true`. + - {nbt}`string` **alignment**: The alignment of the text. Can be `center`, `left`, or `right`. Defaults to `center`. + - {nbt}`int` **background**: The background color of the text. Defaults to `1073741824`. + - {nbt}`bool` **default_background**: If true, uses the default background color. Defaults to `false`. + - {nbt}`int` **line_width**: The maximum width of the text (note: new lines can also be added with `\n` characters). Defaults to `200`. + - {nbt}`bool` **see_through**: If true, the text can be seen through blocks. Defaults to `false`. + - {nbt}`bool` **shadow**: If true, the text has a shadow. Defaults to `false`. + - {nbt}`int` **text_opacity**: The opacity of the text. Defaults to `255` (completely opaque). + - {nbt}`compound` **entity_data**: Other entity NBTs. + ::: -# Same command but with more readable syntax -function #bs.component:create_text_button { \ - width: 1f, \ - height: 1f, \ - on_click: "say Hello World!", \ - text: "Hello World!", \ - with: {} \ -} +:Outputs: + **State**: A clickable radio button, represented by the defined text display. +``` + +*Add a new radio button represented by the "Hello World!" text that triggers "say Selected" when selected and "say Deselected" when deselected:* + +```mcfunction +function #bs.component:create_text_radio_button { width: 1f, height: 1f, on_selected: "say Selected", text: "Hello World!", with: {} } ``` :::: ::::: @@ -172,6 +439,233 @@ function #bs.component:create_text_button { \ --- +### Radio Button Group + +:::::{tab-set} +::::{tab-item} Group +```{function} #bs.component:create_radio_button_group + +Create a radio button group from existing radio buttons. +In a group, only one radio button can be selected at a time, triggering its `on_selected` event. + +:Inputs: + **Function macro**: + :::{treeview} + - {nbt}`string` **id**: An unique identifier for the radio button group. + - {nbt}`compound` **tag**: The tag that each radio button must have to be part of the group. + ::: + +:Outputs: + **State**: A radio button group. +``` + +*Add a new radio button group with two radio buttons:* + +```mcfunction +# Create two radio buttons +function #bs.component:create_block_button { width: 1f, height: 1f, on_click: "say Clicked", block: "minecraft:slime_block", properties: {}, with: { entity_data: { Tags: [ "bs.radio_button" ]}}} +execute positioned ~2 ~ ~ run function #bs.component:create_block_button { width: 1f, height: 1f, on_click: "say Clicked", block: "minecraft:slime_block", properties: {}, with: { entity_data: { Tags: [ "bs.radio_button" ]}}} + +# Create a radio button group +function #bs.component:create_radio_button_group { id: "my_radio_button_group", tag: "bs.radio_button" } +``` +:::: +::::{tab-item} Ungroup +```{function} #bs.component:ungroup + +Ungroup a radio button group. + +:Inputs: + **Function macro**: + :::{treeview} + - {nbt}`string` **id**: The unique identifier of the radio button group to ungroup. + ::: + +:Outputs: + **State**: The radio button group (only) is removed. +``` + +*Ungroup a radio button group:* + +```mcfunction +# Create two radio buttons +function #bs.component:create_block_radio_button { width: 1f, height: 1f, on_selected: "say Selected", block: "minecraft:slime_block", properties: {}, with: { entity_data: { Tags: [ "bs.radio_button" ]}}} +execute positioned ~2 ~ ~ run function #bs.component:create_block_radio_button { width: 1f, height: 1f, on_selected: "say Selected", block: "minecraft:slime_block", properties: {}, with: { entity_data: { Tags: [ "bs.radio_button" ]}}} + +# Create a radio button group +function #bs.component:create_radio_button_group { id: "my_radio_button_group", tag: "bs.radio_button" } + +# Ungroup the radio button group +function #bs.component:ungroup { id: "my_radio_button_group" } +``` +:::: +::::: + +> **Credits**: theogiraudet + +--- + +### Edit Component + +:::::{tab-set} +::::{tab-item} Edit Button + +```{function} #bs.component:edit_button + +Change the properties of a button. + +:Inputs: + **Execution `as `**: The entity representing the button to edit. + + **Function macro**: + :::{treeview} + - {nbt}`compound` **Arguments**: + - {nbt}`compound` **with**: Optional parameters. + - {nbt}`string` **on_click**: The event to trigger when the button is left-clicked. + - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glows the block by default. + - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the button. Unglows the block by default. + - {nbt}`string` **tooltip**: The tooltip to display when the button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. + - {nbt}`bool` **disabled**: If true, the button is disabled (unclickable). Defaults to `false`. + - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the button is disabled. Defaults to `true`. + - {nbt}`bool` **click_sound**: If false, disables the click sound. + ::: + + :Outputs: + **State**: The button properties are changed. +``` + +*Change the `on_click` event of a button:* + +```mcfunction +function #bs.component:create_block_button { width: 1f, height: 1f, on_click: "say Clicked", block: "minecraft:slime_block", properties: {}, with: { entity_data: { Tags: [ "bs.button" ]}}} +execute as @e[tag=bs.button] run function #bs.component:edit_button { with: { on_click: "say Clicked new" }} +``` +:::: +::::{tab-item} Edit Checkbox +```{function} #bs.component:edit_checkbox + +Change the properties of a checkbox. + +:Inputs: + **Execution `as `**: The entity representing the checkbox to edit. + + **Function macro**: + :::{treeview} + - {nbt}`compound` **Arguments**: + - {nbt}`compound` **with**: Optional parameters. + - {nbt}`string` **on_selected**: The event to trigger when the checkbox is selected. + - {nbt}`string` **on_deselected**: The event to trigger when the checkbox is deselected. + - {nbt}`string` **hover**: The event to trigger when the checkbox is hovered. Do nothing by default. + - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the checkbox. Do nothing by default. + - {nbt}`string` **tooltip**: The tooltip to display when the checkbox is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. + - {nbt}`bool` **disabled**: If true, the checkbox is disabled (unclickable). Defaults to `false`. + - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the checkbox is disabled. Defaults to `true`. + - {nbt}`bool` **click_sound**: If false, disables the click sound. + - {nbt}`bool` **glow**: If true, the checkbox will glow when selected. Defaults to `true`. + ::: + + :Outputs: + **State**: The checkbox properties are changed. +``` + +*Change the `on_selected` event of a checkbox:* + +```mcfunction +function #bs.component:create_block_checkbox { width: 1f, height: 1f, on_selected: "say Selected", block: "minecraft:slime_block", properties: {}, with: { entity_data: { Tags: [ "bs.checkbox" ]}}} +execute as @e[tag=bs.checkbox] run function #bs.component:edit_checkbox { with: { on_selected: "say Selected new" }} +``` +:::: +::::{tab-item} Edit Radio Button +```{function} #bs.component:edit_radio_button + +Change the properties of a radio button. + +:Inputs: + **Execution `as `**: The entity representing the radio button to edit. + + **Function macro**: + :::{treeview} + - {nbt}`compound` **Arguments**: + - {nbt}`compound` **with**: Optional parameters. + - {nbt}`string` **on_selected**: The event to trigger when the radio button is selected. + - {nbt}`string` **hover**: The event to trigger when the radio button is hovered. Do nothing by default. + - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the radio button. Do nothing by default. + - {nbt}`string` **tooltip**: The tooltip to display when the radio button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. + - {nbt}`bool` **disabled**: If true, the radio button is disabled (unclickable). Defaults to `false`. + - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the radio button is disabled. Defaults to `true`. + - {nbt}`bool` **click_sound**: If false, disables the click sound. + - {nbt}`bool` **glow**: If true, the radio button will glow when selected. Defaults to `true`. + ::: + + :Outputs: + **State**: The radio button properties are changed. +``` + +*Change the `on_selected` event of a radio button:* + +```mcfunction +function #bs.component:create_block_radio_button { width: 1f, height: 1f, on_selected: "say Selected", block: "minecraft:slime_block", properties: {}, with: { entity_data: { Tags: [ "bs.radio_button" ]}}} +execute as @e[tag=bs.radio_button] run function #bs.component:edit_radio_button { with: { on_selected: "say Selected new" }} +``` +:::: +::::: + +> **Credits**: theogiraudet + +--- + +### Delete component + +```{function} #bs.component:delete + +Delete a component. + +:Inputs: + **Execution `as `**: The entity representing the component to delete. + +:Outputs: + **State**: The component and associated entities are deleted. +``` + +*Delete a component:* + +```mcfunction +function #bs.component:create_block_radio_button { width: 1f, height: 1f, on_selected: "say Selected", block: "minecraft:slime_block", properties: {}, with: { entity_data: { Tags: [ "bs.radio_button" ]}}} +execute as @e[tag=bs.radio_button] run function #bs.component:delete +``` +:::: +::::: + +> **Credits**: theogiraudet + +--- + +## πŸ‘οΈ Predicates + +You can find below all predicates available in this module. + +--- + +### Is Selected + +**`bs.component:is_selected`** + +Determine if a component is selected. + +> **Credits**: Aksiome + +--- + +### Is Disabled + +**`bs.component:is_disabled`** + +Determine if a component is disabled. + +> **Credits**: Aksiome + +--- +
**πŸ’¬ Did it help you?** From abb0ed6c566f3052af9584d4a84a23eaf9ce8a58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Giraudet?= Date: Wed, 26 Feb 2025 21:40:49 +0100 Subject: [PATCH 11/12] =?UTF-8?q?Wrong=20author=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/modules/component.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/modules/component.md b/docs/modules/component.md index 212d585b5e..d78df14c08 100644 --- a/docs/modules/component.md +++ b/docs/modules/component.md @@ -652,7 +652,7 @@ You can find below all predicates available in this module. Determine if a component is selected. -> **Credits**: Aksiome +> **Credits**: theogiraudet --- @@ -662,7 +662,7 @@ Determine if a component is selected. Determine if a component is disabled. -> **Credits**: Aksiome +> **Credits**: theogiraudet --- From 8732688bc76670d4540e37e294e38769ee85c3cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Giraudet?= Date: Wed, 26 Feb 2025 21:45:00 +0100 Subject: [PATCH 12/12] Change hover event name --- docs/modules/component.md | 48 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/modules/component.md b/docs/modules/component.md index d78df14c08..74bef30d3d 100644 --- a/docs/modules/component.md +++ b/docs/modules/component.md @@ -44,8 +44,8 @@ The button triggers a given event when left-clicked and by default glows when ho - {nbt}`string` **block**: The block to use to display the button. - {nbt}`compound` **properties**: The properties of the block to display. Same as block display NBT `properties`. - {nbt}`compound` **with**: Optional parameters. - - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glows the block by default. - - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the button. Unglows the block by default. + - {nbt}`string` **on_hover**: The event to trigger when the button is hovered. Glows the block by default. + - {nbt}`string` **on_hover_leave**: The event to trigger when the mouse leaves the button. Unglows the block by default. - {nbt}`string` **tooltip**: The tooltip to display when the button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. - {nbt}`bool` **disabled**: If true, the button is disabled (unclickable). Defaults to `false`. - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the button is disabled. Defaults to `true`. @@ -81,8 +81,8 @@ The button triggers a given event when left-clicked and by default glows when ho - {nbt}`string` **on_click**: The event to trigger when the button is left-clicked. - {nbt}`string` **item**: The item to use to display the button. - {nbt}`compound` **with**: Optional parameters. - - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glows the item by default. - - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the button. Unglows the item by default. + - {nbt}`string` **on_hover**: The event to trigger when the button is hovered. Glows the item by default. + - {nbt}`string` **on_hover_leave**: The event to trigger when the mouse leaves the button. Unglows the item by default. - {nbt}`string` **tooltip**: The tooltip to display when the button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. - {nbt}`bool` **disabled**: If true, the button is disabled (unclickable). Defaults to `false`. - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the button is disabled. Defaults to `true`. @@ -121,8 +121,8 @@ The button triggers a given event when left-clicked and by default glows when ho - {nbt}`string` **on_click**: The event to trigger when the button is left-clicked. - {nbt}`string` **text**: The text to display on the button. Should be a raw JSON text (see Text component format in the Minecraft Wiki). - {nbt}`compound` **with**: Optional parameters. - - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glows the text by default. - - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the button. Unglows the text by default. + - {nbt}`string` **on_hover**: The event to trigger when the button is hovered. Glows the text by default. + - {nbt}`string` **on_hover_leave**: The event to trigger when the mouse leaves the button. Unglows the text by default. - {nbt}`string` **tooltip**: The tooltip to display when the button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. - {nbt}`bool` **disabled**: If true, the button is disabled (unclickable). Defaults to `false`. - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the button is disabled. Defaults to `true`. @@ -177,8 +177,8 @@ By default, the checkbox is not selected, will glow when selected, unglow when d - {nbt}`string` **block**: The block to use to display the checkbox. - {nbt}`compound` **properties**: The properties of the block to display. Same as block display NBT `properties`. - {nbt}`compound` **with**: Optional parameters. - - {nbt}`string` **hover**: The event to trigger when the checkbox is hovered. Do nothing by default. - - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the checkbox. Do nothing by default. + - {nbt}`string` **on_hover**: The event to trigger when the checkbox is hovered. Do nothing by default. + - {nbt}`string` **on_hover_leave**: The event to trigger when the mouse leaves the checkbox. Do nothing by default. - {nbt}`bool` **selected**: If true, the checkbox is selected by default. Defaults to `false`. - {nbt}`bool` **disabled**: If true, the checkbox is disabled (unclickable). Defaults to `false`. - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the checkbox is disabled. Defaults to `true`. @@ -218,8 +218,8 @@ By default, the checkbox is not selected, will glow when selected, unglow when d - {nbt}`string` **on_deselected**: The event to trigger when the checkbox is deselected. - {nbt}`string` **item**: The item to use to display the checkbox. - {nbt}`compound` **with**: Optional parameters. - - {nbt}`string` **hover**: The event to trigger when the checkbox is hovered. Do nothing by default. - - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the checkbox. Do nothing by default. + - {nbt}`string` **on_hover**: The event to trigger when the checkbox is hovered. Do nothing by default. + - {nbt}`string` **on_hover_leave**: The event to trigger when the mouse leaves the checkbox. Do nothing by default. - {nbt}`bool` **selected**: If true, the checkbox is selected by default. Defaults to `false`. - {nbt}`bool` **disabled**: If true, the checkbox is disabled (unclickable). Defaults to `false`. - {nbt}`string` **tooltip**: The tooltip to display when the checkbox is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. @@ -262,8 +262,8 @@ By default, the checkbox is not selected, will glow when selected, unglow when d - {nbt}`string` **on_deselected**: The event to trigger when the checkbox is deselected. - {nbt}`string` **text**: The text to display on the button. Should be a raw JSON text (see Text component format in the Minecraft Wiki). - {nbt}`compound` **with**: Optional parameters. - - {nbt}`string` **hover**: The event to trigger when the checkbox is hovered. Do nothing by default. - - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the checkbox. Do nothing by default. + - {nbt}`string` **on_hover**: The event to trigger when the checkbox is hovered. Do nothing by default. + - {nbt}`string` **on_hover_leave**: The event to trigger when the mouse leaves the checkbox. Do nothing by default. - {nbt}`bool` **selected**: If true, the checkbox is selected by default. Defaults to `false`. - {nbt}`string` **tooltip**: The tooltip to display when the checkbox is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. - {nbt}`bool` **disabled**: If true, the checkbox is disabled (unclickable). Defaults to `false`. @@ -320,8 +320,8 @@ By default, the radio button is not deselected. - {nbt}`string` **block**: The block to use to display the radio button. - {nbt}`compound` **properties**: The properties of the block to display. Same as block display NBT `properties`. - {nbt}`compound` **with**: Optional parameters. - - {nbt}`string` **hover**: The event to trigger when the radio button is hovered. Do nothing by default. - - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the radio button. Do nothing by default. + - {nbt}`string` **on_hover**: The event to trigger when the radio button is hovered. Do nothing by default. + - {nbt}`string` **on_hover_leave**: The event to trigger when the mouse leaves the radio button. Do nothing by default. - {nbt}`bool` **selected**: If true, the radio button is selected by default. Defaults to `false`. - {nbt}`string` **tooltip**: The tooltip to display when the radio button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. - {nbt}`bool` **disabled**: If true, the radio button is disabled (unclickable). Defaults to `false`. @@ -361,8 +361,8 @@ By default, the radio button is not deselected. - {nbt}`string` **on_selected**: The event to trigger when the radio button is selected. - {nbt}`string` **item**: The item to use to display the radio button. - {nbt}`compound` **with**: Optional parameters. - - {nbt}`string` **hover**: The event to trigger when the radio button is hovered. Do nothing by default. - - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the radio button. Do nothing by default. + - {nbt}`string` **on_hover**: The event to trigger when the radio button is hovered. Do nothing by default. + - {nbt}`string` **on_hover_leave**: The event to trigger when the mouse leaves the radio button. Do nothing by default. - {nbt}`bool` **selected**: If true, the radio button is selected by default. Defaults to `false`. - {nbt}`string` **tooltip**: The tooltip to display when the radio button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. - {nbt}`bool` **disabled**: If true, the radio button is disabled (unclickable). Defaults to `false`. @@ -405,8 +405,8 @@ By default, the radio button is not deselected. - {nbt}`string` **on_selected**: The event to trigger when the radio button is selected. - {nbt}`string` **text**: The text to display on the button. Should be a raw JSON text (see Text component format in the Minecraft Wiki). - {nbt}`compound` **with**: Optional parameters. - - {nbt}`string` **hover**: The event to trigger when the radio button is hovered. Do nothing by default. - - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the radio button. Do nothing by default. + - {nbt}`string` **on_hover**: The event to trigger when the radio button is hovered. Do nothing by default. + - {nbt}`string` **on_hover_leave**: The event to trigger when the mouse leaves the radio button. Do nothing by default. - {nbt}`bool` **selected**: If true, the radio button is selected by default. Defaults to `false`. - {nbt}`string` **tooltip**: The tooltip to display when the radio button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. - {nbt}`bool` **disabled**: If true, the radio button is disabled (unclickable). Defaults to `false`. @@ -522,8 +522,8 @@ Change the properties of a button. - {nbt}`compound` **Arguments**: - {nbt}`compound` **with**: Optional parameters. - {nbt}`string` **on_click**: The event to trigger when the button is left-clicked. - - {nbt}`string` **hover**: The event to trigger when the button is hovered. Glows the block by default. - - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the button. Unglows the block by default. + - {nbt}`string` **on_hover**: The event to trigger when the button is hovered. Glows the block by default. + - {nbt}`string` **on_hover_leave**: The event to trigger when the mouse leaves the button. Unglows the block by default. - {nbt}`string` **tooltip**: The tooltip to display when the button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. - {nbt}`bool` **disabled**: If true, the button is disabled (unclickable). Defaults to `false`. - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the button is disabled. Defaults to `true`. @@ -555,8 +555,8 @@ Change the properties of a checkbox. - {nbt}`compound` **with**: Optional parameters. - {nbt}`string` **on_selected**: The event to trigger when the checkbox is selected. - {nbt}`string` **on_deselected**: The event to trigger when the checkbox is deselected. - - {nbt}`string` **hover**: The event to trigger when the checkbox is hovered. Do nothing by default. - - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the checkbox. Do nothing by default. + - {nbt}`string` **on_hover**: The event to trigger when the checkbox is hovered. Do nothing by default. + - {nbt}`string` **on_hover_leave**: The event to trigger when the mouse leaves the checkbox. Do nothing by default. - {nbt}`string` **tooltip**: The tooltip to display when the checkbox is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. - {nbt}`bool` **disabled**: If true, the checkbox is disabled (unclickable). Defaults to `false`. - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the checkbox is disabled. Defaults to `true`. @@ -588,8 +588,8 @@ Change the properties of a radio button. - {nbt}`compound` **Arguments**: - {nbt}`compound` **with**: Optional parameters. - {nbt}`string` **on_selected**: The event to trigger when the radio button is selected. - - {nbt}`string` **hover**: The event to trigger when the radio button is hovered. Do nothing by default. - - {nbt}`string` **hover_leave**: The event to trigger when the mouse leaves the radio button. Do nothing by default. + - {nbt}`string` **on_hover**: The event to trigger when the radio button is hovered. Do nothing by default. + - {nbt}`string` **on_hover_leave**: The event to trigger when the mouse leaves the radio button. Do nothing by default. - {nbt}`string` **tooltip**: The tooltip to display when the radio button is hovered. Should be a raw JSON text (see Text component format in the Minecraft Wiki). Displayed through the entity display name. Empty by default. - {nbt}`bool` **disabled**: If true, the radio button is disabled (unclickable). Defaults to `false`. - {nbt}`bool` **disabled_click_sound**: If false, disables the click sound when the radio button is disabled. Defaults to `true`.