Botania

Botania

145M Downloads

10x higher player lag when mana band not in trinket slot

Luky05005 opened this issue ยท 6 comments

commented

Mod Loader

Both Fabric and Forge (I confirm that I have tested both loaders and will specify both loader versions below)

Minecraft Version

1.20.1

Botania version

1.20.1-446-fabric 1.20.1-446-FORGE

Modloader version

fabric loader: 0.16.10 api: 0.92.3+1.20.1

Modpack info

No response

The latest.log file

Fabric: https://mclo.gs/QgxsXuM Forge: https://mclo.gs/ytl5Eua

Issue description

Mana consuming items that take mana from a mana storage item in the players inventory (not the trinket ring slot) cause lag.
Happens on both fabric and forge

Steps to reproduce

  1. Have a mana storage item in inventory (band of mana, greater band of mana, mana table, mana mirror)
  2. Equip a mana consuming accessory
  3. Run profiler (Observable)
  4. Player Causes about 10x higher lag than before

Fabric

Mana Band in trinket slot
Image

Image

Mana band in inventory
Image

Image

Forge

Mana band in trinket ring slot

Image

Image

Mana tablet in inventory

Image

Image

Other information

I first noticed this on my server, because players were causing the most lag, but this also happens in singleplayer.
Also I have a spark profile with this issue present on a server here, however there are many more mods loaded, but i think you can still find something. Like in the spark profile it looks like it has something to do with inventory updates

Image

profile download mediafire

commented

This doesn't appear to be a problem with the ring, specifically. I confirmed this without holding/equipping any Botania items and just picking up XP orbs to repair a damaged item with the Mending enchantment.

Any inventory update (not counting equipped items, but including the hotbar and the item in the main hand) causes a scan over possible advancement triggers, which produces the performance impact you are seeing. The reason it's particularly bad with the mana ring is the fact that it updates every tick when you equip an item that requires mana every tick.

Not sure how to mitigate this effectively. Batching mana operations of individual items probably won't help much, since multiple mana producers and consumers could change the mana item's stored amount at different times, depending when they entered your inventory or when they were equipped.

commented

Thanks for the response, it sucks that it cant be fixed tho. But the biggest problem on my server is that i had to ban people from using the mana mirrors, because they cannot be equipped like the mana bands and cause a lot of lag when like 10 people use them so maybe you could atleast make a mana mirror ring in the future.

commented

I think it might be fixable via mixin? I've raised #4794, which certainly seemed to give lower numbers in Observable. I don't think any mana items actually trigger advancements, so it should be safe to skip advancement checking for them.

commented

I think a good fix for this might be the achievement optimizer mod, so this is a temporary solution until it gets fixed

I have just been recommended a more sophisticated mod, Icterine, which does actual optimization work instead of just spreading out the problem over several ticks. It is available up to 1.20.4, so any version with data components will need to wait for a solution.

commented

I think a good fix for this might be the achievement optimizer mod, so this is a temporary solution until it gets fixed

commented

I'd even go as far and say it probably should not be fixed in Botania or other individually affected mods, but get a general fix in one of the usual performance optimization mods. Something like ModernFix or whichever mods are being used for these things nowadays.