When the `ItemPanel.resize` method will be invoked?
Discreater opened this issue ยท 1 comments
A mod which depends on NEI crashed with NEI 2.0. I want to fix it in that mod. That mod overrides the ItemPanel.resize
method. I find that this method will be invoked frequently when I open the inventory. such as that
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
[17:25:05] [Client thread/INFO] [NotEnoughItems]: easy resizeing
I wonder if this is normal and when the method will be invoked.
Thanks.
It's called from the LayoutManager
--> LayoutStyleMinecraft
--> ItemPanel.resize(gui)
It's called a lot, but I didn't see much CPU impact from it so I didn't look into reducing the number of calls. If you're overriding it, you need to update the call to resize
to pass in a gui
or it'll crash.
If you come up with a way to reduce the number of calls and still keep things working/responsive please consider making a PR here so others can benefit as well.