From 33630da076c97eb18200c61feb2b028547aaaf97 Mon Sep 17 00:00:00 2001 From: imreallybadatnames Date: Mon, 6 May 2024 20:22:48 +1100 Subject: [PATCH] jonfig --- .../revelationary/compat/jei/RevelationaryJEIPlugin.java | 3 +++ .../revelationary/compat/rei/RevelationaryREIPlugin.java | 3 +++ .../de/dafuqs/revelationary/config/RevelationaryConfig.java | 1 + 3 files changed, 7 insertions(+) diff --git a/src/main/java/de/dafuqs/revelationary/compat/jei/RevelationaryJEIPlugin.java b/src/main/java/de/dafuqs/revelationary/compat/jei/RevelationaryJEIPlugin.java index 45496c3..437570b 100644 --- a/src/main/java/de/dafuqs/revelationary/compat/jei/RevelationaryJEIPlugin.java +++ b/src/main/java/de/dafuqs/revelationary/compat/jei/RevelationaryJEIPlugin.java @@ -2,6 +2,7 @@ import de.dafuqs.revelationary.Revelationary; import de.dafuqs.revelationary.api.revelations.CloakSetChanged; +import de.dafuqs.revelationary.config.RevelationaryConfig; import mezz.jei.api.IModPlugin; import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.runtime.IJeiRuntime; @@ -18,6 +19,7 @@ public class RevelationaryJEIPlugin implements IModPlugin { private Set stacksCache; public RevelationaryJEIPlugin() { + if (!RevelationaryConfig.get().HideCloakedEntriesFromRecipeViewers) return; CloakSetChanged.EVENT.register((added, removed, newStacks) -> { stacksCache = newStacks; if (runtime != null) { @@ -38,6 +40,7 @@ public RevelationaryJEIPlugin() { @Override public void onRuntimeAvailable(IJeiRuntime jeiRuntime) { runtime = jeiRuntime; + if (!RevelationaryConfig.get().HideCloakedEntriesFromRecipeViewers) return; if (stacksCache != null) runtime.getIngredientManager() .removeIngredientsAtRuntime(VanillaTypes.ITEM_STACK, stacksCache.stream().map(ItemStack::new).collect(Collectors.toList())); diff --git a/src/main/java/de/dafuqs/revelationary/compat/rei/RevelationaryREIPlugin.java b/src/main/java/de/dafuqs/revelationary/compat/rei/RevelationaryREIPlugin.java index 19c528b..1db4445 100644 --- a/src/main/java/de/dafuqs/revelationary/compat/rei/RevelationaryREIPlugin.java +++ b/src/main/java/de/dafuqs/revelationary/compat/rei/RevelationaryREIPlugin.java @@ -1,6 +1,7 @@ package de.dafuqs.revelationary.compat.rei; import de.dafuqs.revelationary.api.revelations.CloakSetChanged; +import de.dafuqs.revelationary.config.RevelationaryConfig; import me.shedaniel.rei.api.client.entry.filtering.base.BasicFilteringRule; import me.shedaniel.rei.api.client.plugins.REIClientPlugin; import me.shedaniel.rei.api.common.util.EntryStacks; @@ -16,6 +17,7 @@ public class RevelationaryREIPlugin implements REIClientPlugin { private static Set hiddenStacks = Set.of(); public RevelationaryREIPlugin() { + if (!RevelationaryConfig.get().HideCloakedEntriesFromRecipeViewers) return; CloakSetChanged.EVENT.register((added, removed, newStacks) -> { hiddenStacks = newStacks; //noinspection UnstableApiUsage @@ -27,6 +29,7 @@ public RevelationaryREIPlugin() { public void registerBasicEntryFiltering(@SuppressWarnings("UnstableApiUsage") BasicFilteringRule rule) { // not using .show to not interfere with other filtering rules //noinspection UnstableApiUsage + if (!RevelationaryConfig.get().HideCloakedEntriesFromRecipeViewers) return; filteringRule = rule.hide(() -> hiddenStacks.stream() .map(EntryStacks::of) diff --git a/src/main/java/de/dafuqs/revelationary/config/RevelationaryConfig.java b/src/main/java/de/dafuqs/revelationary/config/RevelationaryConfig.java index 54a780a..085465f 100644 --- a/src/main/java/de/dafuqs/revelationary/config/RevelationaryConfig.java +++ b/src/main/java/de/dafuqs/revelationary/config/RevelationaryConfig.java @@ -22,6 +22,7 @@ public static Config get() { public static class Config { public boolean PreventMiningOfUnrevealedBlocks = false; public boolean UseTargetBlockOrItemNameInsteadOfScatter = false; + public boolean HideCloakedEntriesFromRecipeViewers = true; public String NameForUnrevealedBlocks = ""; public String NameForUnrevealedItems = "";