-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10c1f40
commit 105bfa4
Showing
76 changed files
with
2,260 additions
and
2 deletions.
There are no files selected for viewing
112 changes: 112 additions & 0 deletions
112
datapacks/Bookshelf/data/bs.interaction/.metadata/generated/features.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
[ | ||
{ | ||
"name": "clear_events", | ||
"documentation": "https://bookshelf.docs.gunivers.net/en/latest/modules/interaction.html#clear-events", | ||
"authors": [ | ||
"Aksiome" | ||
], | ||
"created": { | ||
"date": "2024/11/01", | ||
"version": "1.21.3" | ||
}, | ||
"updated": { | ||
"date": "2024/11/01", | ||
"version": "1.21.3" | ||
} | ||
}, | ||
{ | ||
"name": "on_hover", | ||
"documentation": "https://bookshelf.docs.gunivers.net/en/latest/modules/interaction.html#on-event", | ||
"authors": [ | ||
"Aksiome", | ||
"theogiraudet" | ||
], | ||
"created": { | ||
"date": "2024/03/30", | ||
"version": "24w13a" | ||
}, | ||
"updated": { | ||
"date": "2024/11/01", | ||
"version": "1.21.3" | ||
}, | ||
"weak_dependencies": [ | ||
"bs.log" | ||
] | ||
}, | ||
{ | ||
"name": "on_hover_enter", | ||
"documentation": "https://bookshelf.docs.gunivers.net/en/latest/modules/interaction.html#on-event", | ||
"authors": [ | ||
"Aksiome", | ||
"theogiraudet" | ||
], | ||
"created": { | ||
"date": "2024/03/30", | ||
"version": "24w13a" | ||
}, | ||
"updated": { | ||
"date": "2024/11/01", | ||
"version": "1.21.3" | ||
}, | ||
"weak_dependencies": [ | ||
"bs.log" | ||
] | ||
}, | ||
{ | ||
"name": "on_hover_leave", | ||
"documentation": "https://bookshelf.docs.gunivers.net/en/latest/modules/interaction.html#on-event", | ||
"authors": [ | ||
"Aksiome", | ||
"theogiraudet" | ||
], | ||
"created": { | ||
"date": "2024/03/30", | ||
"version": "24w13a" | ||
}, | ||
"updated": { | ||
"date": "2024/11/01", | ||
"version": "1.21.3" | ||
}, | ||
"weak_dependencies": [ | ||
"bs.log" | ||
] | ||
}, | ||
{ | ||
"name": "on_left_click", | ||
"documentation": "https://bookshelf.docs.gunivers.net/en/latest/modules/interaction.html#on-event", | ||
"authors": [ | ||
"Aksiome", | ||
"theogiraudet" | ||
], | ||
"created": { | ||
"date": "2024/03/30", | ||
"version": "24w13a" | ||
}, | ||
"updated": { | ||
"date": "2024/11/01", | ||
"version": "1.21.3" | ||
}, | ||
"weak_dependencies": [ | ||
"bs.log" | ||
] | ||
}, | ||
{ | ||
"name": "on_right_click", | ||
"documentation": "https://bookshelf.docs.gunivers.net/en/latest/modules/interaction.html#on-event", | ||
"authors": [ | ||
"Aksiome", | ||
"theogiraudet" | ||
], | ||
"created": { | ||
"date": "2024/03/30", | ||
"version": "24w13a" | ||
}, | ||
"updated": { | ||
"date": "2024/11/01", | ||
"version": "1.21.3" | ||
}, | ||
"weak_dependencies": [ | ||
"bs.log" | ||
] | ||
} | ||
] |
21 changes: 21 additions & 0 deletions
21
datapacks/Bookshelf/data/bs.interaction/.metadata/generated/module.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "bs.interaction", | ||
"display_name": "Interaction", | ||
"description": "A low-level API to create GUI based on Interaction entity by binding events to it.", | ||
"documentation": "https://bookshelf.docs.gunivers.net/en/latest/modules/interaction.html", | ||
"authors": [ | ||
"Aksiome", | ||
"theogiraudet" | ||
], | ||
"weak_dependencies": [ | ||
"bs.log" | ||
], | ||
"features": [ | ||
"bs.interaction:clear_events", | ||
"bs.interaction:on_hover", | ||
"bs.interaction:on_hover_enter", | ||
"bs.interaction:on_hover_leave", | ||
"bs.interaction:on_left_click", | ||
"bs.interaction:on_right_click" | ||
] | ||
} |
9 changes: 9 additions & 0 deletions
9
datapacks/Bookshelf/data/bs.interaction/.metadata/module.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "bs.interaction", | ||
"display_name": "Interaction", | ||
"description": "A low-level API to create GUI based on Interaction entity by binding events to it.", | ||
"documentation": "https://bookshelf.docs.gunivers.net/en/latest/modules/interaction.html", | ||
"weak_dependencies": [ | ||
"bs.log" | ||
] | ||
} |
27 changes: 27 additions & 0 deletions
27
datapacks/Bookshelf/data/bs.interaction/advancement/left_click.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"criteria": { | ||
"requirement": { | ||
"trigger": "minecraft:player_hurt_entity", | ||
"conditions": { | ||
"entity": [ | ||
{ | ||
"condition": "minecraft:entity_properties", | ||
"entity": "this", | ||
"predicate": { | ||
"type": "minecraft:interaction", | ||
"nbt": "{ Tags: [ \"bs.interaction.listen_left_click\" ] }", | ||
"distance": { | ||
"absolute": { | ||
"max": 24 | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"rewards": { | ||
"function": "bs.interaction:on_event/left_click/left_click" | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
datapacks/Bookshelf/data/bs.interaction/advancement/right_click.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"criteria": { | ||
"requirement": { | ||
"trigger": "minecraft:player_interacted_with_entity", | ||
"conditions": { | ||
"entity": [ | ||
{ | ||
"condition": "minecraft:entity_properties", | ||
"entity": "this", | ||
"predicate": { | ||
"type": "minecraft:interaction", | ||
"nbt": "{ Tags: [ \"bs.interaction.listen_right_click\" ] }", | ||
"distance": { | ||
"absolute": { | ||
"max": 24 | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"rewards": { | ||
"function": "bs.interaction:on_event/right_click/right_click" | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
datapacks/Bookshelf/data/bs.interaction/function/__help__.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# ------------------------------------------------------------------------------------------------------------ | ||
# 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. | ||
# | ||
# Documentation of the feature: https://bookshelf.docs.gunivers.net/en/latest/modules/interaction.html | ||
# ------------------------------------------------------------------------------------------------------------ | ||
|
||
tellraw @s [{"text": "[bs.interaction documentation]", "color": "dark_aqua", "clickEvent": {"action": "open_url", "value": "https://bookshelf.docs.gunivers.net/en/latest/modules/interaction.html"}, "hoverEvent": {"action": "show_text", "contents": "Click to open URL"}}] |
27 changes: 27 additions & 0 deletions
27
datapacks/Bookshelf/data/bs.interaction/function/__load__.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
# ------------------------------------------------------------------------------------------------------------ | ||
|
||
forceload add -30000000 1600 | ||
execute unless entity B5-0-0-0-2 run summon minecraft:text_display -30000000 0 1600 {UUID:[I;181,0,0,2],Tags:["bs.entity","bs.persistent","smithed.entity","smithed.strict"],view_range:0f} | ||
|
||
scoreboard objectives add bs.ctx dummy [{"text":"BS ","color":"dark_gray"},{"text":"Context","color":"aqua"}] | ||
scoreboard objectives add bs.data dummy [{"text":"BS ","color":"dark_gray"},{"text":"Data","color":"aqua"}] | ||
scoreboard objectives add bs.const dummy [{"text":"BS ","color":"dark_gray"},{"text":"Constants","color":"aqua"}] | ||
|
||
scoreboard objectives add bs.interaction.id dummy [{"text":"BS ","color":"dark_gray"},{"text":"Interaction ID","color":"aqua"}] | ||
scoreboard objectives add bs.interaction.hover dummy [{"text":"BS ","color":"dark_gray"},{"text":"Interaction Hover","color":"aqua"}] | ||
scoreboard objectives add bs.interaction.logout minecraft.custom:leave_game [{"text":"BS ","color":"dark_gray"},{"text":"Interaction Logout","color":"aqua"}] | ||
|
||
scoreboard players set 2 bs.const 2 |
27 changes: 27 additions & 0 deletions
27
datapacks/Bookshelf/data/bs.interaction/function/__unload__.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
# ------------------------------------------------------------------------------------------------------------ | ||
|
||
kill B5-0-0-0-2 | ||
forceload remove -30000000 1600 | ||
|
||
execute as @e[type=minecraft:interaction] run function #bs.interaction:clear_events {with:{}} | ||
|
||
scoreboard objectives remove bs.interaction.id | ||
|
||
scoreboard objectives remove bs.ctx | ||
scoreboard objectives remove bs.data | ||
scoreboard objectives remove bs.const | ||
|
||
data remove storage bs:data interaction |
21 changes: 21 additions & 0 deletions
21
datapacks/Bookshelf/data/bs.interaction/function/callback/glow.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
# | ||
# Documentation of the feature: https://bookshelf.docs.gunivers.net/en/latest/modules/interaction.html#default-callback | ||
# ------------------------------------------------------------------------------------------------------------ | ||
|
||
# Note: | ||
# Glows the current entity. | ||
|
||
data modify entity @s Glowing set value 1b |
16 changes: 16 additions & 0 deletions
16
datapacks/Bookshelf/data/bs.interaction/function/callback/none.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# ------------------------------------------------------------------------------------------------------------ | ||
# 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. | ||
# | ||
# Documentation of the feature: https://bookshelf.docs.gunivers.net/en/latest/modules/interaction.html#default-callback | ||
# ------------------------------------------------------------------------------------------------------------ |
21 changes: 21 additions & 0 deletions
21
datapacks/Bookshelf/data/bs.interaction/function/callback/unglow.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
# | ||
# Documentation of the feature: https://bookshelf.docs.gunivers.net/en/latest/modules/interaction.html#default-callback | ||
# ------------------------------------------------------------------------------------------------------------ | ||
|
||
# Note: | ||
# Unglows the current entity. | ||
|
||
data modify entity @s Glowing set value 0b |
20 changes: 20 additions & 0 deletions
20
datapacks/Bookshelf/data/bs.interaction/function/clear_events/clear_events.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# ------------------------------------------------------------------------------------------------------------ | ||
# 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. | ||
# | ||
# Documentation of the feature: https://bookshelf.docs.gunivers.net/en/latest/modules/interaction.html#clear-events | ||
# ------------------------------------------------------------------------------------------------------------ | ||
|
||
$data modify storage bs:ctx _ set value $(with) | ||
execute store result storage bs:ctx y int 1 run scoreboard players get @s bs.interaction.id | ||
return run function bs.interaction:clear_events/remove_matching with storage bs:ctx |
32 changes: 32 additions & 0 deletions
32
datapacks/Bookshelf/data/bs.interaction/function/clear_events/remove_matching.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# ------------------------------------------------------------------------------------------------------------ | ||
# 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. | ||
# ------------------------------------------------------------------------------------------------------------ | ||
|
||
$execute store result score #i bs.ctx run data remove storage bs:data interaction.$(y)[$(_)] | ||
|
||
$execute unless data storage bs:data interaction.$(y)[-1] run scoreboard players reset @s bs.interaction.id | ||
$execute unless data storage bs:data interaction.$(y)[{type:"hover"}] run tag @s remove bs.interaction.listen_hover | ||
$execute unless data storage bs:data interaction.$(y)[{type:"hover_enter"}] run tag @s remove bs.interaction.listen_hover_enter | ||
$execute unless data storage bs:data interaction.$(y)[{type:"hover_leave"}] run tag @s remove bs.interaction.listen_hover_leave | ||
$execute unless data storage bs:data interaction.$(y)[{type:"left_click"}] run tag @s remove bs.interaction.listen_left_click | ||
$execute unless data storage bs:data interaction.$(y)[{type:"right_click"}] run tag @s remove bs.interaction.listen_right_click | ||
|
||
execute unless entity @s[tag=bs.interaction.listen_hover] \ | ||
unless entity @s[tag=bs.interaction.listen_hover_enter] \ | ||
unless entity @s[tag=bs.interaction.listen_hover_leave] \ | ||
run tag @s remove bs.interaction.is_hoverable | ||
|
||
execute unless entity @s[tag=bs.interaction.is_hoverable] run scoreboard players set #interaction.process bs.data 0 | ||
|
||
return run scoreboard players get #i bs.ctx |
Oops, something went wrong.