Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

印板固有処理 #470

Merged
merged 16 commits into from
Dec 10, 2024
Merged
12 changes: 12 additions & 0 deletions data/item/function/sign/click/annihilate/.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#> item:sign/click/annihilate/
#
# 全滅の印板
#
# @private

# 近くに印板対策の敵がいる場合、失敗
execute if entity @e[distance=..12,tag=AntiAnnihilate] run function makeup:item/sign/annihilate/fail
execute unless entity @e[distance=..12,tag=AntiAnnihilate] run function item:sign/click/annihilate/success

# 消滅
setblock ~ ~ ~ minecraft:air
22 changes: 22 additions & 0 deletions data/item/function/sign/click/annihilate/success.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#> item:sign/click/annihilate/success
#
# 全滅処理
#
# @within function item:sign/click/annihilate/

# MOBと弾の全滅処理
tag @e[distance=..12,tag=Mob] add Garbage
tag @e[distance=..12,tag=DamageProjectile] add Garbage

# プレイヤー全滅処理
# レーダー・ヴィジョンを使っている奴も許さない
execute as @a[distance=..12,scores={RaderVision=-2147483648..2147483647}] run tag @s add NowTarget
execute as @a[distance=..12,scores={RaderVision=-2147483648..2147483647}] run function skill:act/hunter/rader_vision/return0
data remove storage score_damage: Argument
data modify storage score_damage: Argument set value {Damage:999,BypassArmor:1b,BypassResistance:1b,EPF:0,DeathCause:'{"translate":"君は次の自分に思いを託して、跡形もなく消し飛んだ。","color":"#BD0000","bold":true}'}
execute as @a[distance=..12,predicate=entity:player,tag=!NowTarget] run function score_damage:api/attack
execute as @a[tag=NowTarget] run function score_damage:api/attack
tag @a[tag=NowTarget] remove NowTarget

# 演出
function makeup:item/sign/annihilate/success
11 changes: 11 additions & 0 deletions data/item/function/sign/click/black_mage_soul.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> item:sign/click/black_mage_soul
##############################
### 黒魔道士の魂
##############################


## 手にアイテムを持っているかを確認
## 持っていなかったらエラーメッセージを返す
execute unless items entity @s weapon.mainhand * run tellraw @s {"translate":"手に何かアイテムを持ってください。","color":"#CF1E0A"}
execute unless items entity @s weapon.mainhand * run function makeup:item/sign/soul_series/fail
execute if items entity @s weapon.mainhand * run function item:sign/soul_series/black_mage/
9 changes: 9 additions & 0 deletions data/item/function/sign/click/break_cobblestone.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> item:sign/click/break_cobblestone
# 範囲内の丸石をコントロールエリアへ輸送
clone ~-6 ~-1 ~-6 ~6 ~7 ~6 to area:control_area 1 20 1 filtered minecraft:cobblestone move
execute in area:control_area positioned 1 20 1 run fill ~ ~ ~ ~12 ~8 ~12 minecraft:air destroy

# アイテムを与える
execute in area:control_area run tp @e[type=item,x=0,y=16,z=0,dx=15,dy=15,dz=15] @s

function makeup:item/sign/common_firework.macro {color:8224125}
9 changes: 9 additions & 0 deletions data/item/function/sign/click/break_cobweb.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> item:sign/click/break_cobblestone
# 範囲内の蜘蛛の巣をコントロールエリアへ輸送
clone ~-6 ~-1 ~-6 ~6 ~7 ~6 to area:control_area 1 20 1 filtered minecraft:cobweb move
execute in area:control_area positioned 1 20 1 run fill ~ ~ ~ ~12 ~8 ~12 minecraft:air destroy

# アイテムを与える
execute in area:control_area run tp @e[type=item,x=0,y=16,z=0,dx=15,dy=15,dz=15] @s

function makeup:item/sign/common_firework.macro {color:15990012}
9 changes: 9 additions & 0 deletions data/item/function/sign/click/break_gravel.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> item:sign/click/break_gravel
# 範囲内の砂利をコントロールエリアへ輸送
clone ~-6 ~-1 ~-6 ~6 ~7 ~6 to area:control_area 1 20 1 filtered minecraft:gravel move
execute in area:control_area positioned 1 20 1 run fill ~ ~ ~ ~12 ~8 ~12 minecraft:air destroy

