#Reduce Lag

1 messages · Page 1 of 1 (latest)

ashen summit
#

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```
prime osprey
#

Why not set it to work less often? thonk and I mean add a tick wait somewhere

#

seems like it's doing a lot at once

compact radish
#

dont check nbt
use a metadata tag or a var
nbt is very slow

prime osprey
#

wasn't metadata found to also be extremely slow.

compact radish
#

faster than nbt

prime osprey
#

I mean really anything is lol

compact radish
#

also this line needs to be turned into a list of some sort set {_x::*} to ((all blocks within chunk at {_location::1}) where [input is hopper]) where [custom nbt of input has tag "ChunkHopper"]

compact radish
prime osprey
#

I know they are very fast.

#

vars would probably be best in his case.

#

iirc metadata doesn't persist anyway.

spark cedar
prime osprey
#

I've been lied to then

spark cedar
#

just use a {ChunkHopper::%chunk%::*} list @ashen summit

#

instead of filtering over every block in a chunk twice 💀