Skip to content

Commit

Permalink
Should help with #8
Browse files Browse the repository at this point in the history
  • Loading branch information
Vazkii committed Apr 9, 2024
1 parent 02bbca8 commit 0f3129b
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
public class CreativeTabManager {

private static final Object MUTEX = new Object();
private static final Map<ItemLike, Item> itemLikeCache = new HashMap<>();

private static final Map<ResourceKey<CreativeModeTab>, CreativeTabAdditions> additions = new HashMap<>();
private static final Multimap<ItemLike, ResourceKey<CreativeModeTab>> mappedItems = HashMultimap.create();
Expand Down Expand Up @@ -210,7 +211,12 @@ private static boolean appendNextTo(ResourceKey<CreativeModeTab> tabKey, Mutable
for(Entry<ItemStack, TabVisibility> entry : entries) {
ItemStack stack = entry.getKey();
Item item = stack.getItem();
if(item == target.asItem()) {

if(!itemLikeCache.containsKey(target))
itemLikeCache.put(target, target.asItem());
Item targetItem = itemLikeCache.get(target);

if(item == targetItem) {
for(int i = 0; i < firstSet.items.size(); i++) {
int j = i;
if(!behind)
Expand Down

0 comments on commit 0f3129b

Please sign in to comment.