-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
randomly spawn item ball every minute
- Loading branch information
Dan
committed
May 23, 2023
1 parent
ff1c699
commit d344c16
Showing
5 changed files
with
38 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# runs every 1200 ticks (1 minute) | ||
|
||
# select random player to attempt item ball spawn | ||
function itemballs:spawn/select_player | ||
tag @a remove itemballs.attempted_spawn | ||
|
||
# loop | ||
schedule function itemballs:loop/every_1200_ticks 1200t |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# attempts to spawn an item ball (executes globally) | ||
|
||
# randomly select a player | ||
execute as @r[tag=!itemballs.attempted_spawn] at @s run function itemballs:spawn/spawn_check |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# attempts to spawn an item ball (executes as randomly selected player) | ||
|
||
# get item ball count | ||
execute store result score #itemballs.item_ball_count itemballs.temp run execute if entity @e[type=minecraft:armor_stand,tag=itemballs.marker,distance=..200] | ||
|
||
# fail, find another player | ||
execute if score #itemballs.item_ball_count itemballs.temp matches 3.. run tag @s add itemballs.attempted_spawn | ||
execute if entity @s[tag=itemballs.attempted_spawn] run function itemballs:spawn/select_player | ||
|
||
# success | ||
execute unless entity @s[tag=itemballs.attempted_spawn] run function itemballs:spawn/spawn_item_ball |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# spawns item ball (executes as viable player) | ||
|
||
# spawn location marker | ||
summon minecraft:marker ~ ~ ~ {Tags:["global.ignore","itemballs.spawn_location"]} | ||
|
||
# randomly spread | ||
spreadplayers ~ ~ 50 150 false @e[type=minecraft:marker,tag=itemballs.spawn_location,limit=1,sort=nearest] | ||
|
||
# spawn item ball at random location | ||
execute at @e[type=minecraft:marker,tag=itemballs.spawn_location,limit=1,sort=nearest] run function itemballs:summon/item_ball | ||
|
||
# remove spawn location marker | ||
kill @e[type=minecraft:marker,tag=itemballs.spawn_location] |