Slimefun-Addon-Community / Supreme

An addon for slimefun
GNU General Public License v3.0
6 stars 20 forks source link

Performance supreme generator mob #29

Closed RelativoBR closed 1 year ago

RelativoBR commented 1 year ago

User Report: I'm having a problem with the supreme generator, the supreme machines are causing a lot of lag on the server

image

image

JustAHuman-xD commented 1 year ago

Any chance you could provide a timings report?

SchnTgaiSpock commented 1 year ago

pretty sure its this

Bukkit.getScheduler().callSyncMethod(Supreme.inst(),
          () -> l.getWorld().getNearbyEntities(l, mobRange, mobRange, mobRange, predicate).isEmpty())

on line 82. the docs mention there is a 10ms latency until the isDone() method returns true, idk if that means it takes 10ms to execute, or 10ms to register that it executed. could also be that getNearbyEntities is just really laggy

JustAHuman-xD commented 1 year ago

It definitely is that, one thing I was thinking about doing was after it finds one entity, cache it's uuid, and then next tick check if that entity is still existing and still close enough. Only if it's not then does it go to the next one.

RelativoBR commented 1 year ago

Solved in another ticket

https://github.com/Slimefun-Addon-Community/Supreme/pull/35