AlexsCaves icon indicating copy to clipboard operation
AlexsCaves copied to clipboard

Performance: Make melting-down nuclear furnaces find nearby nuclear sirens instead of vice-versa

Open ByThePowerOfScience opened this issue 8 months ago • 0 comments

https://github.com/AlexModGuy/AlexsCaves/blob/2e8fc8b4fab4502ec4dd558dfcc467abd74953bd/src/main/java/com/github/alexmodguy/alexscaves/server/block/blockentity/NuclearSirenBlockEntity.java#L70-L83

entity.getNearbyCriticalFurnaces((ServerLevel) level, 128).findAny() ends up being a fairly expensive process when run so frequently, with one nuclear siren on the server using roughly .38% of the total server time.

Since melting down happens less frequently than once per second, making the Siren a POI and having the Furnace find nearby Sirens to trigger would run the POI check less often.

ByThePowerOfScience avatar Jun 14 '24 19:06 ByThePowerOfScience