Modern Industrialization

Modern Industrialization

9M Downloads

Severe FPS loss while holding MI hatches with many MI multiblocks built

James103 opened this issue · 5 comments

commented

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).

RenderHelper.drawOverlay(matrices, vcp, 111f / 256, 1, 111f / 256, 15728880, overlay);

Steps to reproduce

  1. Build a few dozen MI multiblock structures in one area (ideally in a superflat world or void dimension).
  2. Hold an MI hatch in your hand.
  3. 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.

commented

@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

commented

Not a fix to the issue per se, but there is a config option to disable this hatch overlay rendering.