mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 02:04:59 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c7207485d | ||
|
|
e8094794c3 |
No files matched your search
@@ -57,7 +57,8 @@ import codechicken.obfuscator.ObfuscationRun;
|
||||
|
||||
public class NEIClientConfig {
|
||||
|
||||
private static boolean configLoaded;
|
||||
private static boolean mainNEIConfigLoaded;
|
||||
private static boolean pluginNEIConfigLoaded;
|
||||
private static boolean enabledOverride;
|
||||
private static String worldPath;
|
||||
|
||||
@@ -463,8 +464,9 @@ public class NEIClientConfig {
|
||||
}
|
||||
|
||||
public static void bootNEI(World world) {
|
||||
if (configLoaded) return;
|
||||
if (mainNEIConfigLoaded) return;
|
||||
|
||||
// main NEI config loading
|
||||
ItemInfo.load(world);
|
||||
GuiInfo.load();
|
||||
RecipeInfo.load();
|
||||
@@ -472,10 +474,13 @@ public class NEIClientConfig {
|
||||
NEIController.load();
|
||||
RecipeCatalysts.loadCatalystInfo();
|
||||
|
||||
mainNEIConfigLoaded = true;
|
||||
|
||||
new Thread("NEI Plugin Loader") {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
logger.debug("Started NEI plugin loading");
|
||||
ClassDiscoverer classDiscoverer = new ClassDiscoverer(
|
||||
test -> test.startsWith("NEI") && test.endsWith("Config.class"),
|
||||
IConfigureNEI.class);
|
||||
@@ -493,8 +498,14 @@ public class NEIClientConfig {
|
||||
}
|
||||
}
|
||||
|
||||
// Set pluginNEIConfigLoaded here before posting the NEIConfigsLoadedEvent. This used to be the other
|
||||
// way around, but apparently if your modpack includes 800 mods the event poster might not return in
|
||||
// time and cause issues when loading a world for a second time as configLoaded is still false. This may
|
||||
// cause issues in case one of the event handler calls the (non-thread-safe) NEI API. I don't expect any
|
||||
// handler to do this, but who knows what modders have come up with...
|
||||
pluginNEIConfigLoaded = true;
|
||||
logger.debug("NEI plugin loading finished");
|
||||
MinecraftForge.EVENT_BUS.post(new NEIConfigsLoadedEvent());
|
||||
configLoaded = true;
|
||||
}
|
||||
}.start();
|
||||
ItemSorter.loadConfig();
|
||||
@@ -597,7 +608,7 @@ public class NEIClientConfig {
|
||||
}
|
||||
|
||||
public static boolean isLoaded() {
|
||||
return configLoaded;
|
||||
return mainNEIConfigLoaded && pluginNEIConfigLoaded;
|
||||
}
|
||||
|
||||
public static boolean loadHandlersFromJar() {
|
||||
|
||||
@@ -388,6 +388,8 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
// the value of the height field will be different from in other mouseover methods, which
|
||||
// could be confusing...
|
||||
|
||||
if (recipeTabs.mouseScrolled(i)) return;
|
||||
|
||||
for (int recipe : getRecipeIndices()) if (handler.mouseScrolled(this, i, recipe)) return;
|
||||
|
||||
if (new Rectangle(guiLeft, guiTop, xSize, ySize).contains(GuiDraw.getMousePosition())) {
|
||||
@@ -462,11 +464,11 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
if (page < 0) page = (handler.numRecipes() - 1) / getRecipesPerPage();
|
||||
}
|
||||
|
||||
private void nextType() {
|
||||
protected void nextType() {
|
||||
setRecipePage(++recipetype);
|
||||
}
|
||||
|
||||
private void prevType() {
|
||||
protected void prevType() {
|
||||
setRecipePage(--recipetype);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import codechicken.nei.Button;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
@@ -192,4 +196,22 @@ public class GuiRecipeTabs {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean mouseScrolled(int i) {
|
||||
Point mPos = getMousePosition();
|
||||
|
||||
// Switch recipe handler tabs if either left shift is held or the tab
|
||||
// bar is enable and the mouse cursor is positioned over said tab bar.
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)
|
||||
|| (NEIClientConfig.areJEIStyleTabsVisible() && (mPos.x >= area.x && mPos.x <= (area.x + area.width)
|
||||
&& mPos.y >= area.y
|
||||
&& mPos.y <= (area.y + area.height)))) {
|
||||
if (i < 0) guiRecipe.nextType();
|
||||
else guiRecipe.prevType();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user