# アイテムを与える
execute in area:control_area run tp @e[type=item,x=0,y=16,z=0,dx=15,dy=15,dz=15] @s

function makeup:item/sign/common_firework.macro {color:8420731}
64 changes: 64 additions & 0 deletions data/item/function/sign/click/break_log/.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#> item:sign/click/break_log/
# 範囲内の原木をコントロールエリアに輸送
# forceloadチャンクに収まらないため分割
clone ~-9 ~-1 ~-9 ~ ~7 ~ to area:control_area 1 20 1 filtered #minecraft:logs
clone ~1 ~-1 ~-9 ~9 ~7 ~ to area:control_area 1 29 1 filtered #minecraft:logs
clone ~-9 ~-1 ~1 ~ ~7 ~9 to area:control_area 1 38 1 filtered #minecraft:logs
clone ~1 ~-1 ~1 ~9 ~7 ~9 to area:control_area 1 47 1 filtered #minecraft:logs

# 原木粉砕用エンティティ
fill ~-9 ~-1 ~-9 ~9 ~7 ~9 minecraft:wheat replace #minecraft:logs
clone ~-9 ~-1 ~-9 ~9 ~7 ~9 ~-9 ~-1 ~-9 filtered minecraft:air force
execute positioned ~-10 ~-2 ~-10 run tag @e[type=item,dx=20,dy=10,dz=20,tag=] add LogBreakRoot
execute positioned ~-10 ~-2 ~-10 at @e[type=item,dx=20,dy=10,dz=20,tag=LogBreakRoot] positioned ~ ~1 ~ run fill ~ ~ ~ ~ ~ ~ air destroy
execute positioned ~-10 ~-2 ~-10 run kill @e[type=item,dx=20,dy=10,dz=20,tag=LogBreakRoot]

# 原木アイテムを与える
execute in area:control_area positioned 1 20 1 run fill ~ ~ ~ ~9 ~35 ~9 minecraft:air destroy
execute in area:control_area run tp @e[type=item,x=0,y=19,z=0,dx=10,dy=37,dz=10] @s

# 範囲内の葉の数を記録し報酬を召喚
execute store result score _ _ run fill ~-14 ~-1 ~-14 ~14 ~10 ~14 minecraft:air replace minecraft:oak_leaves
execute if score _ _ matches 1.. in area:control_area run setblock 5 5 5 minecraft:oak_leaves
execute if score _ _ matches 1.. in area:control_area run function item:sign/click/common/mine_loop
execute store result score _ _ run fill ~-14 ~-1 ~-14 ~14 ~10 ~14 minecraft:air replace minecraft:mangrove_leaves
execute if score _ _ matches 1.. in area:control_area run setblock 5 5 5 minecraft:mangrove_leaves
execute if score _ _ matches 1.. in area:control_area run function item:sign/click/common/mine_loop
execute store result score _ _ run fill ~-14 ~-1 ~-14 ~14 ~10 ~14 minecraft:air replace minecraft:jungle_leaves
execute if score _ _ matches 1.. in area:control_area run setblock 5 5 5 minecraft:jungle_leaves
execute if score _ _ matches 1.. in area:control_area run function item:sign/click/common/mine_loop
execute store result score _ _ run fill ~-14 ~-1 ~-14 ~14 ~10 ~14 minecraft:air replace minecraft:spruce_leaves
execute if score _ _ matches 1.. in area:control_area run setblock 5 5 5 minecraft:spruce_leaves
execute if score _ _ matches 1.. in area:control_area run function item:sign/click/common/mine_loop
execute store result score _ _ run fill ~-14 ~-1 ~-14 ~14 ~10 ~14 minecraft:air replace minecraft:dark_oak_leaves
execute if score _ _ matches 1.. in area:control_area run setblock 5 5 5 minecraft:dark_oak_leaves
execute if score _ _ matches 1.. in area:control_area run function item:sign/click/common/mine_loop
execute store result score _ _ run fill ~-14 ~-1 ~-14 ~14 ~10 ~14 minecraft:air replace minecraft:acacia_leaves
execute if score _ _ matches 1.. in area:control_area run setblock 5 5 5 minecraft:acacia_leaves
execute if score _ _ matches 1.. in area:control_area run function item:sign/click/common/mine_loop
execute store result score _ _ run fill ~-14 ~-1 ~-14 ~14 ~10 ~14 minecraft:air replace minecraft:birch_leaves
execute if score _ _ matches 1.. in area:control_area run setblock 5 5 5 minecraft:birch_leaves
execute if score _ _ matches 1.. in area:control_area run function item:sign/click/common/mine_loop
execute store result score _ _ run fill ~-14 ~-1 ~-14 ~14 ~10 ~14 minecraft:air replace minecraft:azalea_leaves
execute if score _ _ matches 1.. in area:control_area run setblock 5 5 5 minecraft:azalea_leaves
execute if score _ _ matches 1.. in area:control_area run function item:sign/click/common/mine_loop
execute store result score _ _ run fill ~-14 ~-1 ~-14 ~14 ~10 ~14 minecraft:air replace minecraft:flowering_azalea_leaves
execute if score _ _ matches 1.. in area:control_area run setblock 5 5 5 minecraft:flowering_azalea_leaves
execute if score _ _ matches 1.. in area:control_area run function item:sign/click/common/mine_loop
execute store result score _ _ run fill ~-14 ~-1 ~-14 ~14 ~10 ~14 minecraft:air replace minecraft:mangrove_leaves
execute if score _ _ matches 1.. in area:control_area run setblock 5 5 5 minecraft:mangrove_leaves
execute if score _ _ matches 1.. in area:control_area run function item:sign/click/common/mine_loop
execute store result score _ _ run fill ~-14 ~-1 ~-14 ~14 ~10 ~14 minecraft:air replace minecraft:cherry_leaves
execute if score _ _ matches 1.. in area:control_area run setblock 5 5 5 minecraft:cherry_leaves
execute if score _ _ matches 1.. in area:control_area run function item:sign/click/common/mine_loop

