Skip to content

Commit

Permalink
fix unloaded entity problem
Browse files Browse the repository at this point in the history
  • Loading branch information
uran247 committed Jun 9, 2021
1 parent 520a161 commit ba5450b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion data/minecraft/tags/functions/tick.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"values": ["plane:tick","weapon:tick","math:tick"]
"values": ["util:tick","plane:tick","weapon:tick","math:tick"]
}
20 changes: 20 additions & 0 deletions data/util/functions/fix-missing-entity.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
execute unless entity 0-0-0-0-1 run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"1"],UUID:[I;0,0,0,1],Invulnerable:1b}
execute unless entity 0-0-0-0-2 run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"2"],UUID:[I;0,0,0,2],Invulnerable:1b}
execute unless entity 0-0-0-0-3 run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block,axis,block-detector,"3"],UUID:[I;0,0,0,3],Invulnerable:1b}
execute unless entity 0-0-0-0-4 run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block,axis,block-detector,"4"],UUID:[I;0,0,0,4],Invulnerable:1b}
execute unless entity 0-0-0-0-5 run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"5"],UUID:[I;0,0,0,5],Invulnerable:1b}
execute unless entity 0-0-0-0-6 run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"6"],UUID:[I;0,0,0,6],Invulnerable:1b}
execute unless entity 0-0-0-0-7 run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"7"],UUID:[I;0,0,0,7],Invulnerable:1b}
execute unless entity 0-0-0-0-8 run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"8"],UUID:[I;0,0,0,8],Invulnerable:1b}
execute unless entity 0-0-0-0-9 run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"9"],UUID:[I;0,0,0,9],Invulnerable:1b}
execute unless entity 0-0-0-0-a run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"10"],UUID:[I;0,0,0,10],Invulnerable:1b}
execute unless entity 0-0-0-0-b run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"11"],UUID:[I;0,0,0,11],Invulnerable:1b}
execute unless entity 0-0-0-0-c run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"12"],UUID:[I;0,0,0,12],Invulnerable:1b}
execute unless entity 0-0-0-0-d run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"13"],UUID:[I;0,0,0,13],Invulnerable:1b}
execute unless entity 0-0-0-0-e run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"14"],UUID:[I;0,0,0,14],Invulnerable:1b}
execute unless entity 0-0-0-0-f run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"15"],UUID:[I;0,0,0,15],Invulnerable:1b}
execute unless entity 0-0-0-0-10 run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"16"],UUID:[I;0,0,0,16],Invulnerable:1b}
execute unless entity 0-0-0-0-11 run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"17"],UUID:[I;0,0,0,17],Invulnerable:1b}
execute unless entity 0-0-0-0-12 run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"18"],UUID:[I;0,0,0,18],Invulnerable:1b}
execute unless entity 0-0-0-0-13 run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"19"],UUID:[I;0,0,0,19],Invulnerable:1b}
execute unless entity 0-0-0-0-14 run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block-detector,"20"],UUID:[I;0,0,0,20],Invulnerable:1b}
1 change: 1 addition & 0 deletions data/util/functions/tick.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
function util:fix-missing-entity
5 changes: 2 additions & 3 deletions data/weapon/functions/gun/gun-manager.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ scoreboard players set #hit-flag vp.reg1 0

#### 移動&ヒット判定 ####
#ベクトル方向へエンティティの向きを向ける
execute unless entity 0-0-0-0-4 run summon minecraft:armor_stand 0 1 0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block,axis,block-detector,"4"],UUID:[I;0,0,0,4],Invulnerable:1b}
tp 0-0-0-0-4 ~ ~ ~ ~ ~
execute unless entity 0-0-0-0-4 run summon minecraft:armor_stand 0.0 1.0 0.0 {NoGravity:1b,Marker:1b,Invisible:1b,Tags:[entity-nohit,block,axis,block-detector,"4"],UUID:[I;0,0,0,4],Invulnerable:1b}
execute unless entity 0-0-0-0-4 run kill @s
data modify storage minecraft:plane-datapack temporary.Pos set from entity @s Pos
execute store result score #pos-x vp.reg1 run data get storage minecraft:plane-datapack temporary.Pos[0] 100
execute store result score #pos-y vp.reg1 run data get storage minecraft:plane-datapack temporary.Pos[1] 100
Expand All @@ -49,7 +49,6 @@ data modify entity 0-0-0-0-4 Pos set from storage minecraft:plane-datapack tempo
tp @s ~ ~ ~ facing entity 0-0-0-0-4

