
[Bug]: mouseClicked event handler Crash
SirTwsted opened this issue ยท 9 comments
Minecraft Version
v.1.21.1
Mod Loader
NeoForge
Mod Loader Version
v21.1.65
Mod Version
v4.1.1.0
Modpack or other Mod
No response
Describe the Issue
Hi,
I am using Minecraft v1.21.1 with NEOForge v21.1.65 and FTB Library v2101.1.3
I was using the FTB Quest and collecting my rewards, when BOOM got a crash when I clicked on something. Here is the crash report.
Crashlogs
https://paste.feed-the-beast.com/view/fa18cddf
and
Steps to reproduce
Click on any rewards to get rewards, and BOOM crash.
Anything else to note?
Response from FTB Team:
FTBTeam/FTB-Mods-Issues#1349 (comment)
Do you use any performance-enhancing mods (e.g. OptiFine)?
No, I do not use Optifine.
Note for me: This line causes a rebuild of CreativeTabs:
I am trying to debug that, when I have the time for it.
You can give this a try. ๐คทโโ๏ธ๐ค
This will change the entire class DisplayStacksCache though.
`
package dev.ftb.mods.ftbquests.integration.item_filtering;
import dev.ftb.mods.ftbquests.quest.reward.RandomReward;
import dev.ftb.mods.ftbquests.quest.task.ItemTask;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.CreativeModeTabs;
import java.util.*;
public class DisplayStacksCache {
private static final Map<ItemTask, List> ITEM_TASK_CACHE = new HashMap<>();
private static final Map<RandomReward, List> RANDOM_REWARD_CACHE = new HashMap<>();
private static Collection cachedSearchTabDisplayItems;
public static List<ItemStack> get(ItemTask task) {
return ITEM_TASK_CACHE.computeIfAbsent(task, t -> new ArrayList<>(t.getItemsToCheck()));
}
public static List<ItemStack> get(RandomReward reward) {
return RANDOM_REWARD_CACHE.computeIfAbsent(reward, r -> {
List<ItemStack> list = new ArrayList<>();
r.table.rewards.forEach(entry -> list.addAll(entry.getDisplayItems()));
return list;
});
}
private static Collection<ItemStack> getSearchTabDisplayItems() {
if (cachedSearchTabDisplayItems == null) {
cachedSearchTabDisplayItems = CreativeModeTabs.searchTab().getDisplayItems();
}
return cachedSearchTabDisplayItems;
}
public static void invalidateCache() {
ITEM_TASK_CACHE.clear();
RANDOM_REWARD_CACHE.clear();
cachedSearchTabDisplayItems = null;
}
public static List<ItemStack> getAllItems() {
List<ItemStack> allItems = new ArrayList<>(getSearchTabDisplayItems());
ITEM_TASK_CACHE.values().forEach(allItems::addAll);
RANDOM_REWARD_CACHE.values().forEach(allItems::addAll);
return allItems;
}
}
`
Changes made:
Added a new private static field cachedSearchTabDisplayItems to store the cached result of CreativeModeTabs.searchTab().getDisplayItems().
Created a new private method getSearchTabDisplayItems() that implements the caching mechanism for the creative tab's display items.
Modified the getAllItems() method to use the new getSearchTabDisplayItems() method instead of directly calling CreativeModeTabs.searchTab().getDisplayItems().
Updated the invalidateCache() method to also clear the cachedSearchTabDisplayItems when invalidating the cache.
Changes should help improve performance by caching the result of CreativeModeTabs.searchTab().getDisplayItems(), which was potentially causing performance issues due to frequent rebuilding of CreativeTabs.
๐ค
That is not my code xD That is code of the FTB team ^^ The hint was only for me to find it faster later ^^
Your request would be worth to send to FTB as a fix and enhancement ^^
Actually, I cannot reproduce it in my environment. I call the CreativeModeTabs.tryRebuildTabContents
method but no crash happens with my BucketLib mod and a wooden bucket.
@SirTwsted Do you have a modpack where I can reproduce it? Are you using other mods with fluids (which ones)? Do you have some quests for me, that you are using to reproduce it?
It's a custom mod pack I personally created that has 455 mods installed. You need a very high-end pc to run it.
Many people can not run my personal custom mod pack, because I was forced to give it 50-GB of DDR5 RAM to run it.
And it pushes my AMD Radeon 7900-XTX a bit. And my AMD 7950X CPU on a Gigabyte X670E Aorus Extreme motherboard.
If it happens again, I will make sure to remember, what FTB quests reward section I am in the next time.
@SirTwsted Could you send me a list of all used mods that add fluids to the game? When you open JEI/REI you can search for "wooden bucket" and you should see all important fluids and for each can find the coresponding mod. :)
That would be awesome :)
When I type "Wooden Bucket" in JEI, for some odd reason nothing comes up anymore.
Even though I do have all the mods needed for this mod. As shown here.
This is what I get back from JEI when looking for "Wooden Bucket". Its very odd that it does not show up. ๐
Anyways, I typed Liquid in the JEI search and noted down all the mods that refer to liquids anyway. ๐คทโโ๏ธ
There might be more and not showing up, but this is what I got so far.
Minecraft Default
Aquaculture 2
Extreme Reactors
Integrated Dynamics
Just Dire Things
Mekanism
Mekanism Generators
Mystical Aggraditions
Productive Bees
Security Craft
Sophisticated Core
The BumbleZone
Theurgy
The Undergarden
Oh The Biomes We've Gone
Industrial Foregoing
Biomes O' plenty
Ceramic Bucket
Ex Deorum
Forbidden Arcanus
Oreberries Replanted
Tank Storage
TuFuCraftReloaded
Hope this helps. ๐๐
@SirTwsted I found the issue! It was an incompatibility with the powder snow bucket of the Forbidden Arcanus mod. It is fixed in the following upcoming versions of BucketLib:
- 1.21-4.1.1.1
- 1.20.6-3.3.1.1
- 1.20.4-3.2.2.1
- 1.20.1-2.3.5.1
Thanks again for your report and your quick answers! :)
If you find other problems, feel free to open a new issue :D