# warn対策
execute in area:control_area positioned 5.0 5.0 5.0 as @e[distance=0] run data modify entity @s PickupDelay set value 9s

# アイテムを与える
execute in area:control_area positioned 5.0 5.0 5.0 run tp @e[distance=0] @s

# 原木粉砕スケジュール起動
schedule function item:sign/click/break_log/loop 2t

function makeup:item/sign/common_firework.macro {color:6639666}
3 changes: 3 additions & 0 deletions data/item/function/sign/click/break_log/loop.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#> item:sign/click/break_log/loop
execute at @e[type=item,nbt={Age:1s}] if block ~ ~1 ~ #minecraft:logs run schedule function item:sign/click/break_log/loop 1t
execute at @e[type=item,nbt={Age:1s}] positioned ~ ~1 ~ if block ~ ~ ~ #minecraft:logs run fill ~ ~ ~ ~ ~ ~ air destroy
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> item:sign/click/common/consume_loop
# 植え付け用 種消費の共通function
execute store result score # _ run data get entity @e[distance=0,tag=ConsumeItem,limit=1] Item.count
scoreboard players operation _ Calc -= # _

execute if score _ Calc matches ..-1 store result entity @e[distance=0,tag=ConsumeItem,limit=1] Item.count byte -1 run scoreboard players get _ Calc
execute if score _ Calc matches 0.. run kill @e[distance=0,tag=ConsumeItem,limit=1]

execute if score _ Calc matches 1.. run function item:sign/click/common/consume_loop
5 changes: 5 additions & 0 deletions data/item/function/sign/click/common/mine_loop.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#> item:sign/click/common/mine_loop
# プレイヤーの持っているアイテムで採掘をする共通funciton
loot spawn 5.0 5.0 5.0 mine 5 5 5 mainhand
scoreboard players remove _ _ 1
execute if score _ _ matches 1.. run function item:sign/click/common/mine_loop
11 changes: 11 additions & 0 deletions data/item/function/sign/click/dye_autumn.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> item:sign/click/dye_autumn
##############################
### 衣替え装置 秋
##############################

