Files
NotEnoughItems/src/main/java/codechicken/nei/api/NEIInfo.java
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
1000 B
Java
Raw Normal View History

2014-04-29 10:54:20 +10:00
package codechicken.nei.api;
2023-09-25 00:35:24 +02:00
import java.util.LinkedList;
2023-09-25 00:34:42 +02:00
import net.minecraft.world.World;
2023-09-25 00:35:24 +02:00
import codechicken.nei.NEIClientConfig;
2026-05-06 23:36:07 +03:00
import codechicken.nei.config.GuiOptionList;
2023-09-25 00:35:24 +02:00
import codechicken.nei.config.OptionCycled;
public class NEIInfo {
2019-12-30 20:19:16 -08:00
public static final LinkedList<INEIModeHandler> modeHandlers = new LinkedList<>();
2014-04-29 10:54:20 +10:00
public static void load(World world) {
OptionCycled modeOption = (OptionCycled) NEIClientConfig.getOptionList().getOption("inventory.cheatmode");
2026-05-06 23:36:07 +03:00
// kept alive so the WeakReference in Option.slotRef isn't GC'd before copyGlobals/cycle use it
GuiOptionList env = modeOption.parent.synthesizeEnvironment(false);
if (!modeOption.optionValid(modeOption.value())) {
2014-04-29 10:54:20 +10:00
modeOption.copyGlobals();
modeOption.cycle();
}
}
public static boolean isValidMode(int mode) {
for (INEIModeHandler handler : modeHandlers) if (!handler.isModeValid(mode)) return false;
2014-04-29 10:54:20 +10:00
return true;
}
}