diff options
Diffstat (limited to 'src/main/java/io')
76 files changed, 524 insertions, 3693 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 88e7a205..792bbea4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -23,6 +23,7 @@ import com.google.common.collect.Lists; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import io.github.moulberry.notenoughupdates.commands.help.SettingsCommand; import io.github.moulberry.notenoughupdates.core.BackgroundBlur; import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger; @@ -38,7 +39,6 @@ import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers; import io.github.moulberry.notenoughupdates.miscfeatures.SunTzu; import io.github.moulberry.notenoughupdates.miscgui.NeuSearchCalculator; import io.github.moulberry.notenoughupdates.miscgui.pricegraph.GuiPriceGraph; -import io.github.moulberry.notenoughupdates.options.NEUConfigEditor; import io.github.moulberry.notenoughupdates.util.Calculator; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.GuiTextures; @@ -402,7 +402,7 @@ public class NEUOverlay extends Gui { return; } if (Mouse.getEventButtonState()) { - NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(NEUConfigEditor.editor); + NotEnoughUpdates.INSTANCE.openGui = SettingsCommand.INSTANCE.createConfigScreen(""); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 6105ddb8..f81331ea 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -274,7 +274,7 @@ public class NotEnoughUpdates { if (config.mining.powderGrindingTrackerResetMode == 2) OverlayManager.powderGrindingOverlay.load(); - IOneConfigCompat.getInstance().ifPresent(it -> it.initConfig(config, this::saveConfig)); + IOneConfigCompat.getInstance().ifPresent(it -> it.initConfig(config)); MinecraftForge.EVENT_BUS.register(new NEUEventListener(this)); MinecraftForge.EVENT_BUS.register(new RecipeGenerator(this)); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/Config.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/Config.java deleted file mode 100644 index 6bafb1fd..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/Config.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2022 NotEnoughUpdates contributors - * - * This file is part of NotEnoughUpdates. - * - * NotEnoughUpdates is free software: you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. - * - * NotEnoughUpdates is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>. - */ - -package io.github.moulberry.notenoughupdates.core.config; - -public class Config { - public void executeRunnable(int runnableId) {} -} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/GuiOptionEditorBlocked.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/GuiOptionEditorBlocked.java index 11112782..5b1caed8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/GuiOptionEditorBlocked.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/GuiOptionEditorBlocked.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 NotEnoughUpdates contributors + * Copyright (C) 2022-2023 NotEnoughUpdates contributors * * This file is part of NotEnoughUpdates. * @@ -17,9 +17,9 @@ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>. */ -package io.github.moulberry.notenoughupdates.core.config.struct; +package io.github.moulberry.notenoughupdates.core.config; -import io.github.moulberry.notenoughupdates.core.config.gui.GuiOptionEditor; +import io.github.moulberry.moulconfig.gui.GuiOptionEditor; import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils; import lombok.var; @@ -34,7 +34,7 @@ public class GuiOptionEditorBlocked extends GuiOptionEditor { private final GuiOptionEditor base; public GuiOptionEditorBlocked(GuiOptionEditor base) { - super(base.option); + super(base.getOption()); this.base = base; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/GuiPositionEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/GuiPositionEditor.java index eac1e5cd..78cefdfb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/GuiPositionEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/GuiPositionEditor.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 NotEnoughUpdates contributors + * Copyright (C) 2022-2023 NotEnoughUpdates contributors * * This file is part of NotEnoughUpdates. * @@ -19,121 +19,213 @@ package io.github.moulberry.notenoughupdates.core.config; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.core.config.Position; +import io.github.moulberry.notenoughupdates.overlays.OverlayManager; +import io.github.moulberry.notenoughupdates.overlays.TextOverlay; +import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.function.Supplier; public class GuiPositionEditor extends GuiScreen { - public PositionNew position = new PositionNew(); + private final ArrayList<Position> positions; + private final ArrayList<Position> originalPositions; + private final ArrayList<Integer> elementWidths; + private final ArrayList<Integer> elementHeights; + private final ArrayList<Supplier<Boolean>> shouldRenderSupplier; + private final Runnable positionChangedCallback; + private final Runnable closedCallback; + private int grabbedX = 0; + private int grabbedY = 0; + private int clickedPos = -1; + private int oldGuiScale = -1; + public static boolean renderDrill = false; + + + public GuiPositionEditor( + LinkedHashMap<TextOverlay, Position> overlayPositions, + Runnable positionChangedCallback, + Runnable closedCallback + ) { + shouldRenderSupplier = new ArrayList<>(); + ArrayList<Position> pos = new ArrayList<>(); + ArrayList<Position> ogPos = new ArrayList<>(); + ArrayList<Integer> width = new ArrayList<>(); + ArrayList<Integer> height = new ArrayList<>(); + for (int i = 0; i < overlayPositions.size(); i++) { + TextOverlay overlay = new ArrayList<>(overlayPositions.keySet()).get(i); + pos.add(overlayPositions.get(overlay)); + ogPos.add(pos.get(i).clone()); + width.add((int) overlay.getDummySize().x); + height.add((int) overlay.getDummySize().y); + shouldRenderSupplier.add(() -> { + if (overlay.isEnabled()) { + overlay.renderDummy(); + OverlayManager.dontRenderOverlay.add(overlay.getClass( |
