mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-12 08:27:37 +00:00
Co-authored-by: slprime <31038811+slprime@users.noreply.github.com>
32 lines
1.1 KiB
Java
32 lines
1.1 KiB
Java
package codechicken.nei.api;
|
|
|
|
import java.util.LinkedList;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
import codechicken.nei.NEIClientConfig;
|
|
import codechicken.nei.config.GuiOptionList;
|
|
import codechicken.nei.config.OptionCycled;
|
|
|
|
public class NEIInfo {
|
|
|
|
public static final LinkedList<INEIModeHandler> modeHandlers = new LinkedList<>();
|
|
|
|
public static void load(World world) {
|
|
OptionCycled modeOption = (OptionCycled) NEIClientConfig.getOptionList().getOption("inventory.cheatmode");
|
|
final boolean worldConfig = NEIClientConfig.isWorldSpecific("inventory.cheatmode");
|
|
// kept alive so the WeakReference in Option.slotRef isn't GC'd before copyGlobals/cycle use it
|
|
GuiOptionList env = modeOption.parent.synthesizeEnvironment(worldConfig);
|
|
if (!modeOption.optionValid(modeOption.value())) {
|
|
modeOption.copyGlobals();
|
|
modeOption.cycle();
|
|
}
|
|
}
|
|
|
|
public static boolean isValidMode(int mode) {
|
|
for (INEIModeHandler handler : modeHandlers) if (!handler.isModeValid(mode)) return false;
|
|
|
|
return true;
|
|
}
|
|
}
|