Skip to content

Commit

Permalink
jonfig
Browse files Browse the repository at this point in the history
  • Loading branch information
imreallybadatnames committed May 6, 2024
1 parent 588a1fd commit 33630da
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -18,6 +19,7 @@ public class RevelationaryJEIPlugin implements IModPlugin {
private Set<Item> stacksCache;

public RevelationaryJEIPlugin() {
if (!RevelationaryConfig.get().HideCloakedEntriesFromRecipeViewers) return;
CloakSetChanged.EVENT.register((added, removed, newStacks) -> {
stacksCache = newStacks;
if (runtime != null) {
Expand All @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -16,6 +17,7 @@ public class RevelationaryREIPlugin implements REIClientPlugin {
private static Set<Item> hiddenStacks = Set.of();

public RevelationaryREIPlugin() {
if (!RevelationaryConfig.get().HideCloakedEntriesFromRecipeViewers) return;
CloakSetChanged.EVENT.register((added, removed, newStacks) -> {
hiddenStacks = newStacks;
//noinspection UnstableApiUsage
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";

Expand Down

0 comments on commit 33630da

Please sign in to comment.