Skip to content

Commit

Permalink
Fix modifiers getting cached too soon on server connect, causing JEI …
Browse files Browse the repository at this point in the history
…to disable (#5074)
  • Loading branch information
KnightMiner committed Jan 30, 2023
1 parent 885868f commit 57650de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Stream;
Expand Down Expand Up @@ -193,6 +194,10 @@ public static Stream<Modifier> getAllRecipeModifiers() {

/** Gets a list of modifier entries for display in JEI, basically the same as creating your own, but the result is cached */
public static List<ModifierEntry> getRecipeModifierList() {
// do not cache an empty list during game start, recipes have not yet loaded
if (RECIPE_MODIFIERS.isEmpty()) {
return Collections.emptyList();
}
if (RECIPE_MODIFIER_LIST == null) {
RECIPE_MODIFIER_LIST = RECIPE_MODIFIERS.values().stream().distinct().sorted(Comparator.comparing(LazyModifier::getId)).map(mod -> new ModifierEntry(mod, 1)).toList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,9 @@ public void onRuntimeAvailable(IJeiRuntime jeiRuntime) {
// shown via the modifiers
NonNullList<ItemStack> modifierCrystals = NonNullList.create();
TinkerModifiers.modifierCrystal.get().fillItemCategory(CreativeModeTab.TAB_SEARCH, modifierCrystals);
manager.removeIngredientsAtRuntime(VanillaTypes.ITEM_STACK, modifierCrystals);
if (!modifierCrystals.isEmpty()) {
manager.removeIngredientsAtRuntime(VanillaTypes.ITEM_STACK, modifierCrystals);
}

// hide knightslime and slimesteel until implemented
removeFluid(manager, TinkerFluids.moltenSoulsteel.get(), TinkerFluids.moltenSoulsteel.asItem());
Expand Down

0 comments on commit 57650de

Please sign in to comment.