-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: kill drawer entities if there is no players nearby
- Loading branch information
Showing
25 changed files
with
83 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 47 additions & 2 deletions
49
data/simpledrawer/functions/impl/new_drawer/20tick.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,49 @@ | ||
|
||
execute if entity @s[tag=simpledrawer.new_drawer.to_update] if entity @a[distance=..15] run function simpledrawer:impl/new_drawer/base_display_rup | ||
scoreboard players set #good_version simpledrawer.math 0 | ||
execute if entity @s[predicate=simpledrawer:impl/test_version] run scoreboard players set #good_version simpledrawer.math 1 | ||
|
||
execute if entity @s[predicate=!simpledrawer:impl/test_version] run function simpledrawer:impl/new_drawer/test_version | ||
execute | ||
if score #good_version simpledrawer.math matches 0 | ||
run function simpledrawer:impl/new_drawer/test_version | ||
|
||
|
||
execute | ||
if score #good_version simpledrawer.math matches 1 | ||
run function ./check_player_nearby: | ||
scoreboard players set #player_nearby simpledrawer.math 0 | ||
execute if entity @a[distance=..16] run scoreboard players set #player_nearby simpledrawer.math 1 | ||
|
||
execute | ||
if score #player_nearby simpledrawer.math matches 0 | ||
if score @s simpledrawer.new_drawer.as_players_entities matches 1 | ||
run function ./kill_player_entities: | ||
scoreboard players operation #search_id simpledrawer.math = @s simpledrawer.new_drawer.id | ||
kill @e[ | ||
tag=!simpledrawer.new_drawer.base, | ||
tag=!simpledrawer.new_drawer.part.base_block, | ||
tag=simpledrawer.new_drawer.part, | ||
predicate=simpledrawer:impl/search_id_new_drawer | ||
] | ||
scoreboard players set @s simpledrawer.new_drawer.as_players_entities 0 | ||
|
||
|
||
execute | ||
if score #player_nearby simpledrawer.math matches 1 | ||
if score @s simpledrawer.new_drawer.as_players_entities matches 0 | ||
run function ./resummon_player_entities: | ||
data remove storage simpledrawer:main temp | ||
data modify storage simpledrawer:main temp.simpledrawer set from storage simpledrawer:main ItemsNBT.new_drawer.tag.BlockEntityTag.Items[0].tag.simpledrawer | ||
data modify storage simpledrawer:main temp.simpledrawer set from entity @s item.tag.simpledrawer | ||
scoreboard players operation #place_id simpledrawer.math = @s simpledrawer.new_drawer.id | ||
function simpledrawer:impl/new_drawer/place/variant | ||
scoreboard players set @s simpledrawer.new_drawer.as_players_entities 1 | ||
function simpledrawer:impl/new_drawer/base_display_rup | ||
|
||
|
||
|
||
execute | ||
if score #player_nearby simpledrawer.math matches 1 | ||
if score @s simpledrawer.new_drawer.as_players_entities matches 1 | ||
if entity @s[tag=simpledrawer.new_drawer.to_update] run function simpledrawer:impl/new_drawer/base_display_rup | ||
|
||
execute if entity @s[predicate=!simpledrawer:impl/test_version] run function simpledrawer:impl/new_drawer/test_version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters