Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,34 @@
# 神器の基本的な条件の確認を行うfunction、成功している場合CanUsedタグが付く auto/feet/legs/chest/head/mainhand/offhandを記載してね
function asset:artifact/common/check_condition/auto
# 他にアイテム等確認する場合はここに書く
tellraw @s[gamemode=!survival,gamemode=!creative] [{"text": "サバイバルエリアでのみ使用可能です"}]
tag @s[gamemode=!survival,gamemode=!creative] remove CanUsed

execute if block ~ ~ ~ chest run scoreboard players set @s Temporary 1
execute if block ~ ~ ~ trapped_chest run scoreboard players set @s Temporary 1
execute unless score @s Temporary matches 1 run tellraw @s ["足元が[",{"translate":"block.minecraft.chest"},"/",{"translate":"block.minecraft.trapped_chest"},"]である必要があります"]
execute unless score @s Temporary matches 1 run tag @s remove CanUsed
scoreboard players reset @s Temporary
# CanUsedでないならreturn
execute if entity @s[tag=!CanUsed] run return fail

# サバイバルエリアか?
execute unless predicate api:area/is_breakable run function lib:message/artifact/can_not_use_here
execute unless predicate api:area/is_breakable run tag @s remove CanUsed
execute if entity @s[tag=!CanUsed] run return fail

# 足元がチェスト・トラップチェストか?
execute unless block ~ ~ ~ chest unless block ~ ~ ~ trapped_chest run data modify storage asset:temp Fail set value true
execute if data storage asset:temp {Fail:true} run tellraw @s [{"text":"","italic":false,"color":"red"},{"text":"足元が"},{"translate":"block.minecraft.chest"},{"text":"か"},{"translate":"block.minecraft.trapped_chest"},{"text":"である必要があります。"}]
execute if data storage asset:temp {Fail:true} run tag @s remove CanUsed
data remove storage asset:temp Fail
execute if entity @s[tag=!CanUsed] run return fail

# チェストの中身を取得し、中にチェスト・シュルカーボックスがあれば回収できない
# 失敗時、asset:temp blockを削除
data modify storage asset:temp block set from block ~ ~ ~
execute if function asset:artifact/0290.carefully_collector/trigger/2.check_condition/ban_items run data modify storage asset:temp Fail set value true
execute if data storage asset:temp {Fail:true} run tellraw @s [{"translate":"block.minecraft.chest","color":"red"},{"text":"または"},{"translate":"block.minecraft.shulker_box"},{"text":"が中に入っています"}]
execute if data storage asset:temp {Fail:true} run data remove storage asset:temp block
execute if data storage asset:temp {Fail:true} run tag @s remove CanUsed
data remove storage asset:temp Fail
execute if entity @s[tag=!CanUsed] run return fail

# CanUsedタグをチェックして3.main.mcfunctionを実行する
execute if entity @s[tag=CanUsed] run function asset:artifact/0290.carefully_collector/trigger/3.main
function asset:artifact/0290.carefully_collector/trigger/3.main

# リセット
data remove storage asset:temp block
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#> asset:artifact/0290.carefully_collector/trigger/2.check_condition/ban_items
#
#
#
# @within function asset:artifact/0290.carefully_collector/trigger/2.check_condition

# チェスト、トラップチェスト、各色シュルカーボックスが入っていたら成功
execute if data storage asset:temp block.Items[{id:"minecraft:chest"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:trapped_chest"}] run return 1

execute if data storage asset:temp block.Items[{id:"minecraft:shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:white_shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:black_shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:light_gray_shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:gray_shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:brown_shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:red_shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:orange_shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:yellow_shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:lime_shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:green_shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:cyan_shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:light_blue_shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:blue_shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:purple_shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:magenta_shulker_box"}] run return 1
execute if data storage asset:temp block.Items[{id:"minecraft:pink_shulker_box"}] run return 1

# 失敗
return 0
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
summon item ~ ~ ~ {Tags:[CarefullyCollect],Item:{id:"minecraft:barrier",Count:1b}}

# データ処理
data modify storage asset:temp block set from block ~ ~ ~

data modify storage asset:temp chest.Count set value 1b
data modify storage asset:temp chest.id set from storage asset:temp block.id
Expand All @@ -35,6 +34,5 @@
# リセット
setblock ~ ~ ~ air
scoreboard players reset @s Temporary
data remove storage asset:temp block
data remove storage asset:temp chest
tag @e[type=item,tag=CarefullyCollect,distance=..0] remove CarefullyCollect
tag @e[type=item,tag=CarefullyCollect,distance=..0] remove CarefullyCollect