Hey! So I have this code, and it works great! But...., it causes a bit of lag every time it happens. What suggestions do y'all have to reduce the lag but keep it working as good as it is? Also the main part that made it laggy was checking for the chunk hoppers which is in the {x::*} list variable.
loop all players:
boolean tag "custom;GeneratorToggle" of nbt of loop-player is not false
loop {Generators::Placed::%loop-player's uuid%::*}:
if chunk at loop-value-2 is loaded:
set {_Generator::Type} to string tag "custom;GeneratorType" of nbt of loop-value-2
if {_Generator::Type} is set:
set {_location::1} to block at loop-value-2
set {_x::*} to ((all blocks within chunk at {_location::1}) where [input is hopper]) where [custom nbt of input has tag "ChunkHopper"]
loop {_x::*}:
set {_location::2} to block at loop-value-3
if {_location::2} is set:
#broadcast loop-value-3
broadcast "yes"
add 0.25 to y-coordinate of {_location::2}
drop 1 of {Generators::Drops::%{_Generator::Type}%} at {_location::2} without velocity
else:
drop 1 of {Generators::Drops::%{_Generator::Type}%} above loop-value-2 without velocity```
and I mean add a tick wait somewhere