Severe FPS loss while holding MI hatches with many MI multiblocks built
James103 opened this issue · 5 comments
Version info
Modern Industrialization 2.2.25
Minecraft 1.21.1
NeoForge 21.1.79
Modpack: Craftoria 1.9.0
Expected result
Reasonably smooth performance, even with dozens or hundreds of multiblocks.
Actual result
When there are a large number of MI multiblocks present in one area, holding an MI hatch in either hand causes a severe FPS drop due to trying to render a large number (thousands) of possible locations for hatches within the multiblock structures.
The linked and attached Spark profile shows this issue with approximately 142 MI multiblocks within the area and holding an MI item input hatch.
https://spark.lucko.me/5XnqRehlIZ or 5XnqRehlIZ.zip
A large amount of the additional time is spent calling this function repeatedly (once per possible hatch location per frame totaling tens of thousands of calls per second).
Steps to reproduce
- Build a few dozen MI multiblock structures in one area (ideally in a superflat world or void dimension).
- Hold an MI hatch in your hand.
- Notice the loss in FPS.
The actual performance impact is proportional to the number of possible hatch locations (green overlay boxes), which depends on the number and type of multiblock structures present – multiblocks with more flexible hatch placement have a bigger FPS impact while the player is holding a hatch.
@Swedz what about a config option called... showHatchOverlayOnValid
true
: it will show all hatch overlays
false
: if a hatch or hatch placements are a part of a valid completed multiblock, it just doesnt render them. the multiblock needs to be invalid for hatch overlays to show