diff options
| author | nea <nea@nea.moe> | 2023-01-14 21:10:37 +0100 |
|---|---|---|
| committer | nea <nea@nea.moe> | 2023-01-14 21:10:37 +0100 |
| commit | 14f2c9d48a31327a13791dc734813bb2fdb0926e (patch) | |
| tree | 2b608ad4f082aa0d8bedafad98dc7657cdae26c9 /src/main/java | |
| parent | 84bdb5acf6517fa6ccb4d1ec9cf5eacd40cbc1c1 (diff) | |
| parent | c20f610853702c0208d301865c015ea8ef973fd4 (diff) | |
| download | NotEnoughUpdates-14f2c9d48a31327a13791dc734813bb2fdb0926e.tar.gz NotEnoughUpdates-14f2c9d48a31327a13791dc734813bb2fdb0926e.tar.bz2 NotEnoughUpdates-14f2c9d48a31327a13791dc734813bb2fdb0926e.zip | |
Merge remote-tracking branch 'origin/master' into museumthing
Diffstat (limited to 'src/main/java')
63 files changed, 1054 insertions, 394 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java b/src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java index d997d980..2091496d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java @@ -50,6 +50,7 @@ public class BuildFlags { } public static final boolean ENABLE_PRONOUNS_IN_PV_BY_DEFAULT = getBuildFlag("pronouns"); + public static final boolean ENABLE_ONECONFIG_COMPAT_LAYER = getBuildFlag("oneconfig"); private static class Holder { static Map<String, Boolean> ALL_FLAGS = new HashMap<>(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index 5e9bb55c..3ecf73c0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -288,7 +288,7 @@ public class NEUManager { public void loadItem(String internalName) { itemstackCache.remove(internalName); try { - JsonObject json = getJsonFromFile(new File(new File(repoLocation, "items"), internalName + ".json")); + JsonObject json = getJsonFromFile(getItemFileForInternalName(internalName)); if (json == null) { return; } @@ -971,6 +971,10 @@ public class NEUManager { return getUUIDFromNBT(tag); } + public File getItemFileForInternalName(String internalName) { + return new File(new File(repoLocation, "items"), internalName + ".json"); + } + public void writeItemToFile(ItemStack stack) { String internalname = getInternalNameForItem(stack); @@ -984,7 +988,7 @@ public class NEUManager { json.addProperty("modver", NotEnoughUpdates.VERSION); try { - writeJson(json, new File(new File(repoLocation, "items"), internalname + ".json")); + writeJson(json, getItemFileForInternalName(internalname)); } catch (IOException ignored) { } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index cff83cca..7159ef89 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -46,6 +46,7 @@ import io.github.moulberry.notenoughupdates.util.LerpingFloat; import io.github.moulberry.notenoughupdates.util.NotificationHandler; import io.github.moulberry.notenoughupdates.util.SpecialColour; import io.github.moulberry.notenoughupdates.util.Utils; +import lombok.var; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -84,6 +85,7 @@ import org.lwjgl.opengl.GL14; import org.lwjgl.util.vector.Vector2f; import java.awt.*; +import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Comparator; @@ -110,6 +112,7 @@ public class NEUOverlay extends Gui { "notenoughupdates:supersecretassets/lunar.png"); private static final ResourceLocation SEARCH_BAR = new ResourceLocation("notenoughupdates:search_bar.png"); private static final ResourceLocation SEARCH_BAR_GOLD = new ResourceLocation("notenoughupdates:search_bar_gold.png"); + private static final ResourceLocation SEARCH_MODE_BUTTON = new ResourceLocation("notenoughupdates:search_mode_button.png"); private final NEUManager manager; @@ -426,7 +429,7 @@ public class NEUOverlay extends Gui { }; } - private MBGuiElement createHelpButton(NEUOverlay overlay) { + private MBGuiElement createSearchModeButton() { return new MBGuiElement() { @Override public int getWidth() { @@ -443,14 +446,12 @@ public class NEUOverlay extends Gui { @Override public void mouseClick(float x, float y, int mouseX, int mouseY) { - if (!NotEnoughUpdates.INSTANCE.config.toolbar.enableHelpButton) { + if (!NotEnoughUpdates.INSTANCE.config.toolbar.enableSearchModeButton) { return; } if (Mouse.getEventButtonState()) { - //displayInformationPane(HTMLInfoPane.createFromWikiUrl(overlay, manager, "Help", - // "https://moulberry.github.io/files/neu_help.html")); - //Minecraft.getMinecraft().displayGuiScreen(new HelpGUI()); - ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/neuhelp"); + searchMode = !searchMode; + lastSearchMode = System.currentTimeMillis(); Utils.playPressSound(); } } @@ -463,7 +464,7 @@ public class NEUOverlay extends Gui { int paddingUnscaled = getPaddingUnscaled(); int searchYSize = getSearchBarYSize(); - if (!NotEnoughUpdates.INSTANCE.config.toolbar.enableHelpButton) { + if (!NotEnoughUpdates.INSTANCE.config.toolbar.enableSearchModeButton) { return; } @@ -473,7 +474,7 @@ public class NEUOverlay extends Gui { searchYSize + paddingUnscaled * 2, searchYSize + paddingUnscaled * 2, GL11.GL_NEAREST ); - Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.help); + Minecraft.getMinecraft().getTextureManager().bindTexture(SEARCH_MODE_BUTTON); GlStateManager.color(1f, 1f, 1f, 1f); Utils.drawTexturedRect((int) x + paddingUnscaled, (int) y + paddingUnscaled, getSearchBarYSize(), getSearchBarYSize() @@ -618,7 +619,7 @@ public class NEUOverlay extends Gui { List<MBGuiElement> children = Lists.newArrayList( createSettingsButton(this), createSearchBar(), - createHelpButton(this) + createSearchModeButton() ); return new MBGuiGroupAligned(children, false) { public int getPadding() { @@ -1156,8 +1157,30 @@ public class NEUOverlay extends Gui { manager.jsonToStack(item)); } } else if (NotEnoughUpdates.INSTANCE.config.apiData.repositoryEditing && - Keyboard.getEventCharacter() == 'k') { - Minecraft.getMinecraft().displayGuiScreen(new NEUItemEditor(internalname.get(), item)); + keyPressed == Keyboard.KEY_K) { + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + var externalEditorCommand = NotEnoughUpdates.INSTANCE.config.hidden.externalEditor; + if (externalEditorCommand == null) { + Utils.addChatMessage( + "§e[NEU] §3No external editor set! Run §b/neudevtest exteditor <editorcommand>§3 " + + "to set your external editor. Optionally use {} as a placeholder for the filename."); + } else { + var externalFileName = manager.getItemFileForInternalName(internalname.get()).getAbsolutePath(); + if (externalEditorCommand.contains("{}")) { + externalEditorCommand = externalEditorCommand.replace("{}", externalFileName); + } else { + externalEditorCommand += " " + externalFileName; + } + try { + Runtime.getRuntime().exec(externalEditorCommand); + } catch (IOException e) { + Utils.addChatMessage("§e[NEU]§4 Could not open external editor."); + e.printStackTrace(); + } + } + } else { + Minecraft.getMinecraft().displayGuiScreen(new NEUItemEditor(internalname.get(), item)); + } return true; } else if (keyPressed == manager.keybindItemSelect.getKeyCode() && NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 21dc32c6..6160ac8d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -63,6 +63,7 @@ import io.github.moulberry.notenoughupdates.miscfeatures.PowerStoneStatsDisplay; import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; import io.github.moulberry.notenoughupdates.miscfeatures.SunTzu; +import io.github.moulberry.notenoughupdates.miscfeatures.WardrobeMouseButtons; import io.github.moulberry.notenoughupdates.miscfeatures.WitherCloakChanger; import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBiomes; import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBlockSounds; @@ -80,6 +81,7 @@ import io.github.moulberry.notenoughupdates.miscgui.SignCalculator; import io.github.moulberry.notenoughupdates.miscgui.TrophyRewardOverlay; import io.github.moulberry.notenoughupdates.miscgui.minionhelper.MinionHelperManager; import io.github.moulberry.notenoughupdates.mixins.AccessorMinecraft; +import io.github.moulberry.notenoughupdates.oneconfig.IOneConfigCompat; import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.overlays.EquipmentOverlay; import io.github.moulberry.notenoughupdates.overlays.FuelBar; @@ -295,6 +297,8 @@ public class NotEnoughUpdates { if (config.mining.powderGrindingTrackerResetMode == 2) OverlayManager.powderGrindingOverlay.load(); + IOneConfigCompat.getInstance().ifPresent(it -> it.initConfig(config, this::saveConfig)); + MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new NEUEventListener(this)); MinecraftForge.EVENT_BUS.register(new RecipeGenerator(this)); @@ -352,6 +356,7 @@ public class NotEnoughUpdates { MinecraftForge.EVENT_BUS.register(AbiphoneContactHelper.getInstance()); MinecraftForge.EVENT_BUS.register(MuseumItemHighlighter.INSTANCE); MinecraftForge.EVENT_BUS.register(MuseumCheapestItemOverlay.INSTANCE); + MinecraftForge.EVENT_BUS.register(new WardrobeMouseButtons()); if (Minecraft.getMinecraft().getResourceManager() instanceof IReloadableResourceManager) { IReloadableResourceManager manager = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java index 53e72dc1..e606fc49 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java @@ -27,6 +27,7 @@ import io.github.moulberry.notenoughupdates.NEUManager; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.miscgui.GuiPriceGraph; import io.github.moulberry.notenoughupdates.recipes.Ingredient; +import io.github.moulberry.notenoughupdates.recipes.ItemShopRecipe; import io.github.moulberry.notenoughupdates.recipes.NeuRecipe; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.Utils; @@ -902,6 +903,11 @@ public class APIManager { if (recipes != null) R |