#冬色に染める
#fill ~-1 ~-2 ~-2 ~5 ~4 ~4 minecraft:light_gray_wool replace minecraft:orange_wool
#data merge block ~ ~ ~ {Text1:"[{\"text\":\"\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"function item:sign/click/tent_placer/dye_winter\"}},{\"text\":\"\\u2726 \",\"color\":\"aqua\"},{\"translate\":\"衣替え装置\",\"bold\":true,\"color\":\"aqua\"},{\"text\":\" \\u2726\",\"color\":\"aqua\"}]",Text2:"{\"text\":\"=-=-=-=-=\"}",Text3:"[\"\",{\"text\":\"=-=\"},{\"translate\":\"冬\",\"bold\":true,\"color\":\"gray\"},{\"text\":\"=-=\"}]",Text4:"{\"text\":\"=-=-=-=-=\"}"}
#playsound minecraft:block.piston.contract master @a[distance=..16] ~ ~ ~ 1 1.5
#particle minecraft:happy_villager ~2 ~ ~1 3 3 3 0 100 force
#particle minecraft:firework ~2 ~ ~1 3 3 3 0 100 force
11 changes: 11 additions & 0 deletions data/item/function/sign/click/dye_spring.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> item:sign/click/dye_spring
##############################
### 衣替え装置 春
##############################

#夏色に染める
#fill ~-1 ~-2 ~-2 ~5 ~4 ~4 minecraft:green_wool replace minecraft:pink_wool
#data merge block ~ ~ ~ {Text1:"[{\"text\":\"\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"function item:sign/click/tent_placer/dye_summer\"}},{\"text\":\"\\u2726 \",\"color\":\"aqua\"},{\"translate\":\"衣替え装置\",\"bold\":true,\"color\":\"aqua\"},{\"text\":\" \\u2726\",\"color\":\"aqua\"}]",Text2:"{\"text\":\"=-=-=-=-=\"}",Text3:"[\"\",{\"text\":\"=-=\"},{\"translate\":\"春\",\"bold\":true,\"color\":\"dark_green\"},{\"text\":\"=-=\"}]",Text4:"{\"text\":\"=-=-=-=-=\"}"}
#playsound minecraft:block.piston.contract master @a[distance=..16] ~ ~ ~ 1 1.5
#particle minecraft:happy_villager ~2 ~ ~1 3 3 3 0 100 force
#particle minecraft:firework ~2 ~ ~1 3 3 3 0 100 force
11 changes: 11 additions & 0 deletions data/item/function/sign/click/dye_summer.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> item:sign/click/dye_summer
##############################
### 衣替え装置 夏
##############################

#秋色に染める
#fill ~-1 ~-2 ~-2 ~5 ~4 ~4 minecraft:orange_wool replace minecraft:green_wool
#data merge block ~ ~ ~ {Text1:"[{\"text\":\"\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"function item:sign/click/tent_placer/dye_autumn\"}},{\"text\":\"\\u2726 \",\"color\":\"aqua\"},{\"translate\":\"衣替え装置\",\"bold\":true,\"color\":\"aqua\"},{\"text\":\" \\u2726\",\"color\":\"aqua\"}]",Text2:"{\"text\":\"=-=-=-=-=\"}",Text3:"[\"\",{\"text\":\"=-=\"},{\"translate\":\"夏\",\"bold\":true,\"color\":\"gold\"},{\"text\":\"=-=\"}]",Text4:"{\"text\":\"=-=-=-=-=\"}"}
#playsound minecraft:block.piston.contract master @a[distance=..16] ~ ~ ~ 1 1.5
#particle minecraft:happy_villager ~2 ~ ~1 3 3 3 0 100 force
#particle minecraft:firework ~2 ~ ~1 3 3 3 0 100 force
11 changes: 11 additions & 0 deletions data/item/function/sign/click/dye_winter.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> item:sign/click/dye_winter
##############################
### 衣替え装置 冬
##############################

