From 81090572a462979635d13868009a8ba5d511cd28 Mon Sep 17 00:00:00 2001 From: ChenCMD Date: Mon, 14 Oct 2024 15:01:05 +0900 Subject: [PATCH 1/4] =?UTF-8?q?:bug:=20=E6=B6=88=E6=BB=85=E3=81=AE?= =?UTF-8?q?=E5=91=AA=E3=81=84=E4=BB=98=E3=81=8D=E3=82=A2=E3=82=A4=E3=83=86?= =?UTF-8?q?=E3=83=A0=E3=81=8C=E6=B6=88=E3=81=88=E3=81=AA=E3=81=84=E3=81=AE?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/player_manager/functions/lost_item/drop/.mcfunction | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TheSkyBlessing/data/player_manager/functions/lost_item/drop/.mcfunction b/TheSkyBlessing/data/player_manager/functions/lost_item/drop/.mcfunction index 28a797bce1..ad5c8df196 100644 --- a/TheSkyBlessing/data/player_manager/functions/lost_item/drop/.mcfunction +++ b/TheSkyBlessing/data/player_manager/functions/lost_item/drop/.mcfunction @@ -14,7 +14,7 @@ # 下ごしらえ data modify storage lib: Array set from storage api: Inventory data remove storage lib: Array[].Slot - data remove storage player_manager:lost_item Temp[{tag:{Enchantments:[{id:"minecraft:vanishing_curse"}]}}] + data remove storage lib: Array[{tag:{Enchantments:[{id:"minecraft:vanishing_curse"}]}}] # 一回目 function lib:array/packing_chest From 206a9f402cbf68ce5be8c175ac15dd0e614187d9 Mon Sep 17 00:00:00 2001 From: ChenCMD Date: Mon, 14 Oct 2024 15:01:54 +0900 Subject: [PATCH 2/4] =?UTF-8?q?:construction:=20=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=83=99=E3=83=B3=E3=83=88=E3=83=AA=E6=9B=B8=E3=81=8D=E6=8F=9B?= =?UTF-8?q?=E3=81=88=E7=94=A8=20API=20=E3=82=92=20clear=20API=20=E3=81=8B?= =?UTF-8?q?=E3=82=89=E5=88=87=E3=82=8A=E5=87=BA=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inventory/core/clear/remove/.mcfunction | 63 +-------------- .../core/clear/remove/map.mcfunction | 6 +- .../api/functions/inventory/set.mcfunction | 79 +++++++++++++++++++ 3 files changed, 86 insertions(+), 62 deletions(-) create mode 100644 TheSkyBlessing/data/api/functions/inventory/set.mcfunction diff --git a/TheSkyBlessing/data/api/functions/inventory/core/clear/remove/.mcfunction b/TheSkyBlessing/data/api/functions/inventory/core/clear/remove/.mcfunction index 27b54287c4..2e80f71d10 100644 --- a/TheSkyBlessing/data/api/functions/inventory/core/clear/remove/.mcfunction +++ b/TheSkyBlessing/data/api/functions/inventory/core/clear/remove/.mcfunction @@ -1,63 +1,8 @@ #> api:inventory/core/clear/remove/ # @within function api:inventory/clear -# 処理 +# 処理 (lib: Array -> api: Inventory) execute if data storage lib: Array[0] run function api:inventory/core/clear/remove/map -# 0-26 - data modify block 10000 0 10000 Items set from storage api: NewInv - loot replace entity @s hotbar.0 27 mine 10000 0 10000 debug_stick -# 27-35 - data modify storage api: Items set value [] - data modify storage api: Items append from storage api: NewInv[{Slot:27b}] - data modify storage api: Items[{Slot:27b}].Slot set value 0b - data modify storage api: Items append from storage api: NewInv[{Slot:28b}] - data modify storage api: Items[{Slot:28b}].Slot set value 1b - data modify storage api: Items append from storage api: NewInv[{Slot:29b}] - data modify storage api: Items[{Slot:29b}].Slot set value 2b - data modify storage api: Items append from storage api: NewInv[{Slot:30b}] - data modify storage api: Items[{Slot:30b}].Slot set value 3b - data modify storage api: Items append from storage api: NewInv[{Slot:31b}] - data modify storage api: Items[{Slot:31b}].Slot set value 4b - data modify storage api: Items append from storage api: NewInv[{Slot:32b}] - data modify storage api: Items[{Slot:32b}].Slot set value 5b - data modify storage api: Items append from storage api: NewInv[{Slot:33b}] - data modify storage api: Items[{Slot:33b}].Slot set value 6b - data modify storage api: Items append from storage api: NewInv[{Slot:34b}] - data modify storage api: Items[{Slot:34b}].Slot set value 7b - data modify storage api: Items append from storage api: NewInv[{Slot:35b}] - data modify storage api: Items[{Slot:35b}].Slot set value 8b - execute if data storage api: Items[0] run data modify block 10000 0 10000 Items set from storage api: Items - execute if data storage api: Items[0] run loot replace entity @s inventory.18 9 mine 10000 0 10000 debug_stick -# 足 - data modify storage api: Items set value [] - data modify storage api: Items append from storage api: NewInv[{Slot:100b}] - data modify storage api: Items[{Slot:100b}].Slot set value 0b - execute if data storage api: Items[0] run data modify block 10000 0 10000 Items set from storage api: Items - execute if data storage api: Items[0] run loot replace entity @s armor.feet 1 mine 10000 0 10000 debug_stick -# 脚 - data modify storage api: Items set value [] - data modify storage api: Items append from storage api: NewInv[{Slot:101b}] - data modify storage api: Items[{Slot:101b}].Slot set value 0b - execute if data storage api: Items[0] run data modify block 10000 0 10000 Items set from storage api: Items - execute if data storage api: Items[0] run loot replace entity @s armor.legs 1 mine 10000 0 10000 debug_stick -# 胸 - data modify storage api: Items set value [] - data modify storage api: Items append from storage api: NewInv[{Slot:102b}] - data modify storage api: Items[{Slot:102b}].Slot set value 0b - execute if data storage api: Items[0] run data modify block 10000 0 10000 Items set from storage api: Items - execute if data storage api: Items[0] run loot replace entity @s armor.chest 1 mine 10000 0 10000 debug_stick -# 頭 - data modify storage api: Items set value [] - data modify storage api: Items append from storage api: NewInv[{Slot:103b}] - data modify storage api: Items[{Slot:103b}].Slot set value 0b - execute if data storage api: Items[0] run data modify block 10000 0 10000 Items set from storage api: Items - execute if data storage api: Items[0] run loot replace entity @s armor.head 1 mine 10000 0 10000 debug_stick -# オフハンド - data modify storage api: Items set value [] - data modify storage api: Items append from storage api: NewInv[{Slot:-106b}] - data modify storage api: Items[{Slot:-106b}].Slot set value 0b - execute if data storage api: Items[0] run data modify block 10000 0 10000 Items set from storage api: Items - execute if data storage api: Items[0] run loot replace entity @s weapon.offhand 1 mine 10000 0 10000 debug_stick -# リセット - data remove storage api: NewInv - data remove storage api: Items \ No newline at end of file + +# インベントリ上書き + function api:inventory/set diff --git a/TheSkyBlessing/data/api/functions/inventory/core/clear/remove/map.mcfunction b/TheSkyBlessing/data/api/functions/inventory/core/clear/remove/map.mcfunction index 124e470aff..f7dc2d859d 100644 --- a/TheSkyBlessing/data/api/functions/inventory/core/clear/remove/map.mcfunction +++ b/TheSkyBlessing/data/api/functions/inventory/core/clear/remove/map.mcfunction @@ -4,7 +4,7 @@ # api:inventory/core/clear/remove/map # 末尾データを新しいインベントリに追加する - data modify storage api: NewInv append from storage lib: Array[-1] + data modify storage api: Argument.Inventory append from storage lib: Array[-1] # Count削除 data remove storage lib: Array[-1].Count data remove storage lib: Array[-1].Slot @@ -18,5 +18,5 @@ scoreboard players reset $notEqual Temporary # まだアイテムがある場合は再帰 execute if score $Amount Temporary matches ..0 if data storage lib: Array[0] run function lib:array/reverse - execute if score $Amount Temporary matches ..0 if data storage lib: Array[0] run data modify storage api: NewInv append from storage lib: Array[] - execute if score $Amount Temporary matches 1.. if data storage lib: Array[0] run function api:inventory/core/clear/remove/map \ No newline at end of file + execute if score $Amount Temporary matches ..0 if data storage lib: Array[0] run data modify storage api: Argument.Inventory append from storage lib: Array[] + execute if score $Amount Temporary matches 1.. if data storage lib: Array[0] run function api:inventory/core/clear/remove/map diff --git a/TheSkyBlessing/data/api/functions/inventory/set.mcfunction b/TheSkyBlessing/data/api/functions/inventory/set.mcfunction new file mode 100644 index 0000000000..a79a554537 --- /dev/null +++ b/TheSkyBlessing/data/api/functions/inventory/set.mcfunction @@ -0,0 +1,79 @@ +#> api:inventory/set +# +# 実行者のインベントリを与えられた Inventory データに書き換えます。 +# +# この API は元のインベントリを一切維持しません。 +# +# ただし、カーソルで保持するアイテムに付いてはその限りではなく、残ったままとなります。 +# +# 明示的にカーソルに保持するアイテムを削除したい場合は、事前に clear @s を実行してください。 +# +# @input +# as player +# storage +# Argument.Inventory: [SlottedItem] +# @api + +# Validation + execute unless data storage api: Argument.Inventory run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません","color":"white"},{"text":" Inventory","color":"red"}] + execute unless data storage api: Argument.Inventory run return fail + +# 0-26 + data modify block 10000 0 10000 Items set from storage api: Argument.Inventory + loot replace entity @s hotbar.0 27 mine 10000 0 10000 debug_stick +# 27-35 + data modify storage api: Items set value [] + data modify storage api: Items append from storage api: Argument.Inventory[{Slot:27b}] + data modify storage api: Items[{Slot:27b}].Slot set value 0b + data modify storage api: Items append from storage api: Argument.Inventory[{Slot:28b}] + data modify storage api: Items[{Slot:28b}].Slot set value 1b + data modify storage api: Items append from storage api: Argument.Inventory[{Slot:29b}] + data modify storage api: Items[{Slot:29b}].Slot set value 2b + data modify storage api: Items append from storage api: Argument.Inventory[{Slot:30b}] + data modify storage api: Items[{Slot:30b}].Slot set value 3b + data modify storage api: Items append from storage api: Argument.Inventory[{Slot:31b}] + data modify storage api: Items[{Slot:31b}].Slot set value 4b + data modify storage api: Items append from storage api: Argument.Inventory[{Slot:32b}] + data modify storage api: Items[{Slot:32b}].Slot set value 5b + data modify storage api: Items append from storage api: Argument.Inventory[{Slot:33b}] + data modify storage api: Items[{Slot:33b}].Slot set value 6b + data modify storage api: Items append from storage api: Argument.Inventory[{Slot:34b}] + data modify storage api: Items[{Slot:34b}].Slot set value 7b + data modify storage api: Items append from storage api: Argument.Inventory[{Slot:35b}] + data modify storage api: Items[{Slot:35b}].Slot set value 8b + execute if data storage api: Items[0] run data modify block 10000 0 10000 Items set from storage api: Items + execute if data storage api: Items[0] run loot replace entity @s inventory.18 9 mine 10000 0 10000 debug_stick +# 足 + data modify storage api: Items set value [] + data modify storage api: Items append from storage api: Argument.Inventory[{Slot:100b}] + data modify storage api: Items[{Slot:100b}].Slot set value 0b + execute if data storage api: Items[0] run data modify block 10000 0 10000 Items set from storage api: Items + execute if data storage api: Items[0] run loot replace entity @s armor.feet 1 mine 10000 0 10000 debug_stick +# 脚 + data modify storage api: Items set value [] + data modify storage api: Items append from storage api: Argument.Inventory[{Slot:101b}] + data modify storage api: Items[{Slot:101b}].Slot set value 0b + execute if data storage api: Items[0] run data modify block 10000 0 10000 Items set from storage api: Items + execute if data storage api: Items[0] run loot replace entity @s armor.legs 1 mine 10000 0 10000 debug_stick +# 胸 + data modify storage api: Items set value [] + data modify storage api: Items append from storage api: Argument.Inventory[{Slot:102b}] + data modify storage api: Items[{Slot:102b}].Slot set value 0b + execute if data storage api: Items[0] run data modify block 10000 0 10000 Items set from storage api: Items + execute if data storage api: Items[0] run loot replace entity @s armor.chest 1 mine 10000 0 10000 debug_stick +# 頭 + data modify storage api: Items set value [] + data modify storage api: Items append from storage api: Argument.Inventory[{Slot:103b}] + data modify storage api: Items[{Slot:103b}].Slot set value 0b + execute if data storage api: Items[0] run data modify block 10000 0 10000 Items set from storage api: Items + execute if data storage api: Items[0] run loot replace entity @s armor.head 1 mine 10000 0 10000 debug_stick +# オフハンド + data modify storage api: Items set value [] + data modify storage api: Items append from storage api: Argument.Inventory[{Slot:-106b}] + data modify storage api: Items[{Slot:-106b}].Slot set value 0b + execute if data storage api: Items[0] run data modify block 10000 0 10000 Items set from storage api: Items + execute if data storage api: Items[0] run loot replace entity @s weapon.offhand 1 mine 10000 0 10000 debug_stick + +# リセット + data remove storage api: Argument.Inventory + data remove storage api: Items From 46bde62d5cfa2a290509872a18a228ec43a3a31a Mon Sep 17 00:00:00 2001 From: ChenCMD Date: Mon, 14 Oct 2024 15:02:28 +0900 Subject: [PATCH 3/4] =?UTF-8?q?:sparkles:=20TSB.SoulBound=20=3D=3D=20true?= =?UTF-8?q?=20=E3=81=A7=E3=81=82=E3=82=8B=E3=82=88=E3=81=86=E3=81=AA?= =?UTF-8?q?=E3=82=A2=E3=82=A4=E3=83=86=E3=83=A0=E3=81=8C=E6=AD=BB=E3=82=93?= =?UTF-8?q?=E3=81=A7=E3=82=82=E4=BF=9D=E6=8C=81=E3=81=95=E3=82=8C=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../functions/lost_item/drop/.mcfunction | 7 ++++++- .../functions/lost_item/regive_soulbound.mcfunction | 10 ++++++++++ .../player_manager/functions/lost_item/take.mcfunction | 6 +++++- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 TheSkyBlessing/data/player_manager/functions/lost_item/regive_soulbound.mcfunction diff --git a/TheSkyBlessing/data/player_manager/functions/lost_item/drop/.mcfunction b/TheSkyBlessing/data/player_manager/functions/lost_item/drop/.mcfunction index ad5c8df196..4c03f827eb 100644 --- a/TheSkyBlessing/data/player_manager/functions/lost_item/drop/.mcfunction +++ b/TheSkyBlessing/data/player_manager/functions/lost_item/drop/.mcfunction @@ -15,6 +15,7 @@ data modify storage lib: Array set from storage api: Inventory data remove storage lib: Array[].Slot data remove storage lib: Array[{tag:{Enchantments:[{id:"minecraft:vanishing_curse"}]}}] + data remove storage lib: Array[{tag:{TSB:{SoulBound:true}}}] # 一回目 function lib:array/packing_chest @@ -33,5 +34,9 @@ execute positioned ~ ~1 ~ as @e[type=item,distance=..0.5] run function player_manager:lost_item/drop/motion_multiple +# SoulBound のアイテムをインベントリに戻す + execute if data storage api: Inventory[{tag:{TSB:{SoulBound:true}}}] run function player_manager:lost_item/regive_soulbound + + # リセット - function lib:array/session/close \ No newline at end of file + function lib:array/session/close diff --git a/TheSkyBlessing/data/player_manager/functions/lost_item/regive_soulbound.mcfunction b/TheSkyBlessing/data/player_manager/functions/lost_item/regive_soulbound.mcfunction new file mode 100644 index 0000000000..5b136e9752 --- /dev/null +++ b/TheSkyBlessing/data/player_manager/functions/lost_item/regive_soulbound.mcfunction @@ -0,0 +1,10 @@ +#> player_manager:lost_item/regive_soulbound +# +# +# +# @within function +# player_manager:lost_item/drop/ +# player_manager:lost_item/take + +data modify storage api: Argument.Inventory append from storage api: Inventory[{tag:{TSB:{SoulBound:true}}}] +function api:inventory/set diff --git a/TheSkyBlessing/data/player_manager/functions/lost_item/take.mcfunction b/TheSkyBlessing/data/player_manager/functions/lost_item/take.mcfunction index 16bb4de6ca..77b43fac9d 100644 --- a/TheSkyBlessing/data/player_manager/functions/lost_item/take.mcfunction +++ b/TheSkyBlessing/data/player_manager/functions/lost_item/take.mcfunction @@ -10,6 +10,7 @@ data remove storage player_manager:lost_item Temp[].Slot # 消滅の呪い付きアイテムを削除 data remove storage player_manager:lost_item Temp[{tag:{Enchantments:[{id:"minecraft:vanishing_curse"}]}}] + data remove storage player_manager:lost_item Temp[{tag:{TSB:{SoulBound:true}}}] # UserStorage呼び出し function oh_my_dat:please # IDをIDSetに追加 @@ -22,4 +23,7 @@ execute unless data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Name run function lib:get_name/ execute unless data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Name run data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Name set from storage lib: Return.Name # インベントリclear - clear @s \ No newline at end of file + clear @s + +# SoulBound のアイテムをインベントリに戻す + execute if data storage api: Inventory[{tag:{TSB:{SoulBound:true}}}] run function player_manager:lost_item/regive_soulbound From 1099b43f72029b328670d62f5424968736acbeed Mon Sep 17 00:00:00 2001 From: Chen Date: Sun, 20 Oct 2024 18:34:44 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=92=A1=20=E3=82=B3=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/player_manager/functions/lost_item/take.mcfunction | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TheSkyBlessing/data/player_manager/functions/lost_item/take.mcfunction b/TheSkyBlessing/data/player_manager/functions/lost_item/take.mcfunction index 77b43fac9d..b5a7397416 100644 --- a/TheSkyBlessing/data/player_manager/functions/lost_item/take.mcfunction +++ b/TheSkyBlessing/data/player_manager/functions/lost_item/take.mcfunction @@ -8,8 +8,9 @@ data modify storage player_manager:lost_item Temp set from storage api: Inventory # Slotを削除 data remove storage player_manager:lost_item Temp[].Slot -# 消滅の呪い付きアイテムを削除 +# 消滅の呪い付きアイテムを削除する data remove storage player_manager:lost_item Temp[{tag:{Enchantments:[{id:"minecraft:vanishing_curse"}]}}] +# SoulBound 付きのアイテムを削除する (手元に残すので) data remove storage player_manager:lost_item Temp[{tag:{TSB:{SoulBound:true}}}] # UserStorage呼び出し function oh_my_dat:please