#tellraw @p [{"score" : {"name":"@s", "objective":"speedX"}}, {"text":" "}, {"score" : {"name":"@s", "objective":"speedY"}}, {"text":" "}, {"score" : {"name":"@s", "objective":"speedZ"}}]
#tellraw @p [{"nbt":"Pos","entity":"@s"},{"nbt":"Pos","entity":"0-0-0-0-4"}]

#移動予定先までの間にブロックがあるか判定
execute at 0-0-0-0-4 run function weapon:util/check-block
Expand Down
3 changes: 0 additions & 3 deletions data/weapon/functions/util/check-block.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ tp 0-0-0-0-9 0 1 0
execute facing entity @s eyes positioned as 0-0-0-0-7 in overworld run tp 0-0-0-0-7 ~ ~ ~ ~ ~
execute as 0-0-0-0-7 at @s facing ^ ^ ^-1 in overworld run tp 0-0-0-0-8 ~ ~0.01 ~ ~ ~

#execute if entity @s[predicate=plane:in-overworld] if entity @s[distance=0..] in overworld rotated as 0-0-0-0-7 positioned ^ ^ ^25.6 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^12.8 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^12.8 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^06.4 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^06.4 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^03.2 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^03.2 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^01.6 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^01.6 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^00.8 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.8 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^00.4 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.4 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^00.2 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.2 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^00.1 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.1 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^00.05 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.05 rotated as 0-0-0-0-7 positioned ^ ^ ^-25.6 in overworld unless block ~ ~ ~ minecraft:air run tp 0-0-0-0-9 ~ ~ ~
#execute if entity @s[predicate=plane:in-nether] if entity @s[distance=0..] in overworld rotated as 0-0-0-0-7 positioned ^ ^ ^25.6 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^12.8 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^12.8 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^06.4 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^06.4 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^03.2 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^03.2 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^01.6 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^01.6 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^00.8 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.8 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^00.4 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.4 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^00.2 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.2 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^00.1 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.1 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^00.05 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.05 rotated as 0-0-0-0-7 positioned ^ ^ ^-25.6 in the_nether unless block ~ ~ ~ minecraft:air run tp 0-0-0-0-9 ~ ~ ~
#execute if entity @s[predicate=plane:in-end] if entity @s[distance=0..] in overworld rotated as 0-0-0-0-7 positioned ^ ^ ^25.6 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^12.8 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^12.8 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^06.4 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^06.4 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^03.2 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^03.2 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^01.6 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^01.6 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^00.8 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.8 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^00.4 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.4 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^00.2 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.2 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^00.1 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.1 rotated as @e[x=0.5,y=2.0,z=0.5,distance=..0.1,sort=furthest,limit=2] positioned ^ ^ ^00.05 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.05 rotated as 0-0-0-0-7 positioned ^ ^ ^-25.6 in the_end unless block ~ ~ ~ minecraft:air run tp 0-0-0-0-9 ~ ~ ~
execute if entity @s[distance=0..] rotated as 0-0-0-0-7 positioned ^ ^ ^25.6 rotated as @e[distance=..0.1,x=0.5,y=2.0,z=0.5,sort=furthest,limit=2] positioned ^ ^ ^12.8 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^12.8 rotated as @e[distance=..0.1,x=0.5,y=2.0,z=0.5,sort=furthest,limit=2] positioned ^ ^ ^06.4 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^06.4 rotated as @e[distance=..0.1,x=0.5,y=2.0,z=0.5,sort=furthest,limit=2] positioned ^ ^ ^03.2 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^03.2 rotated as @e[distance=..0.1,x=0.5,y=2.0,z=0.5,sort=furthest,limit=2] positioned ^ ^ ^01.6 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^01.6 rotated as @e[distance=..0.1,x=0.5,y=2.0,z=0.5,sort=furthest,limit=2] positioned ^ ^ ^00.8 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.8 rotated as @e[distance=..0.1,x=0.5,y=2.0,z=0.5,sort=furthest,limit=2] positioned ^ ^ ^00.4 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.4 rotated as @e[distance=..0.1,x=0.5,y=2.0,z=0.5,sort=furthest,limit=2] positioned ^ ^ ^00.2 if entity @s[distance=..25.6] rotated as 0-0-0-0-7 positioned ^ ^ ^00.2 rotated as 0-0-0-0-7 positioned ^ ^ ^-25.6 unless block ~ ~ ~ minecraft:air run tp 0-0-0-0-9 ~ ~ ~
data modify storage minecraft:plane-datapack temporary.Pos set from entity 0-0-0-0-9 Pos
execute store result score #x vp.return run data get storage minecraft:plane-datapack temporary.Pos[0] 100
Expand Down

0 comments on commit ba5450b

Please sign in to comment.