#春色に染める
#fill ~-1 ~-2 ~-2 ~5 ~4 ~4 minecraft:pink_wool replace minecraft:light_gray_wool
#data merge block ~ ~ ~ {Text1:"[{\"text\":\"\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"function item:sign/click/tent_placer/dye_spring\"}},{\"text\":\"\\u2726 \",\"color\":\"aqua\"},{\"translate\":\"衣替え装置\",\"bold\":true,\"color\":\"aqua\"},{\"text\":\" \\u2726\",\"color\":\"aqua\"}]",Text2:"{\"text\":\"=-=-=-=-=\"}",Text3:"[\"\",{\"text\":\"=-=\"},{\"translate\":\"冬\",\"bold\":true,\"color\":\"light_purple\"},{\"text\":\"=-=\"}]",Text4:"{\"text\":\"=-=-=-=-=\"}"}
#playsound minecraft:block.piston.contract master @a[distance=..16] ~ ~ ~ 1 1.5
#particle minecraft:happy_villager ~2 ~ ~1 3 3 3 0 100 force
#particle minecraft:firework ~2 ~ ~1 3 3 3 0 100 force
26 changes: 26 additions & 0 deletions data/item/function/sign/click/harvest_beetroot.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#> item:sign/click/harvest_beetroot
# 範囲内の育ち切った作物の数を記録
execute store result score _ Calc store result score _ _ run clone ~-9 ~-1 ~-9 ~9 ~7 ~9 ~-9 ~-1 ~-9 filtered minecraft:beetroots[age=3] force

# 育ち切った作物の数だけ報酬を召喚
execute if score _ _ matches 1.. in area:control_area run setblock 5 5 5 minecraft:beetroots[age=3]
execute if score _ _ matches 1.. in area:control_area run function item:sign/click/common/mine_loop
execute in area:control_area run setblock 5 5 5 air

# warn対策
execute in area:control_area positioned 5.0 5.0 5.0 as @e[distance=0] run data modify entity @s PickupDelay set value 9s

# 得られた種の数を取得
execute in area:control_area positioned 5.0 5.0 5.0 run tag @e[distance=0,nbt={Item:{id:"minecraft:beetroot_seeds"}}] add ConsumeItem
execute in area:control_area positioned 5.0 5.0 5.0 as @e[distance=0,tag=ConsumeItem] run data modify storage calc: List append from entity @s Item.count
execute store result score _ _ run function calc:list/sum/x1

# 種を消費して再設置する 足りないなら作物を回収する
execute if score _ Calc <= _ _ in area:control_area positioned 5.0 5.0 5.0 run function item:sign/click/common/consume_loop
execute if score _ Calc matches 1.. run fill ~-9 ~-1 ~-9 ~9 ~7 ~9 air replace minecraft:beetroots[age=3]
execute if score _ Calc matches ..0 run fill ~-9 ~-1 ~-9 ~9 ~7 ~9 minecraft:beetroots[age=0] replace minecraft:beetroots[age=3]

# 収穫物を与える
execute in area:control_area positioned 5.0 5.0 5.0 run tp @e[distance=0] @s

function makeup:item/sign/common_firework.macro {color:16761207}
26 changes: 26 additions & 0 deletions data/item/function/sign/click/harvest_carrot.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#> item:sign/click/harvest_carrot
# 範囲内の育ち切った作物の数を記録
execute store result score _ Calc store result score _ _ run clone ~-9 ~-1 ~-9 ~9 ~7 ~9 ~-9 ~-1 ~-9 filtered minecraft:carrots[age=7] force

# 育ち切った作物の数だけ報酬を召喚
execute if score _ _ matches 1.. in area:control_area run setblock 5 5 5 minecraft:carrots[age=7]
execute if score _ _ matches 1.. in area:control_area run function item:sign/click/common/mine_loop
execute in area:control_area run setblock 5 5 5 air

# warn対策
execute in area:control_area positioned 5.0 5.0 5.0 as @e[distance=0] run data modify entity @s PickupDelay set value 9s

# 得られた人参の数を取得
execute in area:control_area positioned 5.0 5.0 5.0 run tag @e[distance=0,nbt={Item:{id:"minecraft:carrot"}}] add ConsumeItem
execute in area:control_area positioned 5.0 5.0 5.0 as @e[distance=0,tag=ConsumeItem] run data modify storage calc: List append from entity @s Item.count
execute store result score _ _ run function calc:list/sum/x1

# 人参を消費して再設置する 足りないなら作物を回収する
execute if score _ Calc <= _ _ in area:control_area positioned 5.0 5.0 5.0 run function item:sign/click/common/consume_loop
execute if score _ Calc matches 1.. run fill ~-9 ~-1 ~-9 ~9 ~7 ~9 air replace minecraft:carrots[age=7]
execute if score _ Calc matches ..0 run fill ~-9 ~-1 ~-9 ~9 ~7 ~9 minecraft:carrots[age=0] replace minecraft:carrots[age=7]

