From 62a73d1c0767e3cd4741e3c3495e89649cb4d59a Mon Sep 17 00:00:00 2001 From: anitmyan <61045441+anitmyan@users.noreply.github.com> Date: Fri, 4 Feb 2022 23:37:48 +0900 Subject: [PATCH 01/12] =?UTF-8?q?=F0=9F=9A=A7=20=E3=83=88=E3=83=AA?= =?UTF-8?q?=E3=82=AC=E3=83=BC=E3=81=AEfunction=20tag=E3=82=92=E4=BD=9C?= =?UTF-8?q?=E6=88=90/=E3=83=AA=E3=83=8D=E3=83=BC=E3=83=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sacred_treasure/{using_item.json => using_item/.json} | 0 .../tags/functions/sacred_treasure/using_item/0.5s.json | 5 +++++ .../asset/tags/functions/sacred_treasure/using_item/10s.json | 5 +++++ .../asset/tags/functions/sacred_treasure/using_item/1s.json | 5 +++++ .../asset/tags/functions/sacred_treasure/using_item/2s.json | 5 +++++ .../asset/tags/functions/sacred_treasure/using_item/3s.json | 5 +++++ .../asset/tags/functions/sacred_treasure/using_item/4s.json | 5 +++++ .../asset/tags/functions/sacred_treasure/using_item/5s.json | 5 +++++ .../tags/functions/sacred_treasure/using_item/keep/.json | 5 +++++ .../tags/functions/sacred_treasure/using_item/keep/0.5s.json | 5 +++++ .../tags/functions/sacred_treasure/using_item/keep/10s.json | 5 +++++ .../tags/functions/sacred_treasure/using_item/keep/1s.json | 5 +++++ .../tags/functions/sacred_treasure/using_item/keep/2s.json | 5 +++++ .../tags/functions/sacred_treasure/using_item/keep/3s.json | 5 +++++ .../tags/functions/sacred_treasure/using_item/keep/4s.json | 5 +++++ .../tags/functions/sacred_treasure/using_item/keep/5s.json | 5 +++++ 16 files changed, 75 insertions(+) rename Asset/data/asset/tags/functions/sacred_treasure/{using_item.json => using_item/.json} (100%) create mode 100644 Asset/data/asset/tags/functions/sacred_treasure/using_item/0.5s.json create mode 100644 Asset/data/asset/tags/functions/sacred_treasure/using_item/10s.json create mode 100644 Asset/data/asset/tags/functions/sacred_treasure/using_item/1s.json create mode 100644 Asset/data/asset/tags/functions/sacred_treasure/using_item/2s.json create mode 100644 Asset/data/asset/tags/functions/sacred_treasure/using_item/3s.json create mode 100644 Asset/data/asset/tags/functions/sacred_treasure/using_item/4s.json create mode 100644 Asset/data/asset/tags/functions/sacred_treasure/using_item/5s.json create mode 100644 Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/.json create mode 100644 Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/0.5s.json create mode 100644 Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/10s.json create mode 100644 Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/1s.json create mode 100644 Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/2s.json create mode 100644 Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/3s.json create mode 100644 Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/4s.json create mode 100644 Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/5s.json diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/.json similarity index 100% rename from Asset/data/asset/tags/functions/sacred_treasure/using_item.json rename to Asset/data/asset/tags/functions/sacred_treasure/using_item/.json diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item/0.5s.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/0.5s.json new file mode 100644 index 0000000000..0d17807366 --- /dev/null +++ b/Asset/data/asset/tags/functions/sacred_treasure/using_item/0.5s.json @@ -0,0 +1,5 @@ +{ + "values": [ + + ] +} \ No newline at end of file diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item/10s.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/10s.json new file mode 100644 index 0000000000..0d17807366 --- /dev/null +++ b/Asset/data/asset/tags/functions/sacred_treasure/using_item/10s.json @@ -0,0 +1,5 @@ +{ + "values": [ + + ] +} \ No newline at end of file diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item/1s.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/1s.json new file mode 100644 index 0000000000..0d17807366 --- /dev/null +++ b/Asset/data/asset/tags/functions/sacred_treasure/using_item/1s.json @@ -0,0 +1,5 @@ +{ + "values": [ + + ] +} \ No newline at end of file diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item/2s.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/2s.json new file mode 100644 index 0000000000..0d17807366 --- /dev/null +++ b/Asset/data/asset/tags/functions/sacred_treasure/using_item/2s.json @@ -0,0 +1,5 @@ +{ + "values": [ + + ] +} \ No newline at end of file diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item/3s.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/3s.json new file mode 100644 index 0000000000..0d17807366 --- /dev/null +++ b/Asset/data/asset/tags/functions/sacred_treasure/using_item/3s.json @@ -0,0 +1,5 @@ +{ + "values": [ + + ] +} \ No newline at end of file diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item/4s.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/4s.json new file mode 100644 index 0000000000..0d17807366 --- /dev/null +++ b/Asset/data/asset/tags/functions/sacred_treasure/using_item/4s.json @@ -0,0 +1,5 @@ +{ + "values": [ + + ] +} \ No newline at end of file diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item/5s.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/5s.json new file mode 100644 index 0000000000..0d17807366 --- /dev/null +++ b/Asset/data/asset/tags/functions/sacred_treasure/using_item/5s.json @@ -0,0 +1,5 @@ +{ + "values": [ + + ] +} \ No newline at end of file diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/.json new file mode 100644 index 0000000000..0d17807366 --- /dev/null +++ b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/.json @@ -0,0 +1,5 @@ +{ + "values": [ + + ] +} \ No newline at end of file diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/0.5s.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/0.5s.json new file mode 100644 index 0000000000..0d17807366 --- /dev/null +++ b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/0.5s.json @@ -0,0 +1,5 @@ +{ + "values": [ + + ] +} \ No newline at end of file diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/10s.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/10s.json new file mode 100644 index 0000000000..0d17807366 --- /dev/null +++ b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/10s.json @@ -0,0 +1,5 @@ +{ + "values": [ + + ] +} \ No newline at end of file diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/1s.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/1s.json new file mode 100644 index 0000000000..0d17807366 --- /dev/null +++ b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/1s.json @@ -0,0 +1,5 @@ +{ + "values": [ + + ] +} \ No newline at end of file diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/2s.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/2s.json new file mode 100644 index 0000000000..0d17807366 --- /dev/null +++ b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/2s.json @@ -0,0 +1,5 @@ +{ + "values": [ + + ] +} \ No newline at end of file diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/3s.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/3s.json new file mode 100644 index 0000000000..0d17807366 --- /dev/null +++ b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/3s.json @@ -0,0 +1,5 @@ +{ + "values": [ + + ] +} \ No newline at end of file diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/4s.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/4s.json new file mode 100644 index 0000000000..0d17807366 --- /dev/null +++ b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/4s.json @@ -0,0 +1,5 @@ +{ + "values": [ + + ] +} \ No newline at end of file diff --git a/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/5s.json b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/5s.json new file mode 100644 index 0000000000..0d17807366 --- /dev/null +++ b/Asset/data/asset/tags/functions/sacred_treasure/using_item/keep/5s.json @@ -0,0 +1,5 @@ +{ + "values": [ + + ] +} \ No newline at end of file From de2885abf402ec9c3db150205630f6711306c4ef Mon Sep 17 00:00:00 2001 From: anitmyan <61045441+anitmyan@users.noreply.github.com> Date: Sat, 5 Feb 2022 00:41:26 +0900 Subject: [PATCH 02/12] =?UTF-8?q?=E2=9C=A8=20=E5=A4=9A=E5=88=86=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sacred_treasure/_index.d.mcfunction | 4 + .../sacred_treasure/triggers/.mcfunction | 2 +- .../triggers/using_item.mcfunction | 12 --- .../triggers/using_item/.mcfunction | 80 +++++++++++++++++++ .../triggers/using_item/reset.mcfunction | 8 ++ .../reset_threshold_less.mcfunction | 11 +++ .../reset_value_not-equal.mcfunction | 11 +++ .../reset_when_change_item.mcfunction | 12 +++ .../using_item/set_context.mcfunction | 8 ++ .../functions/handler/using_item.mcfunction | 3 + .../data/core/functions/load_once.mcfunction | 6 ++ .../tick/post-tick-proc_player.mcfunction | 4 +- 12 files changed, 147 insertions(+), 14 deletions(-) delete mode 100644 TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item.mcfunction create mode 100644 TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction create mode 100644 TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset.mcfunction create mode 100644 TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_threshold_less.mcfunction create mode 100644 TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_value_not-equal.mcfunction create mode 100644 TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_when_change_item.mcfunction create mode 100644 TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/set_context.mcfunction diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/_index.d.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/_index.d.mcfunction index ad26616b62..7557c54481 100644 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/_index.d.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/_index.d.mcfunction @@ -40,6 +40,10 @@ # @within function asset_manager:sacred_treasure/triggers/sneak/* #declare score_holder $SneakThreshold +#> アイテム使用中の閾値用スコアホルダー +# @within function asset_manager:sacred_treasure/triggers/using_item/* + #declare score_holder $UsingItemThreshold + #> use_itemの誤検知対策タグ # @within function # core:handler/drop diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/.mcfunction index bce09da88e..af91c7c5bf 100644 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/.mcfunction @@ -24,7 +24,7 @@ execute if entity @s[tag=TriggerFlag.Killed] run function asset_manager:sacred_treasure/triggers/killed execute if entity @s[tag=TriggerFlag.UseItem] run function asset_manager:sacred_treasure/triggers/use_item/ execute if entity @s[tag=TriggerFlag.Sneak] run function asset_manager:sacred_treasure/triggers/sneak/ - execute if entity @s[tag=TriggerFlag.UsingItem] run function asset_manager:sacred_treasure/triggers/using_item + execute if entity @s[tag=TriggerFlag.UsingItem] run function asset_manager:sacred_treasure/triggers/using_item/ execute unless entity @s[tag=!ChangeMainhand,tag=!ChangeOffhand,tag=!ChangeHead,tag=!ChangeChest,tag=!ChangeLegs,tag=!ChangeFeet] run function asset_manager:sacred_treasure/triggers/dis_equip execute unless entity @s[tag=!ChangeMainhand,tag=!ChangeOffhand,tag=!ChangeHead,tag=!ChangeChest,tag=!ChangeLegs,tag=!ChangeFeet] run function asset_manager:sacred_treasure/triggers/equip # EntityStorageにデータ突っ込む diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item.mcfunction deleted file mode 100644 index b728b77a9f..0000000000 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item.mcfunction +++ /dev/null @@ -1,12 +0,0 @@ -#> asset_manager:sacred_treasure/triggers/using_item -# -# 各神器処理へデータ受け渡し -# -# @within function asset_manager:sacred_treasure/triggers/ - -# イベント発火前に実行するやつ - function asset_manager:sacred_treasure/data/new/set_to_current -# 神器側に受け渡し - function #asset:sacred_treasure/using_item -# イベント発火後に実行するやつ - function asset_manager:sacred_treasure/data/new/revert_from_current \ No newline at end of file diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction new file mode 100644 index 0000000000..5588035e53 --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction @@ -0,0 +1,80 @@ +#> asset_manager:sacred_treasure/triggers/using_item/ +# +# 各神器処理へデータ受け渡し +# +# @within function asset_manager:sacred_treasure/triggers/ + +# イベント発火前に実行するやつ + function asset_manager:sacred_treasure/data/new/set_to_current +# スロット毎のチェック + function asset_manager:sacred_treasure/triggers/using_item/reset_when_change_item +# asset:contextにアイテムを使用している時間を設定する + function asset_manager:sacred_treasure/triggers/using_item/set_context +# 神器側に受け渡し + # keepトリガー類 + function #asset:sacred_treasure/using_item/keep/ + + execute if score @s UsingItem matches 10.. run scoreboard players set $UsingItemThreshold Temporary 10 + execute if score @s UsingItem matches 10.. run function asset_manager:sacred_treasure/triggers/using_item/reset_threshold_less + execute if score @s UsingItem matches 10.. run function #asset:sacred_treasure/using_item/keep/0.5s + + execute if score @s UsingItem matches 20.. run scoreboard players set $UsingItemThreshold Temporary 20 + execute if score @s UsingItem matches 20.. run function asset_manager:sacred_treasure/triggers/using_item/reset_threshold_less + execute if score @s UsingItem matches 20.. run function #asset:sacred_treasure/using_item/keep/1s + + execute if score @s UsingItem matches 40.. run scoreboard players set $UsingItemThreshold Temporary 40 + execute if score @s UsingItem matches 40.. run function asset_manager:sacred_treasure/triggers/using_item/reset_threshold_less + execute if score @s UsingItem matches 40.. run function #asset:sacred_treasure/using_item/keep/2s + + execute if score @s UsingItem matches 60.. run scoreboard players set $UsingItemThreshold Temporary 60 + execute if score @s UsingItem matches 60.. run function asset_manager:sacred_treasure/triggers/using_item/reset_threshold_less + execute if score @s UsingItem matches 60.. run function #asset:sacred_treasure/using_item/keep/3s + + execute if score @s UsingItem matches 80.. run scoreboard players set $UsingItemThreshold Temporary 80 + execute if score @s UsingItem matches 80.. run function asset_manager:sacred_treasure/triggers/using_item/reset_threshold_less + execute if score @s UsingItem matches 80.. run function #asset:sacred_treasure/using_item/keep/4s + + execute if score @s UsingItem matches 100.. run scoreboard players set $UsingItemThreshold Temporary 100 + execute if score @s UsingItem matches 100.. run function asset_manager:sacred_treasure/triggers/using_item/reset_threshold_less + execute if score @s UsingItem matches 100.. run function #asset:sacred_treasure/using_item/keep/5s + + execute if score @s UsingItem matches 200.. run scoreboard players set $UsingItemThreshold Temporary 200 + execute if score @s UsingItem matches 200.. run function asset_manager:sacred_treasure/triggers/using_item/reset_threshold_less + execute if score @s UsingItem matches 200.. run function #asset:sacred_treasure/using_item/keep/10s + + # 単発トリガー類 + scoreboard players set $UsingItemThreshold Temporary 1 + function asset_manager:sacred_treasure/triggers/using_item/reset_value_not-equal + function #asset:sacred_treasure/using_item/ + + execute if score @s UsingItem matches 10.. run scoreboard players set $UsingItemThreshold Temporary 10 + execute if score @s UsingItem matches 10.. run function asset_manager:sacred_treasure/triggers/using_item/reset_value_not-equal + execute if score @s UsingItem matches 10.. run function #asset:sacred_treasure/using_item/0.5s + + execute if score @s UsingItem matches 20.. run scoreboard players set $UsingItemThreshold Temporary 20 + execute if score @s UsingItem matches 20.. run function asset_manager:sacred_treasure/triggers/using_item/reset_value_not-equal + execute if score @s UsingItem matches 20.. run function #asset:sacred_treasure/using_item/1s + + execute if score @s UsingItem matches 40.. run scoreboard players set $UsingItemThreshold Temporary 40 + execute if score @s UsingItem matches 40.. run function asset_manager:sacred_treasure/triggers/using_item/reset_value_not-equal + execute if score @s UsingItem matches 40.. run function #asset:sacred_treasure/using_item/2s + + execute if score @s UsingItem matches 60.. run scoreboard players set $UsingItemThreshold Temporary 60 + execute if score @s UsingItem matches 60.. run function asset_manager:sacred_treasure/triggers/using_item/reset_value_not-equal + execute if score @s UsingItem matches 60.. run function #asset:sacred_treasure/using_item/3s + + execute if score @s UsingItem matches 80.. run scoreboard players set $UsingItemThreshold Temporary 80 + execute if score @s UsingItem matches 80.. run function asset_manager:sacred_treasure/triggers/using_item/reset_value_not-equal + execute if score @s UsingItem matches 80.. run function #asset:sacred_treasure/using_item/4s + + execute if score @s UsingItem matches 100.. run scoreboard players set $UsingItemThreshold Temporary 100 + execute if score @s UsingItem matches 100.. run function asset_manager:sacred_treasure/triggers/using_item/reset_value_not-equal + execute if score @s UsingItem matches 100.. run function #asset:sacred_treasure/using_item/5s + + execute if score @s UsingItem matches 200.. run scoreboard players set $UsingItemThreshold Temporary 200 + execute if score @s UsingItem matches 200.. run function asset_manager:sacred_treasure/triggers/using_item/reset_value_not-equal + execute if score @s UsingItem matches 200.. run function #asset:sacred_treasure/using_item/10s +# イベント発火後に実行するやつ + function asset_manager:sacred_treasure/data/new/revert_from_current +# リセット + data remove storage asset:context UsingItemTime \ No newline at end of file diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset.mcfunction new file mode 100644 index 0000000000..c0713eb3f4 --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset.mcfunction @@ -0,0 +1,8 @@ +#> asset_manager:sacred_treasure/triggers/using_item/reset +# +# アイテム使用中トリガー用スコアボードをすべてリセットします +# +# @within function core:tick/post-tick-proc_player + +scoreboard players reset @s UsingItem.MainH +scoreboard players reset @s UsingItem.OffH \ No newline at end of file diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_threshold_less.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_threshold_less.mcfunction new file mode 100644 index 0000000000..f50ee6bbcb --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_threshold_less.mcfunction @@ -0,0 +1,11 @@ +#> asset_manager:sacred_treasure/triggers/using_item/reset_threshold_less +# +# 各slotについて$UsingItemThreshold未満の値の場合、その値を-1に設定します +# +# @within function asset_manager:sacred_treasure/triggers/using_item/ + +# 処理 + execute unless score @s UsingItem.MainH >= $UsingItemThreshold Temporary run data modify storage asset:context id.mainhand set value -1 + execute unless score @s UsingItem.OffH >= $UsingItemThreshold Temporary run data modify storage asset:context id.offhand set value -1 +# リセット + scoreboard players reset $UsingItemThreshold \ No newline at end of file diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_value_not-equal.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_value_not-equal.mcfunction new file mode 100644 index 0000000000..9c6229d6d8 --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_value_not-equal.mcfunction @@ -0,0 +1,11 @@ +#> asset_manager:sacred_treasure/triggers/using_item/reset_value_not-equal +# +# 各slotについて$UsingItemThresholdと同値ではない場合、その値を-1に設定します +# +# @within function asset_manager:sacred_treasure/triggers/using_item/ + +# 処理 + execute unless score @s UsingItem.MainH = $UsingItemThreshold Temporary run data modify storage asset:context id.mainhand set value -1 + execute unless score @s UsingItem.OffH = $UsingItemThreshold Temporary run data modify storage asset:context id.offhand set value -1 +# リセット + scoreboard players reset $UsingItemThreshold \ No newline at end of file diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_when_change_item.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_when_change_item.mcfunction new file mode 100644 index 0000000000..b593b89f2a --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_when_change_item.mcfunction @@ -0,0 +1,12 @@ +#> asset_manager:sacred_treasure/triggers/using_item/reset_when_change_item +# +# 各slotについて前のアイテムデータと一致していない場合、その値のスコアボードを1に設定します +# +# Q. なんで0やnullじゃなくて1なの? A. ここら辺のfunctionが実行されるのはUsingItemしてる時、つまり0|nullではない時だから +# +# @within function asset_manager:sacred_treasure/triggers/using_item/ + +# mainhand + execute if entity @s[tag=ChangeMainhand] run scoreboard players set @s UsingItem.MainH 1 +# offhand + execute if entity @s[tag=ChangeOffhand] run scoreboard players set @s UsingItem.OffH 1 \ No newline at end of file diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/set_context.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/set_context.mcfunction new file mode 100644 index 0000000000..0c9bfd322f --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/set_context.mcfunction @@ -0,0 +1,8 @@ +#> asset_manager:sacred_treasure/triggers/using_item/set_context +# +# asset:contextにアイテムを使用している時間のデータを設定します +# +# @within function asset_manager:sacred_treasure/triggers/using_item/ + +execute store result storage asset:context UsingItemTime.mainhand int 1 run scoreboard players get @s UsingItem.MainH +execute store result storage asset:context UsingItemTime.offhand int 1 run scoreboard players get @s UsingItem.OffH \ No newline at end of file diff --git a/TheSkyBlessing/data/core/functions/handler/using_item.mcfunction b/TheSkyBlessing/data/core/functions/handler/using_item.mcfunction index 4908b70fa5..e647584095 100644 --- a/TheSkyBlessing/data/core/functions/handler/using_item.mcfunction +++ b/TheSkyBlessing/data/core/functions/handler/using_item.mcfunction @@ -6,6 +6,9 @@ # asset_managerへの引継ぎ tag @s add TriggerFlag.UsingItem + scoreboard players add @s UsingItem 1 + scoreboard players add @s UsingItem.MainH 1 + scoreboard players add @s UsingItem.OffH 1 # reset advancement revoke @s only core:handler/using_item \ No newline at end of file diff --git a/TheSkyBlessing/data/core/functions/load_once.mcfunction b/TheSkyBlessing/data/core/functions/load_once.mcfunction index 5523a5825f..9448ea7c94 100644 --- a/TheSkyBlessing/data/core/functions/load_once.mcfunction +++ b/TheSkyBlessing/data/core/functions/load_once.mcfunction @@ -108,7 +108,9 @@ team modify NoCollision collisionRule never #> AssetManager: 神器 # @within function # core:load_once + # core:handler/using_item # asset_manager:sacred_treasure/** + # core:tick/post-tick-proc_player bossbar add asset:special_cooldown {"text":"特殊クールダウン"} scoreboard objectives add Sneak.Mainhand custom:sneak_time {"text":"スニークタイム: メインハンド"} scoreboard objectives add Sneak.Offhand custom:sneak_time {"text":"スニークタイム: オフハンド"} @@ -116,6 +118,10 @@ team modify NoCollision collisionRule never scoreboard objectives add Sneak.Chest custom:sneak_time {"text":"スニークタイム: 胸"} scoreboard objectives add Sneak.Legs custom:sneak_time {"text":"スニークタイム: 脚"} scoreboard objectives add Sneak.Feet custom:sneak_time {"text":"スニークタイム: 足"} + # TODO 1.18になったら命名を元に戻す + scoreboard objectives add UsingItem dummy {"text":"アイテム使用時間"} + scoreboard objectives add UsingItem.MainH dummy {"text":"アイテム使用時間: メインハンド"} + scoreboard objectives add UsingItem.OffH dummy {"text":"アイテム使用時間: オフハンド"} scoreboard objectives add UUID.Mainhand dummy {"text":"メインハンド装備のUUID"} scoreboard objectives add UUID.Offhand dummy {"text":"オフハンド装備のUUID"} scoreboard objectives add UUID.Head dummy {"text":"頭装備のUUID"} diff --git a/TheSkyBlessing/data/core/functions/tick/post-tick-proc_player.mcfunction b/TheSkyBlessing/data/core/functions/tick/post-tick-proc_player.mcfunction index abf8b373c6..5a131f575e 100644 --- a/TheSkyBlessing/data/core/functions/tick/post-tick-proc_player.mcfunction +++ b/TheSkyBlessing/data/core/functions/tick/post-tick-proc_player.mcfunction @@ -15,4 +15,6 @@ # リセット execute if entity @s[scores={Sneak=1..},predicate=!lib:is_sneaking] run function asset_manager:sacred_treasure/triggers/sneak/reset - scoreboard players reset @s[scores={Sneak=1..},predicate=!lib:is_sneaking] Sneak \ No newline at end of file + scoreboard players reset @s[scores={Sneak=1..},predicate=!lib:is_sneaking] Sneak + execute if entity @s[scores={UsingItem=1..}] run function asset_manager:sacred_treasure/triggers/using_item/reset + scoreboard players reset @s[scores={UsingItem=1..}] UsingItem \ No newline at end of file From 722be87269c7784811986d653422c7d9649632ec Mon Sep 17 00:00:00 2001 From: anitmyan <61045441+anitmyan@users.noreply.github.com> Date: Sat, 5 Feb 2022 00:48:43 +0900 Subject: [PATCH 03/12] =?UTF-8?q?=F0=9F=94=A7=20=E3=83=86=E3=83=B3?= =?UTF-8?q?=E3=83=97=E3=83=AC=E3=83=BC=E3=83=88=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 287 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 286 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index fe9250c516..fcbe8cb5d5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1217,7 +1217,292 @@ "generates": [ { "type": "file", - "rel": "data/asset/tags/functions/sacred_treasure/using_item.json", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/.json", + "content": { + "values": [ + "asset:sacred_treasure/%namespace%/trigger/1.trigger" + ] + }, + "append": { + "addFirst": true, + "key": "values", + "elem": "asset:sacred_treasure/%namespace%/trigger/1.trigger" + } + } + ] + }, + { + "label": "神器/トリガー: アイテム使用中 - 0.5秒", + "generates": [ + { + "type": "file", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/0.5s.json", + "content": { + "values": [ + "asset:sacred_treasure/%namespace%/trigger/1.trigger" + ] + }, + "append": { + "addFirst": true, + "key": "values", + "elem": "asset:sacred_treasure/%namespace%/trigger/1.trigger" + } + } + ] + }, + { + "label": "神器/トリガー: アイテム使用中 - 1秒", + "generates": [ + { + "type": "file", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/1s.json", + "content": { + "values": [ + "asset:sacred_treasure/%namespace%/trigger/1.trigger" + ] + }, + "append": { + "addFirst": true, + "key": "values", + "elem": "asset:sacred_treasure/%namespace%/trigger/1.trigger" + } + } + ] + }, + { + "label": "神器/トリガー: アイテム使用中 - 2秒", + "generates": [ + { + "type": "file", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/2s.json", + "content": { + "values": [ + "asset:sacred_treasure/%namespace%/trigger/1.trigger" + ] + }, + "append": { + "addFirst": true, + "key": "values", + "elem": "asset:sacred_treasure/%namespace%/trigger/1.trigger" + } + } + ] + }, + { + "label": "神器/トリガー: アイテム使用中 - 3秒", + "generates": [ + { + "type": "file", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/3s.json", + "content": { + "values": [ + "asset:sacred_treasure/%namespace%/trigger/1.trigger" + ] + }, + "append": { + "addFirst": true, + "key": "values", + "elem": "asset:sacred_treasure/%namespace%/trigger/1.trigger" + } + } + ] + }, + { + "label": "神器/トリガー: アイテム使用中 - 4秒", + "generates": [ + { + "type": "file", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/4s.json", + "content": { + "values": [ + "asset:sacred_treasure/%namespace%/trigger/1.trigger" + ] + }, + "append": { + "addFirst": true, + "key": "values", + "elem": "asset:sacred_treasure/%namespace%/trigger/1.trigger" + } + } + ] + }, + { + "label": "神器/トリガー: アイテム使用中 - 5秒", + "generates": [ + { + "type": "file", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/5s.json", + "content": { + "values": [ + "asset:sacred_treasure/%namespace%/trigger/1.trigger" + ] + }, + "append": { + "addFirst": true, + "key": "values", + "elem": "asset:sacred_treasure/%namespace%/trigger/1.trigger" + } + } + ] + }, + { + "label": "神器/トリガー: アイテム使用中 - 10秒", + "generates": [ + { + "type": "file", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/10s.json", + "content": { + "values": [ + "asset:sacred_treasure/%namespace%/trigger/1.trigger" + ] + }, + "append": { + "addFirst": true, + "key": "values", + "elem": "asset:sacred_treasure/%namespace%/trigger/1.trigger" + } + } + ] + }, + { + "label": "神器/トリガー: アイテム使用中 - 0秒以上", + "generates": [ + { + "type": "file", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/keep/.json", + "content": { + "values": [ + "asset:sacred_treasure/%namespace%/trigger/1.trigger" + ] + }, + "append": { + "addFirst": true, + "key": "values", + "elem": "asset:sacred_treasure/%namespace%/trigger/1.trigger" + } + } + ] + }, + { + "label": "神器/トリガー: アイテム使用中 - 0.5秒以上", + "generates": [ + { + "type": "file", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/keep/0.5.json", + "content": { + "values": [ + "asset:sacred_treasure/%namespace%/trigger/1.trigger" + ] + }, + "append": { + "addFirst": true, + "key": "values", + "elem": "asset:sacred_treasure/%namespace%/trigger/1.trigger" + } + } + ] + }, + { + "label": "神器/トリガー: アイテム使用中 - 1秒以上", + "generates": [ + { + "type": "file", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/keep/1s.json", + "content": { + "values": [ + "asset:sacred_treasure/%namespace%/trigger/1.trigger" + ] + }, + "append": { + "addFirst": true, + "key": "values", + "elem": "asset:sacred_treasure/%namespace%/trigger/1.trigger" + } + } + ] + }, + { + "label": "神器/トリガー: アイテム使用中 - 2秒以上", + "generates": [ + { + "type": "file", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/keep/2s.json", + "content": { + "values": [ + "asset:sacred_treasure/%namespace%/trigger/1.trigger" + ] + }, + "append": { + "addFirst": true, + "key": "values", + "elem": "asset:sacred_treasure/%namespace%/trigger/1.trigger" + } + } + ] + }, + { + "label": "神器/トリガー: アイテム使用中 - 3秒以上", + "generates": [ + { + "type": "file", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/keep/3s.json", + "content": { + "values": [ + "asset:sacred_treasure/%namespace%/trigger/1.trigger" + ] + }, + "append": { + "addFirst": true, + "key": "values", + "elem": "asset:sacred_treasure/%namespace%/trigger/1.trigger" + } + } + ] + }, + { + "label": "神器/トリガー: アイテム使用中 - 4秒以上", + "generates": [ + { + "type": "file", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/keep/4s.json", + "content": { + "values": [ + "asset:sacred_treasure/%namespace%/trigger/1.trigger" + ] + }, + "append": { + "addFirst": true, + "key": "values", + "elem": "asset:sacred_treasure/%namespace%/trigger/1.trigger" + } + } + ] + }, + { + "label": "神器/トリガー: アイテム使用中 - 5秒以上", + "generates": [ + { + "type": "file", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/keep/5s.json", + "content": { + "values": [ + "asset:sacred_treasure/%namespace%/trigger/1.trigger" + ] + }, + "append": { + "addFirst": true, + "key": "values", + "elem": "asset:sacred_treasure/%namespace%/trigger/1.trigger" + } + } + ] + }, + { + "label": "神器/トリガー: アイテム使用中 - 10秒以上", + "generates": [ + { + "type": "file", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/keep/10s.json", "content": { "values": [ "asset:sacred_treasure/%namespace%/trigger/1.trigger" From 2253c2ed776373ee83722948f4139a4d58e3e8f8 Mon Sep 17 00:00:00 2001 From: anitmyan <61045441+anitmyan@users.noreply.github.com> Date: Sat, 5 Feb 2022 02:06:10 +0900 Subject: [PATCH 04/12] =?UTF-8?q?=F0=9F=90=9B=20=E7=A7=92=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E3=81=8C=E4=BB=95=E4=BA=8B=E3=81=97=E3=81=AA=E3=81=84?= =?UTF-8?q?=E3=81=AE=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/core/functions/handler/using_item.mcfunction | 2 +- .../core/functions/tick/post-tick-proc_player.mcfunction | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/TheSkyBlessing/data/core/functions/handler/using_item.mcfunction b/TheSkyBlessing/data/core/functions/handler/using_item.mcfunction index e647584095..fe6f4ca2f4 100644 --- a/TheSkyBlessing/data/core/functions/handler/using_item.mcfunction +++ b/TheSkyBlessing/data/core/functions/handler/using_item.mcfunction @@ -11,4 +11,4 @@ scoreboard players add @s UsingItem.OffH 1 # reset - advancement revoke @s only core:handler/using_item \ No newline at end of file +# core:tick/post-tick-proc_playerに移動 \ No newline at end of file diff --git a/TheSkyBlessing/data/core/functions/tick/post-tick-proc_player.mcfunction b/TheSkyBlessing/data/core/functions/tick/post-tick-proc_player.mcfunction index 5a131f575e..85ddb0cd48 100644 --- a/TheSkyBlessing/data/core/functions/tick/post-tick-proc_player.mcfunction +++ b/TheSkyBlessing/data/core/functions/tick/post-tick-proc_player.mcfunction @@ -16,5 +16,6 @@ # リセット execute if entity @s[scores={Sneak=1..},predicate=!lib:is_sneaking] run function asset_manager:sacred_treasure/triggers/sneak/reset scoreboard players reset @s[scores={Sneak=1..},predicate=!lib:is_sneaking] Sneak - execute if entity @s[scores={UsingItem=1..}] run function asset_manager:sacred_treasure/triggers/using_item/reset - scoreboard players reset @s[scores={UsingItem=1..}] UsingItem \ No newline at end of file + execute if entity @s[scores={UsingItem=1..},advancements={core:handler/using_item=false}] run function asset_manager:sacred_treasure/triggers/using_item/reset + scoreboard players reset @s[scores={UsingItem=1..},advancements={core:handler/using_item=false}] UsingItem + execute if entity @s[advancements={core:handler/using_item=true}] run advancement revoke @s only core:handler/using_item \ No newline at end of file From acec65adadbd15a94c0861eb5d9f7374c65b3b0b Mon Sep 17 00:00:00 2001 From: anitmyan <61045441+anitmyan@users.noreply.github.com> Date: Sat, 5 Feb 2022 02:06:43 +0900 Subject: [PATCH 05/12] =?UTF-8?q?=F0=9F=90=9B=20=E5=8D=98=E7=99=BA?= =?UTF-8?q?=E3=81=AE=E7=A7=92=E6=8C=87=E5=AE=9A=E3=81=8C=E4=BB=95=E4=BA=8B?= =?UTF-8?q?=E3=81=97=E3=81=AA=E3=81=84=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../triggers/using_item/reset_value_not-equal.mcfunction | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_value_not-equal.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_value_not-equal.mcfunction index 9c6229d6d8..b314f5fa25 100644 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_value_not-equal.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_value_not-equal.mcfunction @@ -4,6 +4,8 @@ # # @within function asset_manager:sacred_treasure/triggers/using_item/ +# 初期化 + data modify storage asset:context id set from storage asset:context New.id # 処理 execute unless score @s UsingItem.MainH = $UsingItemThreshold Temporary run data modify storage asset:context id.mainhand set value -1 execute unless score @s UsingItem.OffH = $UsingItemThreshold Temporary run data modify storage asset:context id.offhand set value -1 From 80f25641faf9b2c28de11f587bd4ac818a631014 Mon Sep 17 00:00:00 2001 From: anitmyan <61045441+anitmyan@users.noreply.github.com> Date: Sat, 5 Feb 2022 03:39:11 +0900 Subject: [PATCH 06/12] =?UTF-8?q?=F0=9F=90=9B=20=E3=82=AD=E3=83=BC?= =?UTF-8?q?=E3=83=970.5=E7=A7=92=E4=BB=A5=E4=B8=8A=E3=81=8C=E7=94=9F?= =?UTF-8?q?=E6=88=90=E3=81=97=E3=81=A6=E3=82=82=E5=8B=95=E3=81=8B=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index fcbe8cb5d5..f948507d25 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1388,7 +1388,7 @@ "generates": [ { "type": "file", - "rel": "data/asset/tags/functions/sacred_treasure/using_item/keep/0.5.json", + "rel": "data/asset/tags/functions/sacred_treasure/using_item/keep/0.5s.json", "content": { "values": [ "asset:sacred_treasure/%namespace%/trigger/1.trigger" From 90a3b50122782f17c43b874f6bdcc806292c6354 Mon Sep 17 00:00:00 2001 From: anitmyan <61045441+anitmyan@users.noreply.github.com> Date: Sat, 5 Feb 2022 03:54:55 +0900 Subject: [PATCH 07/12] =?UTF-8?q?=F0=9F=92=AC=20=E7=A5=9E=E5=99=A8?= =?UTF-8?q?=E3=81=AE=E3=83=88=E3=83=AA=E3=82=AC=E3=83=BC=E6=96=87=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sacred_treasure/create/set_trigger.mcfunction | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/create/set_trigger.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/create/set_trigger.mcfunction index 95e37bd578..8b36a5590f 100644 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/create/set_trigger.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/create/set_trigger.mcfunction @@ -47,6 +47,20 @@ execute if data storage asset:sacred_treasure {Trigger:"keepSneak4s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "4秒間以上スニーク" execute if data storage asset:sacred_treasure {Trigger:"keepSneak5s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "5秒間以上スニーク" execute if data storage asset:sacred_treasure {Trigger:"keepSneak10s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "10秒間以上スニーク" + execute if data storage asset:sacred_treasure {Trigger:"UsingItem"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "右クリック" + execute if data storage asset:sacred_treasure {Trigger:"UsingItem1s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "1秒間右クリック" + execute if data storage asset:sacred_treasure {Trigger:"UsingItem2s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "2秒間右クリック" + execute if data storage asset:sacred_treasure {Trigger:"UsingItem3s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "3秒間右クリック" + execute if data storage asset:sacred_treasure {Trigger:"UsingItem4s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "4秒間右クリック" + execute if data storage asset:sacred_treasure {Trigger:"UsingItem5s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "5秒間右クリック" + execute if data storage asset:sacred_treasure {Trigger:"UsingItem10s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "10秒間右クリック" + execute if data storage asset:sacred_treasure {Trigger:"keepUsingItem"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "0秒以上右クリック" + execute if data storage asset:sacred_treasure {Trigger:"keepUsingItem1s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "1秒間以上右クリック" + execute if data storage asset:sacred_treasure {Trigger:"keepUsingItem2s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "2秒間以上右クリック" + execute if data storage asset:sacred_treasure {Trigger:"keepUsingItem3s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "3秒間以上右クリック" + execute if data storage asset:sacred_treasure {Trigger:"keepUsingItem4s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "4秒間以上右クリック" + execute if data storage asset:sacred_treasure {Trigger:"keepUsingItem5s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "5秒間以上右クリック" + execute if data storage asset:sacred_treasure {Trigger:"keepUsingItem10s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "10秒間以上右クリック" execute if data storage asset:sacred_treasure {Trigger:"equipping"} run data modify storage asset:sacred_treasure Temp.Trigger.AB set value "" execute if data storage asset:sacred_treasure {Trigger:"equipping"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "" # 設定されてなかったらエラーメッセージ From 20b4aacbebd47372afa27c88fcf88f42f5183405 Mon Sep 17 00:00:00 2001 From: anitmyan <61045441+anitmyan@users.noreply.github.com> Date: Sat, 5 Feb 2022 07:57:32 +0900 Subject: [PATCH 08/12] =?UTF-8?q?=F0=9F=9A=9Atrigger=20id=E3=82=92lowerCam?= =?UTF-8?q?elCase=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sacred_treasure/create/set_trigger.mcfunction | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/create/set_trigger.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/create/set_trigger.mcfunction index 8b36a5590f..6eb49eecbe 100644 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/create/set_trigger.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/create/set_trigger.mcfunction @@ -47,13 +47,13 @@ execute if data storage asset:sacred_treasure {Trigger:"keepSneak4s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "4秒間以上スニーク" execute if data storage asset:sacred_treasure {Trigger:"keepSneak5s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "5秒間以上スニーク" execute if data storage asset:sacred_treasure {Trigger:"keepSneak10s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "10秒間以上スニーク" - execute if data storage asset:sacred_treasure {Trigger:"UsingItem"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "右クリック" - execute if data storage asset:sacred_treasure {Trigger:"UsingItem1s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "1秒間右クリック" - execute if data storage asset:sacred_treasure {Trigger:"UsingItem2s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "2秒間右クリック" - execute if data storage asset:sacred_treasure {Trigger:"UsingItem3s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "3秒間右クリック" - execute if data storage asset:sacred_treasure {Trigger:"UsingItem4s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "4秒間右クリック" - execute if data storage asset:sacred_treasure {Trigger:"UsingItem5s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "5秒間右クリック" - execute if data storage asset:sacred_treasure {Trigger:"UsingItem10s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "10秒間右クリック" + execute if data storage asset:sacred_treasure {Trigger:"usingItem"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "右クリック" + execute if data storage asset:sacred_treasure {Trigger:"usingItem1s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "1秒間右クリック" + execute if data storage asset:sacred_treasure {Trigger:"usingItem2s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "2秒間右クリック" + execute if data storage asset:sacred_treasure {Trigger:"usingItem3s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "3秒間右クリック" + execute if data storage asset:sacred_treasure {Trigger:"usingItem4s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "4秒間右クリック" + execute if data storage asset:sacred_treasure {Trigger:"usingItem5s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "5秒間右クリック" + execute if data storage asset:sacred_treasure {Trigger:"usingItem10s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "10秒間右クリック" execute if data storage asset:sacred_treasure {Trigger:"keepUsingItem"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "0秒以上右クリック" execute if data storage asset:sacred_treasure {Trigger:"keepUsingItem1s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "1秒間以上右クリック" execute if data storage asset:sacred_treasure {Trigger:"keepUsingItem2s"} run data modify storage asset:sacred_treasure Temp.Trigger.B set value "2秒間以上右クリック" From 2b8956da804d158f7feeb488d29bba1025b0f04d Mon Sep 17 00:00:00 2001 From: anitmyan <61045441+anitmyan@users.noreply.github.com> Date: Wed, 9 Feb 2022 03:21:43 +0900 Subject: [PATCH 09/12] =?UTF-8?q?=F0=9F=9A=A7=20=E5=B7=A6=E5=8F=B3?= =?UTF-8?q?=E8=87=AA=E5=8B=95=E5=88=A4=E5=AE=9A=E3=81=AE=E6=9E=A0=E7=B5=84?= =?UTF-8?q?=E3=81=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../functions/sacred_treasure/_index.d.mcfunction | 7 +++++++ .../sacred_treasure/triggers/using_item/.mcfunction | 7 ++++++- .../triggers/using_item/detect_usinghand/.mcfunction | 10 ++++++++++ .../triggers/using_item/reset.mcfunction | 4 +++- 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/.mcfunction diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/_index.d.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/_index.d.mcfunction index 7557c54481..02d994cd44 100644 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/_index.d.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/_index.d.mcfunction @@ -44,6 +44,13 @@ # @within function asset_manager:sacred_treasure/triggers/using_item/* #declare score_holder $UsingItemThreshold +#> アイテム使用中の手判別用タグ +# @within function +# asset_manager:sacred_treasure/triggers/using_item/** + #declare tag CheckedUsingHand + #declare tag UsingItem.Mainhand + #declare tag UsingItem.Offhand + #> use_itemの誤検知対策タグ # @within function # core:handler/drop diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction index 5588035e53..0aa9efdf06 100644 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction @@ -8,6 +8,10 @@ function asset_manager:sacred_treasure/data/new/set_to_current # スロット毎のチェック function asset_manager:sacred_treasure/triggers/using_item/reset_when_change_item +# 使用している手を判別する + execute if entity @s[scores={UsingItem=1}] run function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/ + execute if entity @s[tag=!CheckedUsingHand,scores={UsingItem.MainH=1}] run function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/ + execute if entity @s[tag=!CheckedUsingHand,scores={UsingItem.OffH=1}] run function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/ # asset:contextにアイテムを使用している時間を設定する function asset_manager:sacred_treasure/triggers/using_item/set_context # 神器側に受け渡し @@ -77,4 +81,5 @@ # イベント発火後に実行するやつ function asset_manager:sacred_treasure/data/new/revert_from_current # リセット - data remove storage asset:context UsingItemTime \ No newline at end of file + data remove storage asset:context UsingItemTime + tag @s remove CheckedUsingHand \ No newline at end of file diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/.mcfunction new file mode 100644 index 0000000000..f543dfee01 --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/.mcfunction @@ -0,0 +1,10 @@ +#> asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/ +# +# アイテム使用中の手を特定します +# +# @within function asset_manager:sacred_treasure/triggers/using_item/ + + +tag @s add CheckedUsingHand + +# diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset.mcfunction index c0713eb3f4..903ad36a4b 100644 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset.mcfunction @@ -5,4 +5,6 @@ # @within function core:tick/post-tick-proc_player scoreboard players reset @s UsingItem.MainH -scoreboard players reset @s UsingItem.OffH \ No newline at end of file +scoreboard players reset @s UsingItem.OffH +tag @s[tag=UsingItem.Mainhand] remove UsingItem.Mainhand +tag @s[tag=UsingItem.Offhand] remove UsingItem.Offhand \ No newline at end of file From 5f220f092758a54db20298250feb29b2b93beae3 Mon Sep 17 00:00:00 2001 From: anitmyan <61045441+anitmyan@users.noreply.github.com> Date: Wed, 16 Feb 2022 15:59:48 +0900 Subject: [PATCH 10/12] =?UTF-8?q?=F0=9F=9A=A7=20predicate=20has=5Fusable?= =?UTF-8?q?=5Fitem=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../predicates/has_usable_item/mainhand.json | 11 +++++++++++ .../predicates/has_usable_item/offhand.json | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 TheSkyBlessing/data/asset_manager/predicates/has_usable_item/mainhand.json create mode 100644 TheSkyBlessing/data/asset_manager/predicates/has_usable_item/offhand.json diff --git a/TheSkyBlessing/data/asset_manager/predicates/has_usable_item/mainhand.json b/TheSkyBlessing/data/asset_manager/predicates/has_usable_item/mainhand.json new file mode 100644 index 0000000000..e9a28bac52 --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/predicates/has_usable_item/mainhand.json @@ -0,0 +1,11 @@ +{ + "condition": "entity_properties", + "entity": "this", + "predicate": { + "equipment": { + "mainhand": { + "tag": "lib:usable" + } + } + } +} \ No newline at end of file diff --git a/TheSkyBlessing/data/asset_manager/predicates/has_usable_item/offhand.json b/TheSkyBlessing/data/asset_manager/predicates/has_usable_item/offhand.json new file mode 100644 index 0000000000..90a69fab29 --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/predicates/has_usable_item/offhand.json @@ -0,0 +1,11 @@ +{ + "condition": "entity_properties", + "entity": "this", + "predicate": { + "equipment": { + "offhand": { + "tag": "lib:usable" + } + } + } +} \ No newline at end of file From 191f8afd587f6fe4d74a41a7ae3603c81f8456fe Mon Sep 17 00:00:00 2001 From: anitmyan <61045441+anitmyan@users.noreply.github.com> Date: Fri, 18 Feb 2022 05:59:24 +0900 Subject: [PATCH 11/12] =?UTF-8?q?=F0=9F=92=A9=20=E5=B7=A6=E5=8F=B3?= =?UTF-8?q?=E8=87=AA=E5=8B=95=E5=88=A4=E5=88=A5=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../triggers/using_item/.mcfunction | 4 +- .../using_item/detect_usinghand/.mcfunction | 19 ++++++++-- .../detect_usinghand/check.mcfunction | 14 +++++++ .../check_change_item.mcfunction | 37 +++++++++++++++++++ .../detect_usinghand/mainhand.mcfunction | 13 +++++++ .../detect_usinghand/offhand.mcfunction | 14 +++++++ .../reset_when_change_item.mcfunction | 26 ++++++++++--- 7 files changed, 116 insertions(+), 11 deletions(-) create mode 100644 TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/check.mcfunction create mode 100644 TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/check_change_item.mcfunction create mode 100644 TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/mainhand.mcfunction create mode 100644 TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/offhand.mcfunction diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction index 0aa9efdf06..3057fbd23a 100644 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction @@ -9,9 +9,7 @@ # スロット毎のチェック function asset_manager:sacred_treasure/triggers/using_item/reset_when_change_item # 使用している手を判別する - execute if entity @s[scores={UsingItem=1}] run function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/ - execute if entity @s[tag=!CheckedUsingHand,scores={UsingItem.MainH=1}] run function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/ - execute if entity @s[tag=!CheckedUsingHand,scores={UsingItem.OffH=1}] run function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/ + function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/ # asset:contextにアイテムを使用している時間を設定する function asset_manager:sacred_treasure/triggers/using_item/set_context # 神器側に受け渡し diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/.mcfunction index f543dfee01..bade81779d 100644 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/.mcfunction @@ -1,10 +1,23 @@ #> asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/ # -# アイテム使用中の手を特定します +# 左右自動判別manager # # @within function asset_manager:sacred_treasure/triggers/using_item/ +#> +# @within function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/* + #declare tag UsingItem.ChangedM + #declare tag UsingItem.ChangedO -tag @s add CheckedUsingHand +# アイテムが変わってるか検知 + function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/check_change_item -# +# 判別 + execute if entity @s[scores={UsingItem=1}] run function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/check + execute if entity @s[tag=UsingItem.ChangedM,tag=UsingItem.ChangedO] run function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/check + execute if entity @s[tag=UsingItem.ChangedM,tag=!CheckedUsingHand] run function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/mainhand + execute if entity @s[tag=UsingItem.ChangedO,tag=!CheckedUsingHand] run function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/offhand + +# リセット + tag @s remove UsingItem.ChangedM + tag @s remove UsingItem.ChangedO \ No newline at end of file diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/check.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/check.mcfunction new file mode 100644 index 0000000000..4a0ae80ee6 --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/check.mcfunction @@ -0,0 +1,14 @@ +#> asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/check +# +# アイテム使用し始めた際/両方のアイテムが更新された際に実行 +# +# @within function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/ + +# チェック済みtagを付ける + tag @s add CheckedUsingHand + +# 判別用tagを更新 + tag @s remove UsingItem.Mainhand + tag @s remove UsingItem.Offhand + execute if predicate asset_manager:has_usable_item/mainhand run tag @s add UsingItem.Mainhand + execute unless predicate asset_manager:has_usable_item/mainhand if predicate asset_manager:has_usable_item/offhand run tag @s add UsingItem.Offhand \ No newline at end of file diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/check_change_item.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/check_change_item.mcfunction new file mode 100644 index 0000000000..7a626f80cc --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/check_change_item.mcfunction @@ -0,0 +1,37 @@ +#> asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/check_change_item +# +# アイテムを持ち替えた時など、左右判別をし直す必要があるかどうかをチェックします +# +# @within function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/ + +#> +#@private + #declare score_holder $idNotEqualM + #declare score_holder $idNotEqualO + #declare score_holder $slotNotEqual + +# mainhandのアイテムid比較 + data modify storage asset:sacred_treasure Temp set from storage asset:context Items.mainhand.id + execute store success score $idNotEqualM Temporary run data modify storage asset:sacred_treasure Temp set from storage asset:context Old.Items.mainhand.id + data modify storage asset:sacred_treasure Temp set value {} +# offhandのアイテムid比較 + data modify storage asset:sacred_treasure Temp set from storage asset:context Items.offhand.id + execute store success score $idNotEqualO Temporary run data modify storage asset:sacred_treasure Temp set from storage asset:context Old.Items.offhand.id + data modify storage asset:sacred_treasure Temp set value {} +# mainhandのアイテムslot比較 + data modify storage asset:sacred_treasure Temp set from storage asset:context SelectedItemSlot + execute store success score $slotNotEqual Temporary run data modify storage asset:sacred_treasure Temp set from storage asset:context Old.SelectedItemSlot + +# 比較結果から判別tag付与 + execute if score $idNotEqualM Temporary matches 1 run tag @s add UsingItem.ChangedM + execute if score $idNotEqualO Temporary matches 1 run tag @s add UsingItem.ChangedO + execute if score $slotNotEqual Temporary matches 1 run tag @s add UsingItem.ChangedM +# アイテムを消費してたら比較結果に関わらず判別tag付与 + tag @s[tag=TriggerFlag.UseItem] add UsingItem.ChangedM + tag @s[tag=TriggerFlag.UseItem] add UsingItem.ChangedO + +# リセット + scoreboard players reset $idNotEqualM Temporary + scoreboard players reset $idNotEqualO Temporary + scoreboard players reset $slotNotEqual Temporary + data remove storage asset:sacred_treasure Temp \ No newline at end of file diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/mainhand.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/mainhand.mcfunction new file mode 100644 index 0000000000..f92bbdf3cc --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/mainhand.mcfunction @@ -0,0 +1,13 @@ +#> asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/mainhand +# +# アイテム使用中にメインハンドが更新された際に実行 +# +# @within function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/ + +# チェック済みtagを付ける + tag @s add CheckedUsingHand + +# 判別用tagを更新 + execute unless predicate asset_manager:has_usable_item/mainhand run tag @s remove UsingItem.Mainhand + execute unless predicate asset_manager:has_usable_item/mainhand if predicate asset_manager:has_usable_item/offhand run tag @s add UsingItem.Offhand + execute if entity @s[tag=!UsingItem.Offhand] if predicate asset_manager:has_usable_item/mainhand run tag @s add UsingItem.Mainhand \ No newline at end of file diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/offhand.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/offhand.mcfunction new file mode 100644 index 0000000000..5868c7dd23 --- /dev/null +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/offhand.mcfunction @@ -0,0 +1,14 @@ +#> asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/offhand +# +# アイテム使用中にオフハンドが更新された際に実行 +# +# @within function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/ + +# チェック済みtagを付ける + tag @s add CheckedUsingHand + +# 判別用tagを更新 + execute unless predicate asset_manager:has_usable_item/offhand run tag @s remove UsingItem.Offhand + execute if predicate asset_manager:has_usable_item/mainhand run tag @s remove UsingItem.Offhand + execute if predicate asset_manager:has_usable_item/mainhand run tag @s add UsingItem.Mainhand + execute if entity @s[tag=!UsingItem.Mainhand] if predicate asset_manager:has_usable_item/offhand run tag @s add UsingItem.Offhand \ No newline at end of file diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_when_change_item.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_when_change_item.mcfunction index b593b89f2a..159ba6fe77 100644 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_when_change_item.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_when_change_item.mcfunction @@ -1,12 +1,28 @@ #> asset_manager:sacred_treasure/triggers/using_item/reset_when_change_item # -# 各slotについて前のアイテムデータと一致していない場合、その値のスコアボードを1に設定します +# 手持ちアイテムが前のアイテムデータと一致していない場合、その手のスコアボードを1に設定します # # Q. なんで0やnullじゃなくて1なの? A. ここら辺のfunctionが実行されるのはUsingItemしてる時、つまり0|nullではない時だから # # @within function asset_manager:sacred_treasure/triggers/using_item/ -# mainhand - execute if entity @s[tag=ChangeMainhand] run scoreboard players set @s UsingItem.MainH 1 -# offhand - execute if entity @s[tag=ChangeOffhand] run scoreboard players set @s UsingItem.OffH 1 \ No newline at end of file +#> +#@private + #declare score_holder $notEqualM + #declare score_holder $notEqualO + +# mainhand比較 + data modify storage asset:sacred_treasure Temp set from storage asset:context Items.mainhand + execute store success score $notEqualM Temporary run data modify storage asset:sacred_treasure Temp set from storage asset:context Old.Items.mainhand +# offhand比較 + data modify storage asset:sacred_treasure Temp set from storage asset:context Items.offhand + execute store success score $notEqualO Temporary run data modify storage asset:sacred_treasure Temp set from storage asset:context Old.Items.offhand + +# 比較結果から値を設定 + execute if score $notEqualM Temporary matches 1 run scoreboard players set @s UsingItem.MainH 1 + execute if score $notEqualO Temporary matches 1 run scoreboard players set @s UsingItem.OffH 1 + +# リセット + scoreboard players reset $notEqualM Temporary + scoreboard players reset $notEqualO Temporary + data remove storage asset:sacred_treasure Temp \ No newline at end of file From b79fc7373846357b29d752beb49861d2a8b45d34 Mon Sep 17 00:00:00 2001 From: anitmyan <61045441+anitmyan@users.noreply.github.com> Date: Fri, 18 Feb 2022 11:56:19 +0900 Subject: [PATCH 12/12] =?UTF-8?q?=F0=9F=92=A9=F0=9F=9A=A7=20=E5=A4=9A?= =?UTF-8?q?=E5=88=86auto=E3=81=8C=E4=BD=BF=E3=81=88=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E3=81=AA=E3=81=A3=E3=81=A6=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sacred_treasure/triggers/using_item/.mcfunction | 6 ++++-- .../triggers/using_item/detect_usinghand/.mcfunction | 6 ++++++ .../detect_usinghand/check_change_item.mcfunction | 6 +++--- .../triggers/using_item/reset_value_not-equal.mcfunction | 2 ++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction index 3057fbd23a..71075d91ad 100644 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/.mcfunction @@ -4,12 +4,13 @@ # # @within function asset_manager:sacred_treasure/triggers/ +# 使用している手を判別する + function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/ # イベント発火前に実行するやつ function asset_manager:sacred_treasure/data/new/set_to_current + data modify storage asset:context New.id.auto set from storage asset:context id.auto # スロット毎のチェック function asset_manager:sacred_treasure/triggers/using_item/reset_when_change_item -# 使用している手を判別する - function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/ # asset:contextにアイテムを使用している時間を設定する function asset_manager:sacred_treasure/triggers/using_item/set_context # 神器側に受け渡し @@ -45,6 +46,7 @@ execute if score @s UsingItem matches 200.. run function #asset:sacred_treasure/using_item/keep/10s # 単発トリガー類 + scoreboard players set $UsingItemThreshold Temporary 1 function asset_manager:sacred_treasure/triggers/using_item/reset_value_not-equal function #asset:sacred_treasure/using_item/ diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/.mcfunction index bade81779d..07003688a6 100644 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/.mcfunction @@ -18,6 +18,12 @@ execute if entity @s[tag=UsingItem.ChangedM,tag=!CheckedUsingHand] run function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/mainhand execute if entity @s[tag=UsingItem.ChangedO,tag=!CheckedUsingHand] run function asset_manager:sacred_treasure/triggers/using_item/detect_usinghand/offhand +# slotに適用 + execute if entity @s[tag=UsingItem.Mainhand,tag=UsingItem.Offhand] run data modify storage asset:sacred_treasure Argument.AutoSlot set value 'none' + execute if entity @s[tag=!UsingItem.Mainhand,tag=!UsingItem.Offhand] run data modify storage asset:sacred_treasure Argument.AutoSlot set value 'none' + execute if entity @s[tag=UsingItem.Mainhand,tag=!UsingItem.Offhand] run data modify storage asset:sacred_treasure Argument.AutoSlot set value 'mainhand' + execute if entity @s[tag=UsingItem.Offhand,tag=!UsingItem.Mainhand] run data modify storage asset:sacred_treasure Argument.AutoSlot set value 'offhand' + # リセット tag @s remove UsingItem.ChangedM tag @s remove UsingItem.ChangedO \ No newline at end of file diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/check_change_item.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/check_change_item.mcfunction index 7a626f80cc..af56158ba5 100644 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/check_change_item.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/detect_usinghand/check_change_item.mcfunction @@ -11,15 +11,15 @@ #declare score_holder $slotNotEqual # mainhandのアイテムid比較 - data modify storage asset:sacred_treasure Temp set from storage asset:context Items.mainhand.id + data modify storage asset:sacred_treasure Temp set from storage asset:context New.Items.mainhand.id execute store success score $idNotEqualM Temporary run data modify storage asset:sacred_treasure Temp set from storage asset:context Old.Items.mainhand.id data modify storage asset:sacred_treasure Temp set value {} # offhandのアイテムid比較 - data modify storage asset:sacred_treasure Temp set from storage asset:context Items.offhand.id + data modify storage asset:sacred_treasure Temp set from storage asset:context New.Items.offhand.id execute store success score $idNotEqualO Temporary run data modify storage asset:sacred_treasure Temp set from storage asset:context Old.Items.offhand.id data modify storage asset:sacred_treasure Temp set value {} # mainhandのアイテムslot比較 - data modify storage asset:sacred_treasure Temp set from storage asset:context SelectedItemSlot + data modify storage asset:sacred_treasure Temp set from storage asset:context New.SelectedItemSlot execute store success score $slotNotEqual Temporary run data modify storage asset:sacred_treasure Temp set from storage asset:context Old.SelectedItemSlot # 比較結果から判別tag付与 diff --git a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_value_not-equal.mcfunction b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_value_not-equal.mcfunction index b314f5fa25..96f7ed901d 100644 --- a/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_value_not-equal.mcfunction +++ b/TheSkyBlessing/data/asset_manager/functions/sacred_treasure/triggers/using_item/reset_value_not-equal.mcfunction @@ -7,6 +7,8 @@ # 初期化 data modify storage asset:context id set from storage asset:context New.id # 処理 + execute unless score @s[tag=UsingItem.Mainhand] UsingItem.MainH = $UsingItemThreshold Temporary run data modify storage asset:context id.auto set value -1 + execute unless score @s[tag=UsingItem.Offhand] UsingItem.OffH = $UsingItemThreshold Temporary run data modify storage asset:context id.auto set value -1 execute unless score @s UsingItem.MainH = $UsingItemThreshold Temporary run data modify storage asset:context id.mainhand set value -1 execute unless score @s UsingItem.OffH = $UsingItemThreshold Temporary run data modify storage asset:context id.offhand set value -1 # リセット