From 3d1bceb928bdebcd710d38f9de45c20f81a204c1 Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Wed, 27 Nov 2024 09:20:44 +0100 Subject: [PATCH] Fix JEI/EMI/REI cache not invalidating when player inv changes --- .../modcompat/common/RecipeTransferHelpers.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/cyclops/integratedterminalscompat/modcompat/common/RecipeTransferHelpers.java b/src/main/java/org/cyclops/integratedterminalscompat/modcompat/common/RecipeTransferHelpers.java index f6ef6f5..1345373 100644 --- a/src/main/java/org/cyclops/integratedterminalscompat/modcompat/common/RecipeTransferHelpers.java +++ b/src/main/java/org/cyclops/integratedterminalscompat/modcompat/common/RecipeTransferHelpers.java @@ -58,10 +58,14 @@ public static Optional tabClient, Player player) { + return tabClient.getLastChangeId() + player.getInventory().getTimesChanged(); + } + public static Optional> getMissingItems(Object cacheKey, ContainerTerminalStorageBase container, Iterable recipeInputSlots, Player player, TerminalStorageTabIngredientComponentItemStackCraftingCommon tabCommonCrafting, TerminalStorageTabIngredientComponentClient tabClient, Function itemStackToMatchCondition, Supplier getId, Consumer onChangeId) { Callable>> missingItemsSupplier = () -> getMissingItemsUncached(container, recipeInputSlots, player, tabCommonCrafting, itemStackToMatchCondition, onChangeId); - if (getId.get() != tabClient.getLastChangeId()) { + if (getId.get() != getCurrentChangeId(tabClient, player)) { // Clear cache when storage contents changed recipeErrorCache.invalidateAll(); } @@ -147,7 +151,7 @@ public static Optional> getM } } - onChangeId.accept(tabClient.getLastChangeId()); + onChangeId.accept(getCurrentChangeId(tabClient, player)); if (!slotsMissingItems.isEmpty() || !slotsMissingCraftableItems.isEmpty()) { return Optional.of(new RecipeTransferResult(slotsMissingItems, slotsMissingCraftableItems)); }