# 収穫物を与える
execute in area:control_area positioned 5.0 5.0 5.0 run tp @e[distance=0] @s

function makeup:item/sign/common_firework.macro {color:16761207}
26 changes: 26 additions & 0 deletions data/item/function/sign/click/harvest_nether_wart.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#> item:sign/click/harvest_nether_wart
# 範囲内の育ち切った作物の数を記録
execute store result score _ Calc store result score _ _ run clone ~-9 ~-1 ~-9 ~9 ~7 ~9 ~-9 ~-1 ~-9 filtered minecraft:nether_wart[age=3] force

# 育ち切った作物の数だけ報酬を召喚
execute if score _ _ matches 1.. in area:control_area run setblock 5 5 5 minecraft:nether_wart[age=3]
execute if score _ _ matches 1.. in area:control_area run function item:sign/click/common/mine_loop
execute in area:control_area run setblock 5 5 5 air

# warn対策
execute in area:control_area positioned 5.0 5.0 5.0 as @e[distance=0] run data modify entity @s PickupDelay set value 9s

# 得られた人参の数を取得
execute in area:control_area positioned 5.0 5.0 5.0 run tag @e[distance=0,nbt={Item:{id:"minecraft:nether_wart"}}] add ConsumeItem
execute in area:control_area positioned 5.0 5.0 5.0 as @e[distance=0,tag=ConsumeItem] run data modify storage calc: List append from entity @s Item.count
execute store result score _ _ run function calc:list/sum/x1

# 人参を消費して再設置する 足りないなら作物を回収する
execute if score _ Calc <= _ _ in area:control_area positioned 5.0 5.0 5.0 run function item:sign/click/common/consume_loop
execute if score _ Calc matches 1.. run fill ~-9 ~-1 ~-9 ~9 ~7 ~9 air replace minecraft:nether_wart[age=3]
execute if score _ Calc matches ..0 run fill ~-9 ~-1 ~-9 ~9 ~7 ~9 minecraft:nether_wart[age=0] replace minecraft:nether_wart[age=3]

# 収穫物を与える
execute in area:control_area positioned 5.0 5.0 5.0 run tp @e[distance=0] @s

function makeup:item/sign/common_firework.macro {color:10888496}
26 changes: 26 additions & 0 deletions data/item/function/sign/click/harvest_potato.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#> item:sign/click/harvest_potato
# 範囲内の育ち切った作物の数を記録
execute store result score _ Calc store result score _ _ run clone ~-9 ~-1 ~-9 ~9 ~7 ~9 ~-9 ~-1 ~-9 filtered minecraft:potatoes[age=7] force

# 育ち切った作物の数だけ報酬を召喚
execute if score _ _ matches 1.. in area:control_area run setblock 5 5 5 minecraft:potatoes[age=7]
execute if score _ _ matches 1.. in area:control_area run function item:sign/click/common/mine_loop
execute in area:control_area run setblock 5 5 5 air

# warn対策
execute in area:control_area positioned 5.0 5.0 5.0 as @e[distance=0] run data modify entity @s PickupDelay set value 9s

# 得られた芋の数を取得
execute in area:control_area positioned 5.0 5.0 5.0 run tag @e[distance=0,nbt={Item:{id:"minecraft:potato"}}] add ConsumeItem
execute in area:control_area positioned 5.0 5.0 5.0 as @e[distance=0,tag=ConsumeItem] run data modify storage calc: List append from entity @s Item.count
execute store result score _ _ run function calc:list/sum/x1

# 芋を消費して再設置する 足りないなら作物を回収する
execute if score _ Calc <= _ _ in area:control_area positioned 5.0 5.0 5.0 run function item:sign/click/common/consume_loop
execute if score _ Calc matches 1.. run fill ~-9 ~-1 ~-9 ~9 ~7 ~9 air replace minecraft:potatoes[age=7]
execute if score _ Calc matches ..0 run fill ~-9 ~-1 ~-9 ~9 ~7 ~9 minecraft:potatoes[age=0] replace minecraft:potatoes[age=7]

# 収穫物を与える
execute in area:control_area positioned 5.0 5.0 5.0 run tp @e[distance=0] @s

function makeup:item/sign/common_firework.macro {color:16508604}
Loading
Loading