Primal Magick

Primal Magick

306k Downloads

[1.19.2]Small freezes trying to view affinities

nin8995 opened this issue · 14 comments

commented

I installed many mods and every time I use shift key over items, to move stacks of items or to get information, it usually freezes a little bit with the tooltip "Affinities: Unknown".
I expected that when an item can have internal affinity values, it doesn't freeze, otherwise it freezes, so I played without Primal Magick and it didn't freeze.
I really need any performance improvements or config not to show affinities when pressing shift key.

This phenomenon can be ascertained with almost all the modpacks including Primal Magick.
For instance I tested Chunk Block by Joshernoob, because it was the first modpack which has latest version of this mod searching dependents, and it froze. Scrolling JEI pages pressing shift key is easy to feel small freezes.

commented

I am experiencing similar issues, it is most severe with items or blocks that contain things like planks, sticks, glass (stained glass panes in particular are very bad, probs because their recipe has 8 panes which have 6 glass?).
Many blocks that contain planks in their recipes, like vanilla job stations, seem to freeze once per startup when I hover over them while carrying an arcanometer.

In addition to that, some blocks or items, like items containing Archwood from Ars Nouveau or Raw Ore from the AllTheOres mod seem to never stop this freezing, hovering over them in the inventory while holding shift or hovering over them while carrying an Arcanometer seems to drop fps extremely low until you stop hovering over them, unlike plank items which just seem to take a long time to calculate or something.

I also tried with just Ars Nouveau and dependencies, and hovering over blocks like archwood planks with an arcanometer still seems to cut my fps in half, though the effect is less severe than in my big modpack.

Another thing I observed is that in the Allomancy mod, the freeze happens with (for example) Cadmium and Bendalloy flakes, but it does not occur with Duralumin flakes, which contain Copper flakes in their recipe and therefore have a value of 1 Earth.
So perhaps this has something to do with an item or block not getting any elements from their recipes and therefore somehow not terminating?

commented

Hello!, just logged in to say this also happens to me in 1.18.2's version (it's a gigantic personal modpack, about 480 mods), and it's way worst when you shift over a storage crate from immersive engineering full of items.
Also some items seem to be ok, while others (specially armor, tools and swords) are way laggier.
Maybe as an emergency fix, could we get at least a way to remap the key associated to view affinities? (And please for 1.18.2 too?)
Thank you for your time!

commented

Same problem here. Related issues: #98, #111

I guess the problem stems from the Affinity value generation logic iterating through every single recipe that produces a given item, followed by the same for every single item that's a part of each of those recipes, then the same for the recipes of those items... and so on and so forth.
At least, that's what I gathered from a quick skim of AffinityManager.java.

Maybe limit the Affinity tooltip to just vanilla + Primal Magick items/recipes? At least by default?
(default registry: AffinityProvider.java)

commented

@Grath I ran the "build" action manually; you can download the result here: https://github.com/unilock/PrimalMagick/actions/runs/5176550636
(for 1.19.2)

commented

Any possibility we could get a release now that this issue is possibly fixed by #140? I just made a modpack with Primal Magick in it and this is causing noticeable obnoxious freezes when shift-clicking items, which about half my playerbase are already actively complaining about (and we only started playing the pack yesterday.)

commented

Thank you for the assistance. Unfortunately, that build wouldn't even start on the server (which is 1.19.2):

net.minecraftforge.fml.LoadingFailedException: Loading errors encountered: [
	Primal Magick (primalmagick) has failed to load correctly
§7java.lang.RuntimeException: Attempted to load class net/minecraft/client/multiplayer/ClientLevel for invalid dist DEDICATED_SERVER
]
commented

This time the server loaded, but wouldn't let me connect:

[10:17:15] [Server thread/ERROR] [minecraft/ServerLoginPacketListenerImpl]: Couldn't place player in world
java.lang.RuntimeException: Attempted to load class net/minecraft/client/multiplayer/ClientLevel for invalid dist DEDICATED_SERVER
	at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:57) ~[fmlloader-1.19.2-43.2.11.jar%2367!/:1.0] {}
	at cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:88) ~[modlauncher-10.0.8.jar%2354!/:?] {}
	at cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:120) ~[modlauncher-10.0.8.jar%2354!/:?] {}
	at cpw.mods.modlauncher.TransformingClassLoader.maybeTransformClassBytes(TransformingClassLoader.java:50) ~[modlauncher-10.0.8.jar%2354!/:?] {}
	at cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:113) ~[securejarhandler-2.1.4.jar:?] {}
	at cpw.mods.cl.ModuleClassLoader.lambda$findClass$15(ModuleClassLoader.java:219) ~[securejarhandler-2.1.4.jar:?] {}
	at cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:229) ~[securejarhandler-2.1.4.jar:?] {}
	at cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:219) ~[securejarhandler-2.1.4.jar:?] {}
	at cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:135) ~[securejarhandler-2.1.4.jar:?] {}
	at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?] {}
	at com.verdantartifice.primalmagick.common.events.DataEvents.syncToPlayer(DataEvents.java:38) ~[primalmagick-8f49f7d.jar%23671!/:8f49f7d] {re:classloading}
	at com.verdantartifice.primalmagick.common.events.DataEvents.onDatapackSync(DataEvents.java:33) ~[primalmagick-8f49f7d.jar%23671!/:8f49f7d] {re:classloading}
	at com.verdantartifice.primalmagick.common.events.__DataEvents_onDatapackSync_OnDatapackSyncEvent.invoke(.dynamic) ~[primalmagick-8f49f7d.jar%23671!/:8f49f7d] {re:classloading,pl:eventbus:B}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.3.jar%2351!/:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%2351!/:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%2351!/:?] {}
	at net.minecraft.server.players.PlayerList.m_11261_(PlayerList.java:173) ~[server-1.19.2-20220805.130853-srg.jar%23773!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:kubejs-common.mixins.json:PlayerListMixin,pl:mixin:APP:ftbessentials-common.mixins.json:PlayerListAccess,pl:mixin:APP:nochatreports.mixins.json:server.MixinPlayerList,pl:mixin:APP:byg.mixins.json:common.MixinPlayerList,pl:mixin:APP:enigmaticlegacy.mixins.json:MixinPlayerList,pl:mixin:APP:ars_nouveau.mixins.json:camera.PlayerListMixin,pl:mixin:APP:securitycraft.mixins.json:camera.PlayerListMixin,pl:mixin:A}
	at net.minecraft.server.network.ServerLoginPacketListenerImpl.m_143699_(ServerLoginPacketListenerImpl.java:156) ~[server-1.19.2-20220805.130853-srg.jar%23773!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:connectivity.mixins.json:ServerLoginNetHandlerMixin,pl:mixin:A}
	at net.minecraft.server.network.ServerLoginPacketListenerImpl.m_10055_(ServerLoginPacketListenerImpl.java:143) ~[server-1.19.2-20220805.130853-srg.jar%23773!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:connectivity.mixins.json:ServerLoginNetHandlerMixin,pl:mixin:A}
	at net.minecraft.server.network.ServerLoginPacketListenerImpl.m_9933_(ServerLoginPacketListenerImpl.java:75) ~[server-1.19.2-20220805.130853-srg.jar%23773!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:connectivity.mixins.json:ServerLoginNetHandlerMixin,pl:mixin:A}
	at net.minecraft.network.Connection.m_129483_(Connection.java:248) ~[server-1.19.2-20220805.130853-srg.jar%23773!/:?] {re:mixin,re:classloading,pl:mixin:APP:connectivity.mixins.json:ConnectionErrorMixin,pl:mixin:APP:connectivity.mixins.json:NetworkManagerMixin,pl:mixin:A}
	at net.minecraft.server.network.ServerConnectionListener.m_9721_(ServerConnectionListener.java:143) ~[server-1.19.2-20220805.130853-srg.jar%23773!/:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:880) ~[server-1.19.2-20220805.130853-srg.jar%23773!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:kubejs-common.mixins.json:MinecraftServerMixin,pl:mixin:APP:kubejs-common.mixins.json:inject_resources.MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:ae2.mixins.json:spatial.MinecraftServerMixin,pl:mixin:APP:byg.mixins.json:access.MinecraftServerAccess,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:A}
	at net.minecraft.server.dedicated.DedicatedServer.m_5703_(DedicatedServer.java:292) ~[server-1.19.2-20220805.130853-srg.jar%23773!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:nochatreports.mixins.json:server.MixinDedicatedServer,pl:mixin:APP:tombstone.mixins.json:DedicatedServerMixin,pl:mixin:A}
	at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:806) ~[server-1.19.2-20220805.130853-srg.jar%23773!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:kubejs-common.mixins.json:MinecraftServerMixin,pl:mixin:APP:kubejs-common.mixins.json:inject_resources.MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:ae2.mixins.json:spatial.MinecraftServerMixin,pl:mixin:APP:byg.mixins.json:access.MinecraftServerAccess,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:A}
	at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:654) ~[server-1.19.2-20220805.130853-srg.jar%23773!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:kubejs-common.mixins.json:MinecraftServerMixin,pl:mixin:APP:kubejs-common.mixins.json:inject_resources.MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:ae2.mixins.json:spatial.MinecraftServerMixin,pl:mixin:APP:byg.mixins.json:access.MinecraftServerAccess,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:A}
	at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:244) ~[server-1.19.2-20220805.130853-srg.jar%23773!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:kubejs-common.mixins.json:MinecraftServerMixin,pl:mixin:APP:kubejs-common.mixins.json:inject_resources.MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:ae2.mixins.json:spatial.MinecraftServerMixin,pl:mixin:APP:byg.mixins.json:access.MinecraftServerAccess,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:A}
	at java.lang.Thread.run(Thread.java:833) [?:?] {re:mixin}
commented

The next planned release of Primal Magick is the 1.20 compatibility release. Mojang is releasing the patch tomorrow, after which I'm just dependent on Forge to release a recommended build of the mod loader. I know this probably isn't the timeframe you were hoping for, and I'm sorry for that, but it shouldn't be too much longer now.

commented

That won't help me at all, because it'll be many months before all the mods in my modpack are updated for 1.20 (if ever, several have shown no signs that they're being actively maintained on 1.19) so it sounds like I'm just stuck with options of "holes in the world from removing Primal Magick", "start a new world", or "deal with client freezing when I try to shift-click items".

commented

@Grath New build: https://github.com/unilock/PrimalMagick/actions/runs/5194194710

I actually tested it this time, and both logical (client) and dedicated servers work. Though it might break if there's no "overworld" level - but hopefully that shouldn't ever be the case.

(It's supposed to say "Affinities: Unknown" by default, right...?)

commented

@unilock Thank you for caring about this mod being playable in modpacks; it seems like it's running a bit better but still occasionally hits some lag calculating affinities (customizable tools can't be feasibly pre-calculated, for example.) I'll give it a shot running that build though.

commented

Unfortunately, I'm not the one who programmed the affinity derivation system; just the one who got it running on dedicated servers. You'll want to poke @dreamlibrarian concerning anything else.

commented

This should be fixed in the upcoming 1.20.1 release. Should you continue to encounter this sort of problem, please file a new ticket. Thank you for your patience!