diff --git a/MarkerMotion/data/marker_motion/functions/bounce/conside_gravity.mcfunction b/MarkerMotion/data/marker_motion/functions/bounce/conside_gravity.mcfunction index 61d6322..95f6241 100644 --- a/MarkerMotion/data/marker_motion/functions/bounce/conside_gravity.mcfunction +++ b/MarkerMotion/data/marker_motion/functions/bounce/conside_gravity.mcfunction @@ -11,6 +11,3 @@ # Y方向接触時、重力合計を反転 execute if score #MarkerMotion.BlockCheck neac_value matches 3..4 store result storage neac: _.MarkerMotion.GravitySum int -1 run scoreboard players get #MarkerMotion.GravitySum neac_value - -# スコアリセット - scoreboard players reset #MarkerMotion.Bounce.CG.GSumAtCGPrevBounce \ No newline at end of file diff --git a/MarkerMotion/data/marker_motion/functions/get_move.mcfunction b/MarkerMotion/data/marker_motion/functions/get_move.mcfunction deleted file mode 100644 index b49380e..0000000 --- a/MarkerMotion/data/marker_motion/functions/get_move.mcfunction +++ /dev/null @@ -1,47 +0,0 @@ -#> marker_motion:get_move -# -# Moveを算出する -# -# @within function marker_motion:main - -# ストレージ初期化 - data modify storage neac: _.MarkerMotion.Move set value {Rotation:[0.0f,0.0f],Amount:0.0d} - -# 相対で移動して距離を出す - execute if entity @s[distance=20.48..] run scoreboard players add #MarkerMotion.TMP neac_value 2048 - execute if entity @s[distance=20.48..] positioned as @s run tp @s ^ ^ ^-20.48 - execute if entity @s[distance=10.24..] run scoreboard players add #MarkerMotion.TMP neac_value 1024 - execute if entity @s[distance=10.24..] positioned as @s run tp @s ^ ^ ^-10.24 - execute if entity @s[distance=5.12..] run scoreboard players add #MarkerMotion.TMP neac_value 512 - execute if entity @s[distance=5.12..] positioned as @s run tp @s ^ ^ ^-5.12 - execute if entity @s[distance=2.56..] run scoreboard players add #MarkerMotion.TMP neac_value 256 - execute if entity @s[distance=2.56..] positioned as @s run tp @s ^ ^ ^-2.56 - execute if entity @s[distance=1.28..] run scoreboard players add #MarkerMotion.TMP neac_value 128 - execute if entity @s[distance=1.28..] positioned as @s run tp @s ^ ^ ^-1.28 - execute if entity @s[distance=0.64..] run scoreboard players add #MarkerMotion.TMP neac_value 64 - execute if entity @s[distance=0.64..] positioned as @s run tp @s ^ ^ ^-0.64 - execute if entity @s[distance=0.32..] run scoreboard players add #MarkerMotion.TMP neac_value 32 - execute if entity @s[distance=0.32..] positioned as @s run tp @s ^ ^ ^-0.32 - execute if entity @s[distance=0.16..] run scoreboard players add #MarkerMotion.TMP neac_value 16 - execute if entity @s[distance=0.16..] positioned as @s run tp @s ^ ^ ^-0.16 - execute if entity @s[distance=0.08..] run scoreboard players add #MarkerMotion.TMP neac_value 8 - execute if entity @s[distance=0.08..] positioned as @s run tp @s ^ ^ ^-0.08 - execute if entity @s[distance=0.04..] run scoreboard players add #MarkerMotion.TMP neac_value 4 - execute if entity @s[distance=0.04..] positioned as @s run tp @s ^ ^ ^-0.04 - execute if entity @s[distance=0.02..] run scoreboard players add #MarkerMotion.TMP neac_value 2 - execute if entity @s[distance=0.02..] positioned as @s run tp @s ^ ^ ^-0.02 - execute if entity @s[distance=0.01..] run scoreboard players add #MarkerMotion.TMP neac_value 1 - execute if entity @s[distance=0.01..] positioned as @s run tp @s ^ ^ ^-0.01 - -# 移動距離スコアをストレージへ - execute store result storage neac: _.MarkerMotion.Move.Amount double 0.01 run scoreboard players get #MarkerMotion.TMP neac_value - -# 向きをこのfunctionの実行角度にしてストレージへ - tp @s ~ ~ ~ ~ ~ - data modify storage neac: _.MarkerMotion.Move.Rotation set from entity @s Rotation - -# スコアリセット - scoreboard players reset #MarkerMotion.TMP - -# kill - kill @s \ No newline at end of file diff --git a/MarkerMotion/data/marker_motion/functions/main.mcfunction b/MarkerMotion/data/marker_motion/functions/main.mcfunction index b8f908f..8f36667 100644 --- a/MarkerMotion/data/marker_motion/functions/main.mcfunction +++ b/MarkerMotion/data/marker_motion/functions/main.mcfunction @@ -20,20 +20,16 @@ execute unless data storage neac: _.MarkerMotion.speed.loss{type:"*"} store result score #MarkerMotion.SpeedLoss neac_value run data get storage neac: _.MarkerMotion.speed.loss.amount 100 execute if data storage neac: _.MarkerMotion.speed.loss{type:"*"} if data storage neac: _.MarkerMotion.speed.loss.amount store result score #MarkerMotion.SpeedLoss neac_value run data get storage neac: _.MarkerMotion.speed.loss.amount 1000 -# 到達目標位置用の取得に使うエンティティセットアップ - # なんか残ってたらkill - execute if entity @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] run kill @e[type=#marker_motion:selector,tag=MarkerMotion.this] - execute summon marker run function marker_motion:set_arrival_pos - # 1瞬だけつくようにBounce検知用タグの削除。付与は marker_motion:bounce execute if entity @s[tag=MarkerMotion.bounce] run tag @s remove MarkerMotion.bounce # 接触したブロックが1tickの間前回と同じのにならないようにする - data modify storage neac: _.BounceDirectionDisable set from storage neac: _.MarkerMotion.BounceDirection - data remove storage neac: _.MarkerMotion.BounceDirection -# 現在位置と到達目標位置の間にブロックがあるかチェック - # function再起で到達目標位置までの間にブロックがあるかチェック - # その際targetタグがいればヒット判定を返す また、stopwith.hitがtrueであればMarkerMotion.stopwith.hitを返す - execute facing entity @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] feet run function marker_motion:tp/ + execute if data storage neac: _.MarkerMotion.BounceDirection run data modify storage neac: _.BounceDirectionDisable set from storage neac: _.MarkerMotion.BounceDirection + execute if data storage neac: _.MarkerMotion.BounceDirection run data remove storage neac: _.MarkerMotion.BounceDirection +# 到達目標位置を取得してそこまでの間にブロックがあるかチェック + # その際targetタグがいればヒット判定も返す + tag @s add MarkerMotion.me + execute summon marker run function marker_motion:tp/ + tag @s remove MarkerMotion.me # スピード減少 # + @@ -56,9 +52,6 @@ scoreboard players reset #MarkerMotion.Gravity scoreboard players reset #MarkerMotion.GravitySum -# 最初の実行位置から移動位置までの距離からMoveを算出 + kill - execute facing entity @s feet as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] run function marker_motion:get_move - # ストレージデータを自身に返して初期化 data modify entity @s data.MarkerMotion set from storage neac: _.MarkerMotion data remove storage neac: _ diff --git a/MarkerMotion/data/marker_motion/functions/set_arrival_pos.mcfunction b/MarkerMotion/data/marker_motion/functions/set_arrival_pos.mcfunction deleted file mode 100644 index 821a628..0000000 --- a/MarkerMotion/data/marker_motion/functions/set_arrival_pos.mcfunction +++ /dev/null @@ -1,46 +0,0 @@ -#> marker_motion:set_arrival_pos -# -# 到達目標位置をへ自身を移動させる -# -# @within function marker_motion:main - -# 必要なタグ付与 - tag @s add MarkerMotion.this - -# 相対で移動 - scoreboard players operation #MarkerMotion.TMP neac_value = #MarkerMotion.Speed neac_value - - execute if score #MarkerMotion.TMP neac_value matches 2048.. positioned as @s run tp @s ^ ^ ^20.48 - execute if score #MarkerMotion.TMP neac_value matches 2048.. run scoreboard players remove #MarkerMotion.TMP neac_value 2048 - execute if score #MarkerMotion.TMP neac_value matches 1024.. positioned as @s run tp @s ^ ^ ^10.24 - execute if score #MarkerMotion.TMP neac_value matches 1024.. run scoreboard players remove #MarkerMotion.TMP neac_value 1024 - execute if score #MarkerMotion.TMP neac_value matches 512.. positioned as @s run tp @s ^ ^ ^5.12 - execute if score #MarkerMotion.TMP neac_value matches 512.. run scoreboard players remove #MarkerMotion.TMP neac_value 512 - execute if score #MarkerMotion.TMP neac_value matches 256.. positioned as @s run tp @s ^ ^ ^2.56 - execute if score #MarkerMotion.TMP neac_value matches 256.. run scoreboard players remove #MarkerMotion.TMP neac_value 256 - execute if score #MarkerMotion.TMP neac_value matches 128.. positioned as @s run tp @s ^ ^ ^1.28 - execute if score #MarkerMotion.TMP neac_value matches 128.. run scoreboard players remove #MarkerMotion.TMP neac_value 128 - execute if score #MarkerMotion.TMP neac_value matches 64.. positioned as @s run tp @s ^ ^ ^0.64 - execute if score #MarkerMotion.TMP neac_value matches 64.. run scoreboard players remove #MarkerMotion.TMP neac_value 64 - execute if score #MarkerMotion.TMP neac_value matches 32.. positioned as @s run tp @s ^ ^ ^0.32 - execute if score #MarkerMotion.TMP neac_value matches 32.. run scoreboard players remove #MarkerMotion.TMP neac_value 32 - execute if score #MarkerMotion.TMP neac_value matches 16.. positioned as @s run tp @s ^ ^ ^0.16 - execute if score #MarkerMotion.TMP neac_value matches 16.. run scoreboard players remove #MarkerMotion.TMP neac_value 16 - execute if score #MarkerMotion.TMP neac_value matches 8.. positioned as @s run tp @s ^ ^ ^0.08 - execute if score #MarkerMotion.TMP neac_value matches 8.. run scoreboard players remove #MarkerMotion.TMP neac_value 8 - execute if score #MarkerMotion.TMP neac_value matches 4.. positioned as @s run tp @s ^ ^ ^0.04 - execute if score #MarkerMotion.TMP neac_value matches 4.. run scoreboard players remove #MarkerMotion.TMP neac_value 4 - execute if score #MarkerMotion.TMP neac_value matches 2.. positioned as @s run tp @s ^ ^ ^0.02 - execute if score #MarkerMotion.TMP neac_value matches 2.. run scoreboard players remove #MarkerMotion.TMP neac_value 2 - execute if score #MarkerMotion.TMP neac_value matches 1.. positioned as @s run tp @s ^ ^ ^0.01 - execute if score #MarkerMotion.TMP neac_value matches 1.. run scoreboard players remove #MarkerMotion.TMP neac_value 1 - -# ifに引っかからない対策で少しだけ後ろに移動しておく - execute positioned as @s run tp @s ^ ^ ^-0.0000152587890625 - -# GravitySumが0でなければ移動後のY座標から重力分を引いた座標に移動する - execute unless score #MarkerMotion.GravitySum neac_value matches 0 store result score #MarkerMotion.TMP neac_value run data get entity @s Pos[1] 1000000 - execute unless score #MarkerMotion.GravitySum neac_value matches 0 store result entity @s Pos[1] double 0.000001 run scoreboard players operation #MarkerMotion.TMP neac_value -= #MarkerMotion.GravitySum neac_value - -# スコアリセット - scoreboard players reset #MarkerMotion.TMP \ No newline at end of file diff --git a/MarkerMotion/data/marker_motion/functions/tp/.mcfunction b/MarkerMotion/data/marker_motion/functions/tp/.mcfunction index fff7264..d701ac6 100644 --- a/MarkerMotion/data/marker_motion/functions/tp/.mcfunction +++ b/MarkerMotion/data/marker_motion/functions/tp/.mcfunction @@ -1,25 +1,52 @@ #> marker_motion:tp/ # -# 移動先目標までの間にブロックがあるか探す処理 -# その際にヒットボックスでのヒットを行ったりできる +# 到達目標位置をへ自身を移動させ、その間をチェック # -# @within -# function marker_motion:main +# @within function marker_motion:main -# プレイヤーの視線をx軸で反転させた角度 - execute as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] positioned 0.0 0.0 0.0 positioned ^ ^ ^2 positioned 0.0 ~ ~ positioned ^ ^ ^-1 facing 0.0 0.0 0.0 positioned as @s run tp @s ~ ~ ~ ~ ~ +# 相対で移動 + scoreboard players operation #MarkerMotion.TMP neac_value = #MarkerMotion.Speed neac_value -# 初期化 - data modify storage neac: _.tp set value [[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}]] + execute if score #MarkerMotion.TMP neac_value matches 2048.. positioned as @s run tp @s ^ ^ ^20.48 + execute if score #MarkerMotion.TMP neac_value matches 2048.. run scoreboard players remove #MarkerMotion.TMP neac_value 2048 + execute if score #MarkerMotion.TMP neac_value matches 1024.. positioned as @s run tp @s ^ ^ ^10.24 + execute if score #MarkerMotion.TMP neac_value matches 1024.. run scoreboard players remove #MarkerMotion.TMP neac_value 1024 + execute if score #MarkerMotion.TMP neac_value matches 512.. positioned as @s run tp @s ^ ^ ^5.12 + execute if score #MarkerMotion.TMP neac_value matches 512.. run scoreboard players remove #MarkerMotion.TMP neac_value 512 + execute if score #MarkerMotion.TMP neac_value matches 256.. positioned as @s run tp @s ^ ^ ^2.56 + execute if score #MarkerMotion.TMP neac_value matches 256.. run scoreboard players remove #MarkerMotion.TMP neac_value 256 + execute if score #MarkerMotion.TMP neac_value matches 128.. positioned as @s run tp @s ^ ^ ^1.28 + execute if score #MarkerMotion.TMP neac_value matches 128.. run scoreboard players remove #MarkerMotion.TMP neac_value 128 + execute if score #MarkerMotion.TMP neac_value matches 64.. positioned as @s run tp @s ^ ^ ^0.64 + execute if score #MarkerMotion.TMP neac_value matches 64.. run scoreboard players remove #MarkerMotion.TMP neac_value 64 + execute if score #MarkerMotion.TMP neac_value matches 32.. positioned as @s run tp @s ^ ^ ^0.32 + execute if score #MarkerMotion.TMP neac_value matches 32.. run scoreboard players remove #MarkerMotion.TMP neac_value 32 + execute if score #MarkerMotion.TMP neac_value matches 16.. positioned as @s run tp @s ^ ^ ^0.16 + execute if score #MarkerMotion.TMP neac_value matches 16.. run scoreboard players remove #MarkerMotion.TMP neac_value 16 + execute if score #MarkerMotion.TMP neac_value matches 8.. positioned as @s run tp @s ^ ^ ^0.08 + execute if score #MarkerMotion.TMP neac_value matches 8.. run scoreboard players remove #MarkerMotion.TMP neac_value 8 + execute if score #MarkerMotion.TMP neac_value matches 4.. positioned as @s run tp @s ^ ^ ^0.04 + execute if score #MarkerMotion.TMP neac_value matches 4.. run scoreboard players remove #MarkerMotion.TMP neac_value 4 + execute if score #MarkerMotion.TMP neac_value matches 2.. positioned as @s run tp @s ^ ^ ^0.02 + execute if score #MarkerMotion.TMP neac_value matches 2.. run scoreboard players remove #MarkerMotion.TMP neac_value 2 + execute if score #MarkerMotion.TMP neac_value matches 1.. positioned as @s run tp @s ^ ^ ^0.01 + execute if score #MarkerMotion.TMP neac_value matches 1.. run scoreboard players remove #MarkerMotion.TMP neac_value 1 +# ifに引っかからない対策で少しだけ後ろに移動しておく + execute positioned as @s run tp @s ^ ^ ^-0.0000152587890625 -# 到達目標位置が近くてspeedが0以下であれば停止 - execute if entity @e[type=#marker_motion:selector,tag=MarkerMotion.this,distance=..0.0078125,limit=1] if score #MarkerMotion.Speed neac_value matches ..0 run tag @s add MarkerMotion.speed.0 +# GravitySumが0でなければ移動後のY座標から重力分を引いた座標に移動する + execute unless score #MarkerMotion.GravitySum neac_value matches 0 store result score #MarkerMotion.TMP neac_value run data get entity @s Pos[1] 1000000 + execute unless score #MarkerMotion.GravitySum neac_value matches 0 store result entity @s Pos[1] double 0.000001 run scoreboard players operation #MarkerMotion.TMP neac_value -= #MarkerMotion.GravitySum neac_value -# 最大ループ回数指定 - scoreboard players set #MarkerMotion.loop neac_value 41 -# 到達目標位置が近くになければそこまでの間のブロックをループでチェック - execute unless entity @e[type=#marker_motion:selector,tag=MarkerMotion.this,distance=..0.0078125,limit=1] positioned ^ ^ ^0.5 run function marker_motion:tp/1 # スコアリセット - scoreboard players reset #MarkerMotion.loop + scoreboard players reset #MarkerMotion.TMP + + +# 自身の方向を見てチェックしていく + execute facing entity @s feet run function marker_motion:tp/0 + + +# kill + kill @s \ No newline at end of file diff --git a/MarkerMotion/data/marker_motion/functions/tp/0.mcfunction b/MarkerMotion/data/marker_motion/functions/tp/0.mcfunction new file mode 100644 index 0000000..6d925aa --- /dev/null +++ b/MarkerMotion/data/marker_motion/functions/tp/0.mcfunction @@ -0,0 +1,24 @@ +#> marker_motion:tp/0 +# +# 移動先目標までの間にブロックがあるか探す処理 +# その際にヒットボックスでのヒットを行ったりできる +# +# @within +# function marker_motion:main + + +# プレイヤーの視線をx軸で反転させた角度 + execute positioned 0.0 0.0 0.0 positioned ^ ^ ^2 positioned 0.0 ~ ~ positioned ^ ^ ^-1 facing 0.0 0.0 0.0 positioned as @s run tp @s ~ ~ ~ ~ ~ + +# 初期化 + data modify storage neac: _.tp set value [[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}]] + +# 到達目標位置が近くてspeedが0以下であれば停止 + execute if entity @s[distance=..0.0078125] if score #MarkerMotion.Speed neac_value matches ..0 run tag @e[type=marker,tag=MarkerMotion.me,limit=1] add MarkerMotion.speed.0 + +# 最大ループ回数指定 + scoreboard players set #MarkerMotion.loop neac_value 41 +# 到達目標位置が近くになければそこまでの間のブロックをループでチェック + execute unless entity @s[distance=..0.0078125] positioned ^ ^ ^0.5 run function marker_motion:tp/1 +# スコアリセット + scoreboard players reset #MarkerMotion.loop diff --git a/MarkerMotion/data/marker_motion/functions/tp/1.mcfunction b/MarkerMotion/data/marker_motion/functions/tp/1.mcfunction index 677be0a..ae35d69 100644 --- a/MarkerMotion/data/marker_motion/functions/tp/1.mcfunction +++ b/MarkerMotion/data/marker_motion/functions/tp/1.mcfunction @@ -12,13 +12,13 @@ data modify storage neac: _.tp[0][].success set value 1b # ブロック探査 execute if data storage neac: _.MarkerMotion.stopwith{block:0b} run data modify storage neac: _.tp[0][].success set value 0b -execute unless data storage neac: _.MarkerMotion.stopwith{block:0b} if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision rotated as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision if predicate marker_motion:block_check/shape/erosion/check run data modify storage neac: _.tp[0][].success set value 0b +execute unless data storage neac: _.MarkerMotion.stopwith{block:0b} if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision rotated as @s if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision if predicate marker_motion:block_check/shape/erosion/check run data modify storage neac: _.tp[0][].success set value 0b # エンティティ探査 execute if entity @e[tag=MarkerMotion.target,limit=1] positioned ~-0.5 ~-0.5 ~-0.5 if entity @e[tag=MarkerMotion.target,dx=0,dy=0,dz=0,limit=1] run data modify storage neac: _.tp[0][].success set value 1b # 到達点探査 -execute if entity @e[type=#marker_motion:selector,tag=MarkerMotion.this,distance=..0.5,limit=1] run data modify storage neac: _.tp[0][].success set value 1b +execute if entity @s[distance=..0.5] run data modify storage neac: _.tp[0][].success set value 1b # 上で満たしたらさらに細かくチェック diff --git a/MarkerMotion/data/marker_motion/functions/tp/2.mcfunction b/MarkerMotion/data/marker_motion/functions/tp/2.mcfunction index b2db1bc..9d5bedd 100644 --- a/MarkerMotion/data/marker_motion/functions/tp/2.mcfunction +++ b/MarkerMotion/data/marker_motion/functions/tp/2.mcfunction @@ -12,13 +12,13 @@ data modify storage neac: _.tp[1][].success set value 1b # ブロック探査 execute if data storage neac: _.MarkerMotion.stopwith{block:0b} run data modify storage neac: _.tp[1][].success set value 0b -execute unless data storage neac: _.MarkerMotion.stopwith{block:0b} if block ^ ^ ^0.25 #marker_motion:no_collision if block ^ ^ ^-0.25 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.25 #marker_motion:no_collision if block ^ ^ ^-0.25 #marker_motion:no_collision rotated as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] if block ^ ^ ^0.25 #marker_motion:no_collision if block ^ ^ ^-0.25 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.25 #marker_motion:no_collision if block ^ ^ ^-0.25 #marker_motion:no_collision if predicate marker_motion:block_check/shape/erosion/check run data modify storage neac: _.tp[1][].success set value 0b +execute unless data storage neac: _.MarkerMotion.stopwith{block:0b} if block ^ ^ ^0.25 #marker_motion:no_collision if block ^ ^ ^-0.25 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.25 #marker_motion:no_collision if block ^ ^ ^-0.25 #marker_motion:no_collision rotated as @s if block ^ ^ ^0.25 #marker_motion:no_collision if block ^ ^ ^-0.25 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.25 #marker_motion:no_collision if block ^ ^ ^-0.25 #marker_motion:no_collision if predicate marker_motion:block_check/shape/erosion/check run data modify storage neac: _.tp[1][].success set value 0b # エンティティ探査 execute if entity @e[tag=MarkerMotion.target,limit=1] positioned ~-0.25 ~-0.25 ~-0.25 as @e[tag=MarkerMotion.target,dx=0,dy=0,dz=0] positioned ~-0.5 ~-0.5 ~-0.5 if entity @s[dx=0,dy=0,dz=0] run data modify storage neac: _.tp[1][].success set value 1b # 到達点探査 -execute if entity @e[type=#marker_motion:selector,tag=MarkerMotion.this,distance=..0.25,limit=1] run data modify storage neac: _.tp[1][].success set value 1b +execute if entity @s[distance=..0.25] run data modify storage neac: _.tp[1][].success set value 1b # 上で満たしたらさらに細かくチェック diff --git a/MarkerMotion/data/marker_motion/functions/tp/3.mcfunction b/MarkerMotion/data/marker_motion/functions/tp/3.mcfunction index 71ffe6a..56c5a08 100644 --- a/MarkerMotion/data/marker_motion/functions/tp/3.mcfunction +++ b/MarkerMotion/data/marker_motion/functions/tp/3.mcfunction @@ -12,13 +12,13 @@ data modify storage neac: _.tp[2][].success set value 1b # ブロック探査 execute if data storage neac: _.MarkerMotion.stopwith{block:0b} run data modify storage neac: _.tp[2][].success set value 0b -execute unless data storage neac: _.MarkerMotion.stopwith{block:0b} if block ^ ^ ^0.125 #marker_motion:no_collision if block ^ ^ ^-0.125 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.125 #marker_motion:no_collision if block ^ ^ ^-0.125 #marker_motion:no_collision rotated as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] if block ^ ^ ^0.125 #marker_motion:no_collision if block ^ ^ ^-0.125 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.125 #marker_motion:no_collision if block ^ ^ ^-0.125 #marker_motion:no_collision if predicate marker_motion:block_check/shape/erosion/check run data modify storage neac: _.tp[2][].success set value 0b +execute unless data storage neac: _.MarkerMotion.stopwith{block:0b} if block ^ ^ ^0.125 #marker_motion:no_collision if block ^ ^ ^-0.125 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.125 #marker_motion:no_collision if block ^ ^ ^-0.125 #marker_motion:no_collision rotated as @s if block ^ ^ ^0.125 #marker_motion:no_collision if block ^ ^ ^-0.125 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.125 #marker_motion:no_collision if block ^ ^ ^-0.125 #marker_motion:no_collision if predicate marker_motion:block_check/shape/erosion/check run data modify storage neac: _.tp[2][].success set value 0b # エンティティ探査 execute if entity @e[tag=MarkerMotion.target,limit=1] positioned ~-0.125 ~-0.125 ~-0.125 as @e[tag=MarkerMotion.target,dx=0,dy=0,dz=0] positioned ~-0.75 ~-0.75 ~-0.75 if entity @s[dx=0,dy=0,dz=0] run data modify storage neac: _.tp[2][].success set value 1b # 到達点探査 -execute if entity @e[type=#marker_motion:selector,tag=MarkerMotion.this,distance=..0.125,limit=1] run data modify storage neac: _.tp[2][].success set value 1b +execute if entity @s[distance=..0.125] run data modify storage neac: _.tp[2][].success set value 1b # 上で満たしたらさらに細かくチェック diff --git a/MarkerMotion/data/marker_motion/functions/tp/4.mcfunction b/MarkerMotion/data/marker_motion/functions/tp/4.mcfunction index f60a3fe..f579c42 100644 --- a/MarkerMotion/data/marker_motion/functions/tp/4.mcfunction +++ b/MarkerMotion/data/marker_motion/functions/tp/4.mcfunction @@ -12,13 +12,13 @@ data modify storage neac: _.tp[3][].success set value 1b # ブロック探査 execute if data storage neac: _.MarkerMotion.stopwith{block:0b} run data modify storage neac: _.tp[3][].success set value 0b -execute unless data storage neac: _.MarkerMotion.stopwith{block:0b} if block ^ ^ ^0.0625 #marker_motion:no_collision if block ^ ^ ^-0.0625 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.0625 #marker_motion:no_collision if block ^ ^ ^-0.0625 #marker_motion:no_collision rotated as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] if block ^ ^ ^0.0625 #marker_motion:no_collision if block ^ ^ ^-0.0625 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.0625 #marker_motion:no_collision if block ^ ^ ^-0.0625 #marker_motion:no_collision if predicate marker_motion:block_check/shape/erosion/check run data modify storage neac: _.tp[3][].success set value 0b +execute unless data storage neac: _.MarkerMotion.stopwith{block:0b} if block ^ ^ ^0.0625 #marker_motion:no_collision if block ^ ^ ^-0.0625 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.0625 #marker_motion:no_collision if block ^ ^ ^-0.0625 #marker_motion:no_collision rotated as @s if block ^ ^ ^0.0625 #marker_motion:no_collision if block ^ ^ ^-0.0625 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.0625 #marker_motion:no_collision if block ^ ^ ^-0.0625 #marker_motion:no_collision if predicate marker_motion:block_check/shape/erosion/check run data modify storage neac: _.tp[3][].success set value 0b # エンティティ探査 execute if entity @e[tag=MarkerMotion.target,limit=1] positioned ~-0.0625 ~-0.0625 ~-0.0625 as @e[tag=MarkerMotion.target,dx=0,dy=0,dz=0] positioned ~-0.875 ~-0.875 ~-0.875 if entity @s[dx=0,dy=0,dz=0] run data modify storage neac: _.tp[3][].success set value 1b # 到達点探査 -execute if entity @e[type=#marker_motion:selector,tag=MarkerMotion.this,distance=..0.0625,limit=1] run data modify storage neac: _.tp[3][].success set value 1b +execute if entity @s[distance=..0.0625] run data modify storage neac: _.tp[3][].success set value 1b # 上で満たしたらさらに細かくチェック diff --git a/MarkerMotion/data/marker_motion/functions/tp/5.mcfunction b/MarkerMotion/data/marker_motion/functions/tp/5.mcfunction index 1e7a224..cb9b5c1 100644 --- a/MarkerMotion/data/marker_motion/functions/tp/5.mcfunction +++ b/MarkerMotion/data/marker_motion/functions/tp/5.mcfunction @@ -12,13 +12,13 @@ data modify storage neac: _.tp[4][].success set value 1b # ブロック探査 execute if data storage neac: _.MarkerMotion.stopwith{block:0b} run data modify storage neac: _.tp[4][].success set value 0b -execute unless data storage neac: _.MarkerMotion.stopwith{block:0b} if block ^ ^ ^0.03125 #marker_motion:no_collision if block ^ ^ ^-0.03125 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.03125 #marker_motion:no_collision if block ^ ^ ^-0.03125 #marker_motion:no_collision rotated as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] if block ^ ^ ^0.03125 #marker_motion:no_collision if block ^ ^ ^-0.03125 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.03125 #marker_motion:no_collision if block ^ ^ ^-0.03125 #marker_motion:no_collision if predicate marker_motion:block_check/shape/erosion/check run data modify storage neac: _.tp[4][].success set value 0b +execute unless data storage neac: _.MarkerMotion.stopwith{block:0b} if block ^ ^ ^0.03125 #marker_motion:no_collision if block ^ ^ ^-0.03125 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.03125 #marker_motion:no_collision if block ^ ^ ^-0.03125 #marker_motion:no_collision rotated as @s if block ^ ^ ^0.03125 #marker_motion:no_collision if block ^ ^ ^-0.03125 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.03125 #marker_motion:no_collision if block ^ ^ ^-0.03125 #marker_motion:no_collision if predicate marker_motion:block_check/shape/erosion/check run data modify storage neac: _.tp[4][].success set value 0b # エンティティ探査 execute if entity @e[tag=MarkerMotion.target,limit=1] positioned ~-0.03125 ~-0.03125 ~-0.03125 as @e[tag=MarkerMotion.target,dx=0,dy=0,dz=0] positioned ~-0.9375 ~-0.9375 ~-0.9375 if entity @s[dx=0,dy=0,dz=0] run data modify storage neac: _.tp[4][].success set value 1b # 到達点探査 -execute if entity @e[type=#marker_motion:selector,tag=MarkerMotion.this,distance=..0.03125,limit=1] run data modify storage neac: _.tp[4][].success set value 1b +execute if entity @s[distance=..0.03125] run data modify storage neac: _.tp[4][].success set value 1b # 上で満たしたらさらに細かくチェック diff --git a/MarkerMotion/data/marker_motion/functions/tp/6.mcfunction b/MarkerMotion/data/marker_motion/functions/tp/6.mcfunction index 7746a7a..1a4d997 100644 --- a/MarkerMotion/data/marker_motion/functions/tp/6.mcfunction +++ b/MarkerMotion/data/marker_motion/functions/tp/6.mcfunction @@ -8,30 +8,26 @@ # 初期化 -data modify storage neac: _.tp[5][].success set value 0b -data modify storage neac: _.tp[6][].success set value 0b +data modify storage neac: _.tp[5][].success set value 2b # エンティティ探査 -execute if entity @e[tag=MarkerMotion.target,limit=1] positioned ~-0.015625 ~-0.015625 ~-0.015625 as @e[tag=MarkerMotion.target,dx=0,dy=0,dz=0] positioned ~-0.96875 ~-0.96875 ~-0.96875 if entity @s[dx=0,dy=0,dz=0] run tag @s add targets -execute if entity @e[tag=targets,limit=1] run function marker_motion:tp/targets +execute if entity @e[tag=MarkerMotion.target,limit=1] positioned ~-0.015625 ~-0.015625 ~-0.015625 as @e[tag=MarkerMotion.target,dx=0,dy=0,dz=0] positioned ~-0.96875 ~-0.96875 ~-0.96875 if entity @s[dx=0,dy=0,dz=0] run tag @s add MarkerMotion.hit +execute unless data storage neac: _.MarkerMotion.stopwith{hit:0b} if entity @e[tag=MarkerMotion.hit,limit=1] run function marker_motion:tp/targets # 到達点探査 -execute if data storage neac: _.tp[5][{success:0b}] if entity @e[type=#marker_motion:selector,tag=MarkerMotion.this,distance=..0.015625,limit=1] positioned as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] positioned ^ ^ ^0.0000152587890625 store success storage neac: _.tp[6][].success byte 1 run tp @s ~ ~ ~ +execute if data storage neac: _.tp[5][{success:2b}] if entity @s[distance=..0.015625] positioned as @s positioned ^ ^ ^0.0000152587890625 store success storage neac: _.tp[5][].success byte 1 run tp @e[type=marker,tag=MarkerMotion.me,limit=1] ~ ~ ~ # ブロック探査 -execute if data storage neac: _.tp[6][{success:0b}] if data storage neac: _.MarkerMotion.stopwith{block:0b} run data modify storage neac: _.tp[6][].success set value 2b +execute if data storage neac: _.tp[5][{success:2b}] if data storage neac: _.MarkerMotion.stopwith{block:0b} run data modify storage neac: _.tp[5][].success set value 0b -execute if data storage neac: _.tp[6][{success:0b}] positioned ^ ^ ^-0.015625 if predicate marker_motion:block_check/condition run function marker_motion:tp/point -execute if data storage neac: _.tp[6][{success:0b}] positioned ^ ^ ^0.015625 if predicate marker_motion:block_check/condition run function marker_motion:tp/point -execute if data storage neac: _.tp[6][{success:0b}] rotated ~180 ~ positioned ^ ^ ^0.015625 if predicate marker_motion:block_check/condition rotated as @s run function marker_motion:tp/point -execute if data storage neac: _.tp[6][{success:0b}] rotated ~180 ~ positioned ^ ^ ^-0.015625 if predicate marker_motion:block_check/condition rotated as @s run function marker_motion:tp/point -execute if data storage neac: _.tp[6][{success:0b}] rotated as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] positioned ^ ^ ^-0.015625 if predicate marker_motion:block_check/condition rotated as @s run function marker_motion:tp/point -execute if data storage neac: _.tp[6][{success:0b}] rotated as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] positioned ^ ^ ^0.015625 if predicate marker_motion:block_check/condition rotated as @s run function marker_motion:tp/point -execute if data storage neac: _.tp[6][{success:0b}] rotated as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] rotated ~180 ~ positioned ^ ^ ^0.015625 if predicate marker_motion:block_check/condition rotated as @s run function marker_motion:tp/point -execute if data storage neac: _.tp[6][{success:0b}] rotated as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] rotated ~180 ~ positioned ^ ^ ^-0.015625 if predicate marker_motion:block_check/condition rotated as @s run function marker_motion:tp/point - -data modify storage neac: _.tpCheck append from storage neac: _.tp[5][] -data modify storage neac: _.tpCheck append from storage neac: _.tp[6][] +execute if data storage neac: _.tp[5][{success:2b}] positioned ^ ^ ^-0.015625 if predicate marker_motion:block_check/condition run function marker_motion:tp/point +execute if data storage neac: _.tp[5][{success:2b}] positioned ^ ^ ^0.015625 if predicate marker_motion:block_check/condition run function marker_motion:tp/point +execute if data storage neac: _.tp[5][{success:2b}] rotated ~180 ~ positioned ^ ^ ^0.015625 if predicate marker_motion:block_check/condition rotated as @s run function marker_motion:tp/point +execute if data storage neac: _.tp[5][{success:2b}] rotated ~180 ~ positioned ^ ^ ^-0.015625 if predicate marker_motion:block_check/condition rotated as @s run function marker_motion:tp/point +execute if data storage neac: _.tp[5][{success:2b}] rotated as @s positioned ^ ^ ^-0.015625 if predicate marker_motion:block_check/condition rotated as @s run function marker_motion:tp/point +execute if data storage neac: _.tp[5][{success:2b}] rotated as @s positioned ^ ^ ^0.015625 if predicate marker_motion:block_check/condition rotated as @s run function marker_motion:tp/point +execute if data storage neac: _.tp[5][{success:2b}] rotated as @s rotated ~180 ~ positioned ^ ^ ^0.015625 if predicate marker_motion:block_check/condition rotated as @s run function marker_motion:tp/point +execute if data storage neac: _.tp[5][{success:2b}] rotated as @s rotated ~180 ~ positioned ^ ^ ^-0.015625 if predicate marker_motion:block_check/condition rotated as @s run function marker_motion:tp/point # 探査の停止 -execute if data storage neac: _.tpCheck[{success:1b}] store result storage neac: _.tp[][].success byte 1 run scoreboard players set #MarkerMotion.loop neac_value 0 +execute if data storage neac: _.tp[5][{success:1b}] store result storage neac: _.tp[][].success byte 1 run scoreboard players set #MarkerMotion.loop neac_value 0 diff --git a/MarkerMotion/data/marker_motion/functions/tp/block.mcfunction b/MarkerMotion/data/marker_motion/functions/tp/block.mcfunction index 492ed20..9a54724 100644 --- a/MarkerMotion/data/marker_motion/functions/tp/block.mcfunction +++ b/MarkerMotion/data/marker_motion/functions/tp/block.mcfunction @@ -6,11 +6,11 @@ # function marker_motion:tp/point # これが呼び出される時は接触したことになるので位置移動と接触チェックを起動する - data modify storage neac: _.tp[6][].success set value 1b + data modify storage neac: _.tp[5][].success set value 1b # ブロックに埋まってたら位置を修復しようとする scoreboard players set #MarkerMotion.PosRepair neac_value 10 - execute align xyz unless predicate marker_motion:block_check/shape positioned as @s run function marker_motion:tp/pos_repair + execute as @e[type=marker,tag=MarkerMotion.me,limit=1] align xyz unless predicate marker_motion:block_check/shape positioned as @s run function marker_motion:tp/pos_repair scoreboard players reset #MarkerMotion.PosRepair ## ブロック接触チェック @@ -18,14 +18,14 @@ data modify storage neac: _.block set value {ok:0b,down:[{success:0b},{success:0b},{success:0b},{success:0b},{success:0b}],up:[{success:0b},{success:0b},{success:0b},{success:0b},{success:0b}],south:[{success:0b},{success:0b},{success:0b},{success:0b},{success:0b}],north:[{success:0b},{success:0b},{success:0b},{success:0b},{success:0b}],east:[{success:0b},{success:0b},{success:0b},{success:0b},{success:0b}],west:[{success:0b},{success:0b},{success:0b},{success:0b},{success:0b}]} # 8点をチェックしてストレージにデータを入れる - execute positioned as @s as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] positioned ~-0.0078125 ~-0.0078125 ~-0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.down[4].success byte 1 store success storage neac: _.block.north[2].success byte 1 store success storage neac: _.block.west[2].success byte 1 run function marker_motion:tp/check - execute positioned as @s as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] positioned ~-0.0078125 ~-0.0078125 ~0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.down[3].success byte 1 store success storage neac: _.block.south[2].success byte 1 store success storage neac: _.block.west[1].success byte 1 run function marker_motion:tp/check - execute positioned as @s as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] positioned ~0.0078125 ~-0.0078125 ~-0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.down[2].success byte 1 store success storage neac: _.block.north[1].success byte 1 store success storage neac: _.block.east[2].success byte 1 run function marker_motion:tp/check - execute positioned as @s as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] positioned ~0.0078125 ~-0.0078125 ~0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.down[1].success byte 1 store success storage neac: _.block.south[1].success byte 1 store success storage neac: _.block.east[1].success byte 1 run function marker_motion:tp/check - execute positioned as @s as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] positioned ~-0.0078125 ~0.0078125 ~-0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.up[4].success byte 1 store success storage neac: _.block.north[4].success byte 1 store success storage neac: _.block.west[4].success byte 1 run function marker_motion:tp/check - execute positioned as @s as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] positioned ~-0.0078125 ~0.0078125 ~0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.up[3].success byte 1 store success storage neac: _.block.south[4].success byte 1 store success storage neac: _.block.west[3].success byte 1 run function marker_motion:tp/check - execute positioned as @s as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] positioned ~0.0078125 ~0.0078125 ~-0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.up[2].success byte 1 store success storage neac: _.block.north[3].success byte 1 store success storage neac: _.block.east[4].success byte 1 run function marker_motion:tp/check - execute positioned as @s as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] positioned ~0.0078125 ~0.0078125 ~0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.up[1].success byte 1 store success storage neac: _.block.south[3].success byte 1 store success storage neac: _.block.east[3].success byte 1 run function marker_motion:tp/check + execute positioned as @e[type=marker,tag=MarkerMotion.me,limit=1] positioned ~-0.0078125 ~-0.0078125 ~-0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.down[4].success byte 1 store success storage neac: _.block.north[2].success byte 1 store success storage neac: _.block.west[2].success byte 1 run function marker_motion:tp/check + execute positioned as @e[type=marker,tag=MarkerMotion.me,limit=1] positioned ~-0.0078125 ~-0.0078125 ~0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.down[3].success byte 1 store success storage neac: _.block.south[2].success byte 1 store success storage neac: _.block.west[1].success byte 1 run function marker_motion:tp/check + execute positioned as @e[type=marker,tag=MarkerMotion.me,limit=1] positioned ~0.0078125 ~-0.0078125 ~-0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.down[2].success byte 1 store success storage neac: _.block.north[1].success byte 1 store success storage neac: _.block.east[2].success byte 1 run function marker_motion:tp/check + execute positioned as @e[type=marker,tag=MarkerMotion.me,limit=1] positioned ~0.0078125 ~-0.0078125 ~0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.down[1].success byte 1 store success storage neac: _.block.south[1].success byte 1 store success storage neac: _.block.east[1].success byte 1 run function marker_motion:tp/check + execute positioned as @e[type=marker,tag=MarkerMotion.me,limit=1] positioned ~-0.0078125 ~0.0078125 ~-0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.up[4].success byte 1 store success storage neac: _.block.north[4].success byte 1 store success storage neac: _.block.west[4].success byte 1 run function marker_motion:tp/check + execute positioned as @e[type=marker,tag=MarkerMotion.me,limit=1] positioned ~-0.0078125 ~0.0078125 ~0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.up[3].success byte 1 store success storage neac: _.block.south[4].success byte 1 store success storage neac: _.block.west[3].success byte 1 run function marker_motion:tp/check + execute positioned as @e[type=marker,tag=MarkerMotion.me,limit=1] positioned ~0.0078125 ~0.0078125 ~-0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.up[2].success byte 1 store success storage neac: _.block.north[3].success byte 1 store success storage neac: _.block.east[4].success byte 1 run function marker_motion:tp/check + execute positioned as @e[type=marker,tag=MarkerMotion.me,limit=1] positioned ~0.0078125 ~0.0078125 ~0.0078125 if predicate marker_motion:block_check/condition store success storage neac: _.block.up[1].success byte 1 store success storage neac: _.block.south[3].success byte 1 store success storage neac: _.block.east[3].success byte 1 run function marker_motion:tp/check # 接触判定が行われた最大値を取得 scoreboard players set #MarkerMotion.BlockCheck neac_value 0 @@ -84,25 +84,24 @@ # 接触したブロックが1tickの間前回と同じのにならないようにする data modify storage neac: _.MarkerMotion.BounceDirection set from storage neac: _.block.ok - # 向きを変更 - tp @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] ~ ~ ~ ~ ~ + # ここが動いたら以降の処理(タグつけたりが動かなくなる仕様) execute store result score #MarkerMotion.Bounce.Count neac_value run data get storage neac: _.MarkerMotion.bounce.count 1 execute if score #MarkerMotion.Bounce.Count neac_value matches -2..-1 run scoreboard players set #MarkerMotion.Bounce.Count neac_value 1 - execute if score #MarkerMotion.BlockCheck neac_value matches 1.. if score #MarkerMotion.Bounce.Count neac_value matches 1.. run function marker_motion:bounce/ + execute if score #MarkerMotion.BlockCheck neac_value matches 1.. if score #MarkerMotion.Bounce.Count neac_value matches 1.. as @e[type=marker,tag=MarkerMotion.me,limit=1] run function marker_motion:bounce/ # bounce処理を通ってなかったらon_blockタグ付与 - execute if score #MarkerMotion.BlockCheck neac_value matches 1.. run tag @s add MarkerMotion.on_block - execute if score #MarkerMotion.BlockCheck neac_value matches 1.. if score #MarkerMotion.BlockCheck neac_value matches 3..4 run tag @s add MarkerMotion.on_block.y - execute if score #MarkerMotion.BlockCheck neac_value matches 1.. unless score #MarkerMotion.BlockCheck neac_value matches 3..4 run tag @s add MarkerMotion.on_block.wall + execute if score #MarkerMotion.BlockCheck neac_value matches 1.. run tag @e[type=marker,tag=MarkerMotion.me,limit=1] add MarkerMotion.on_block + execute if score #MarkerMotion.BlockCheck neac_value matches 1.. if score #MarkerMotion.BlockCheck neac_value matches 3..4 run tag @e[type=marker,tag=MarkerMotion.me,limit=1] add MarkerMotion.on_block.y + execute if score #MarkerMotion.BlockCheck neac_value matches 1.. unless score #MarkerMotion.BlockCheck neac_value matches 3..4 run tag @e[type=marker,tag=MarkerMotion.me,limit=1] add MarkerMotion.on_block.wall # 接触方向に対して固定位置に移動 - execute if score #MarkerMotion.BlockCheck neac_value matches 1 run tag @s add MarkerMotion.on_block.east - execute if score #MarkerMotion.BlockCheck neac_value matches 2 run tag @s add MarkerMotion.on_block.west - execute if score #MarkerMotion.BlockCheck neac_value matches 3 run tag @s add MarkerMotion.on_block.up - execute if score #MarkerMotion.BlockCheck neac_value matches 4 run tag @s add MarkerMotion.on_block.down - execute if score #MarkerMotion.BlockCheck neac_value matches 5 run tag @s add MarkerMotion.on_block.south - execute if score #MarkerMotion.BlockCheck neac_value matches 6 run tag @s add MarkerMotion.on_block.north + execute if score #MarkerMotion.BlockCheck neac_value matches 1 run tag @e[type=marker,tag=MarkerMotion.me,limit=1] add MarkerMotion.on_block.east + execute if score #MarkerMotion.BlockCheck neac_value matches 2 run tag @e[type=marker,tag=MarkerMotion.me,limit=1] add MarkerMotion.on_block.west + execute if score #MarkerMotion.BlockCheck neac_value matches 3 run tag @e[type=marker,tag=MarkerMotion.me,limit=1] add MarkerMotion.on_block.up + execute if score #MarkerMotion.BlockCheck neac_value matches 4 run tag @e[type=marker,tag=MarkerMotion.me,limit=1] add MarkerMotion.on_block.down + execute if score #MarkerMotion.BlockCheck neac_value matches 5 run tag @e[type=marker,tag=MarkerMotion.me,limit=1] add MarkerMotion.on_block.south + execute if score #MarkerMotion.BlockCheck neac_value matches 6 run tag @e[type=marker,tag=MarkerMotion.me,limit=1] add MarkerMotion.on_block.north # スコアリセット diff --git a/MarkerMotion/data/marker_motion/functions/tp/check.mcfunction b/MarkerMotion/data/marker_motion/functions/tp/check.mcfunction index 996771c..78b48ce 100644 --- a/MarkerMotion/data/marker_motion/functions/tp/check.mcfunction +++ b/MarkerMotion/data/marker_motion/functions/tp/check.mcfunction @@ -11,4 +11,4 @@ tp @s ~ ~ ~ # TP位置がブロックのどの部分にあたるか見る # 空気判定になる場所でtrueを返すのでunless - execute align xyz unless predicate marker_motion:block_check/shape + execute align xyz unless predicate marker_motion:block_check/shape diff --git a/MarkerMotion/data/marker_motion/functions/tp/point.mcfunction b/MarkerMotion/data/marker_motion/functions/tp/point.mcfunction index 6c23d71..1474d9f 100644 --- a/MarkerMotion/data/marker_motion/functions/tp/point.mcfunction +++ b/MarkerMotion/data/marker_motion/functions/tp/point.mcfunction @@ -10,10 +10,10 @@ # ブロックチェック # TP - tp @s ~ ~ ~ + tp @e[type=marker,tag=MarkerMotion.me,limit=1] ~ ~ ~ # TP位置がブロックのどの部分にあたるか見る # 空気判定になる場所でtrueを返すのでunless - execute align xyz store success storage neac: _.success byte 1 unless predicate marker_motion:block_check/shape + execute as @e[type=marker,tag=MarkerMotion.me,limit=1] align xyz store success storage neac: _.success byte 1 unless predicate marker_motion:block_check/shape # ブロック接触チェック等 - execute if data storage neac: _{success:1b} unless data storage neac: _.MarkerMotion.stopwith{block:0b} positioned as @s run function marker_motion:tp/block + execute if data storage neac: _{success:1b} unless data storage neac: _.MarkerMotion.stopwith{block:0b} positioned as @e[type=marker,tag=MarkerMotion.me,limit=1] run function marker_motion:tp/block diff --git a/MarkerMotion/data/marker_motion/functions/tp/targets.mcfunction b/MarkerMotion/data/marker_motion/functions/tp/targets.mcfunction index ef32648..7c1331f 100644 --- a/MarkerMotion/data/marker_motion/functions/tp/targets.mcfunction +++ b/MarkerMotion/data/marker_motion/functions/tp/targets.mcfunction @@ -6,13 +6,7 @@ # function marker_motion:tp/0016 -# hitタグ付与 -tag @e[tag=targets] add MarkerMotion.hit -# タグ削除 -tag @e[tag=targets] remove targets - # hit時停止がOFFでなければその場で停止する処理を起動 -execute unless data storage neac: _.MarkerMotion.stopwith{hit:0b} if entity @e[tag=MarkerMotion.hit,limit=1] run tag @s add MarkerMotion.stopwith.hit -execute unless data storage neac: _.MarkerMotion.stopwith{hit:0b} if entity @e[tag=MarkerMotion.hit,limit=1] run tp @s ~ ~ ~ -execute unless data storage neac: _.MarkerMotion.stopwith{hit:0b} if entity @e[tag=MarkerMotion.hit,limit=1] run data modify storage neac: _.tp[5][].success set value 1b -execute unless data storage neac: _.MarkerMotion.stopwith{hit:0b} if entity @e[tag=MarkerMotion.hit,limit=1] run data modify storage neac: _.tp[6][].success set value 1b +tag @e[type=marker,tag=MarkerMotion.me,limit=1] add MarkerMotion.stopwith.hit +tp @e[type=marker,tag=MarkerMotion.me,limit=1] ~ ~ ~ +data modify storage neac: _.tp[5][].success set value 1b diff --git a/MarkerMotion/data/marker_motion/tags/entity_types/selector.json b/MarkerMotion/data/marker_motion/tags/entity_types/selector.json deleted file mode 100644 index 274f193..0000000 --- a/MarkerMotion/data/marker_motion/tags/entity_types/selector.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "replace": false, - "values": [ - "marker" - ] -} \ No newline at end of file diff --git a/MarkerMotion/pack.mcmeta b/MarkerMotion/pack.mcmeta index 2a4ca17..a3a84b8 100644 --- a/MarkerMotion/pack.mcmeta +++ b/MarkerMotion/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "pack_format": 12, - "description": "MarkerMotion v3.2" + "description": "MarkerMotion v3.3" } } \ No newline at end of file diff --git a/MarkerMotionExample/data/marker_motion_example/functions/normal_speedup.mcfunction b/MarkerMotionExample/data/marker_motion_example/functions/normal_speedup.mcfunction index 6503acf..1cc02ef 100644 --- a/MarkerMotionExample/data/marker_motion_example/functions/normal_speedup.mcfunction +++ b/MarkerMotionExample/data/marker_motion_example/functions/normal_speedup.mcfunction @@ -1,5 +1,5 @@ #example/tick/1 -summon marker ~ ~ ~ {Tags:["MarkerMotionExample.Type1","MarkerMotionExample.SPEEDUP","this"],data:{MarkerMotion:{speed:{amount:0.10,loss:{amount:1.1,type:"*"}}}}} +summon marker ~ ~ ~ {Tags:["MarkerMotionExample.Type1","this"],data:{MarkerMotion:{speed:{amount:0.10,loss:{amount:1.1,type:"*"}}}}} execute anchored eyes positioned ^ ^ ^0.3 positioned ~ ~ ~ run tp @e[type=marker,tag=this] ~ ~ ~ ~ ~ diff --git a/MarkerMotionExample/data/marker_motion_example/functions/particle/get_vector.mcfunction b/MarkerMotionExample/data/marker_motion_example/functions/particle/get_vector.mcfunction deleted file mode 100644 index 6e4f6b2..0000000 --- a/MarkerMotionExample/data/marker_motion_example/functions/particle/get_vector.mcfunction +++ /dev/null @@ -1,10 +0,0 @@ -# 移動距離と移動角度取得 - data modify entity @s Rotation set from storage marker_motion_example: Move.Rotation - execute store result score #MarkerMotionParticleMA neac_value run data get storage marker_motion_example: Move.Amount 10 - -# 変更した移動距離とスコアに出した移動角度でパーティクルを出す - execute rotated as @s facing ^ ^ ^-1 run function marker_motion_example:particle/render - -# 後処理 - kill @s - scoreboard players reset #MarkerMotionParticleMA diff --git a/MarkerMotionExample/data/marker_motion_example/functions/particle/loop.mcfunction b/MarkerMotionExample/data/marker_motion_example/functions/particle/loop.mcfunction new file mode 100644 index 0000000..096ebbf --- /dev/null +++ b/MarkerMotionExample/data/marker_motion_example/functions/particle/loop.mcfunction @@ -0,0 +1,8 @@ + + + +execute if entity @s[distance=..0.1] positioned as @s run function marker_motion_example:particle/render +execute unless entity @s[distance=..0.1] run function marker_motion_example:particle/render + + +execute unless entity @s[distance=..0.1] positioned ^ ^ ^0.1 run function marker_motion_example:particle/loop \ No newline at end of file diff --git a/MarkerMotionExample/data/marker_motion_example/functions/particle/main.mcfunction b/MarkerMotionExample/data/marker_motion_example/functions/particle/main.mcfunction index 9d1316d..f136020 100644 --- a/MarkerMotionExample/data/marker_motion_example/functions/particle/main.mcfunction +++ b/MarkerMotionExample/data/marker_motion_example/functions/particle/main.mcfunction @@ -1,5 +1,3 @@ -#data.MarkerMotion.Moveのデータからパーティクルを発生させる - data modify storage marker_motion_example: Move set from entity @s data.MarkerMotion.Move - execute summon marker run function marker_motion_example:particle/get_vector - data remove storage marker_motion_example: Move +# 移動前座標から移動後座標までをパーティクルで繋ぐ + execute facing entity @s feet run function marker_motion_example:particle/loop \ No newline at end of file diff --git a/MarkerMotionExample/data/marker_motion_example/functions/particle/render.mcfunction b/MarkerMotionExample/data/marker_motion_example/functions/particle/render.mcfunction index eb9e06a..44933be 100644 --- a/MarkerMotionExample/data/marker_motion_example/functions/particle/render.mcfunction +++ b/MarkerMotionExample/data/marker_motion_example/functions/particle/render.mcfunction @@ -1,3 +1 @@ -scoreboard players remove #MarkerMotionParticleMA neac_value 1 -particle electric_spark ^ ^ ^ 0 0 0 0 1 force @a -execute if score #MarkerMotionParticleMA neac_value matches 0.. positioned ^ ^ ^0.1 run function marker_motion_example:particle/render \ No newline at end of file +particle electric_spark ~ ~ ~ 0 0 0 0 1 force @a \ No newline at end of file diff --git a/MarkerMotionExample/data/marker_motion_example/functions/tick/1.mcfunction b/MarkerMotionExample/data/marker_motion_example/functions/tick/1.mcfunction index 5bde023..d8bf2a4 100644 --- a/MarkerMotionExample/data/marker_motion_example/functions/tick/1.mcfunction +++ b/MarkerMotionExample/data/marker_motion_example/functions/tick/1.mcfunction @@ -2,11 +2,10 @@ function #marker_motion: #パーティクル出す -execute at @s run function marker_motion_example:particle/main +function marker_motion_example:particle/main scoreboard players add @s neac_value 1 -execute if entity @s[tag=MarkerMotionExample.SPEEDUP,scores={neac_value=60..}] run tag @s add MarkerMotion.Example.end execute if entity @s[scores={neac_value=100..}] run tag @s add MarkerMotion.Example.end execute if entity @s[tag=MarkerMotion.stop] run tag @s add MarkerMotion.Example.end diff --git a/MarkerMotionExample/data/marker_motion_example/functions/tick/2.mcfunction b/MarkerMotionExample/data/marker_motion_example/functions/tick/2.mcfunction index 073b842..215bd31 100644 --- a/MarkerMotionExample/data/marker_motion_example/functions/tick/2.mcfunction +++ b/MarkerMotionExample/data/marker_motion_example/functions/tick/2.mcfunction @@ -6,7 +6,7 @@ function #marker_motion: execute as @e[type=#marker_motion_example:test_entitys,tag=MarkerMotion.target] run tag @s remove MarkerMotion.target #パーティクル出す -execute at @s run function marker_motion_example:particle/main +function marker_motion_example:particle/main execute if entity @e[tag=MarkerMotion.hit,limit=1] as @e[tag=MarkerMotion.hit] run damage @s 0.000000000000000000000000000000000000000000001 out_of_world execute if entity @e[tag=MarkerMotion.hit,limit=1] as @e[tag=MarkerMotion.hit] run tag @s remove MarkerMotion.hit diff --git a/MarkerMotionExample/data/marker_motion_example/functions/tick/3.mcfunction b/MarkerMotionExample/data/marker_motion_example/functions/tick/3.mcfunction index 954a167..24feb92 100644 --- a/MarkerMotionExample/data/marker_motion_example/functions/tick/3.mcfunction +++ b/MarkerMotionExample/data/marker_motion_example/functions/tick/3.mcfunction @@ -3,9 +3,8 @@ execute as @e[type=#marker_motion_example:test_entitys,distance=..5] run tag @s function #marker_motion: #パーティクル出す -execute at @s run function marker_motion_example:particle/main +function marker_motion_example:particle/main -#execute if entity @s[tag=MarkerMotion.on_block,tag=!MarkerMotion.on_block.wall] run data modify entity @s data.MarkerMotion.bounce.count set value 1 execute if entity @s[tag=MarkerMotion.on_block,tag=!MarkerMotion.on_block.wall] run function #marker_motion:tag_remove execute as @e[type=#marker_motion_example:test_entitys,tag=MarkerMotion.target] run tag @s remove MarkerMotion.target diff --git a/MarkerMotionExample/pack.mcmeta b/MarkerMotionExample/pack.mcmeta index a22b160..66e0c2e 100644 --- a/MarkerMotionExample/pack.mcmeta +++ b/MarkerMotionExample/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "pack_format": 12, - "description": "MarkerMotion v3.2用 Example" + "description": "MarkerMotion v3.3用 Example" } } \ No newline at end of file diff --git a/README.md b/README.md index 48c1891..07a3b3c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Markerを移動速度や重力、バウンド回数などを指定して動か ## 最新 -v3.2 +v3.3 ## 動作要件 @@ -74,23 +74,11 @@ summon marker ~ ~ ~ {Tags:["A"],data:{MarkerMotion:{speed:{amount:1.50,loss:{amo MarkerMotion.on_block, MarkerMotion.speed.0, MarkerMotion.stopwith.hitのタグがあれば必ず付与されています。 ``` -### markerのNBTに追加返却されるもの -* data.MarkerMotion.Move -``` -移動距離と移動角度。 -この値を使って綺麗な繋がったパーティクル出したりとかが可能。exampleを参照。 -``` -* data.MarkerMotion.GravitySum -``` -重力の合計。 -1秒毎にリセットとかで変な挙動できるかもしれない。 -``` - ### ダメージを与える飛び道具として扱う際の当たり判定に関して このライブラリを呼ぶ前に判定に入れたいエンティティに対し`MarkerMotion.target`タグを付与します。 -distanceとかで範囲指定してあげると軽量化になると思います。 +distanceとかで範囲指定してあげた方が軽量になると思います。 当たり判定はヒットボックスサイズで検知され、`MarkerMotion.hit`タグを返します。 @@ -120,6 +108,11 @@ MarkerMotion本体と一緒に導入することで実際に動かして確認 ## 更新履歴 +* v3.3 + * コマンド数減少及び最適化 + * Moveを削除 + * exampleのパーティクル表示方法を変更 + * v3.2 * bounce.gがオンの時の挙動が正常でない問題の修正、及びbounce.gがオンの時の挙動修正 * `#marker_motion_example:bounce/gravity`を追加