diff options
author | Linnea Gräf <nea@nea.moe> | 2024-01-17 16:42:13 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-01-17 16:42:13 +0100 |
commit | 4f691940c148050926c7aba3c8cfec180debb55e (patch) | |
tree | 0bf8f977bef97891589eaa91da3695f345c64759 /src | |
parent | 75b545a727d91df8a428fa92539d06617cd0e207 (diff) | |
download | neuhax-4f691940c148050926c7aba3c8cfec180debb55e.tar.gz neuhax-4f691940c148050926c7aba3c8cfec180debb55e.tar.bz2 neuhax-4f691940c148050926c7aba3c8cfec180debb55e.zip |
Add custom config
Diffstat (limited to 'src')
23 files changed, 208 insertions, 359 deletions
diff --git a/src/main/java/moe/nea/sky/mixin/MixinGenericBlockHighlighter.java b/src/main/java/moe/nea/sky/mixin/MixinGenericBlockHighlighter.java index 303b598..cdeddfc 100644 --- a/src/main/java/moe/nea/sky/mixin/MixinGenericBlockHighlighter.java +++ b/src/main/java/moe/nea/sky/mixin/MixinGenericBlockHighlighter.java @@ -10,9 +10,8 @@ package moe.nea.sky.mixin; -import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.miscfeatures.world.GenericBlockHighlighter; -import moe.nea.sky.config.HaxConfigWorld; +import moe.nea.sky.NEUHax; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -22,14 +21,14 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; public class MixinGenericBlockHighlighter { @Inject(method = "canPlayerSeeBlock", at = @At("HEAD"), cancellable = true, remap = false) public void onCanPlayerSee(double xCoord, double yCoord, double zCoord, CallbackInfoReturnable<Boolean> cir) { - if (((HaxConfigWorld) NotEnoughUpdates.INSTANCE.config.world).getNeuHaxWallhacks()) { + if (NEUHax.INSTANCE.getConfig().getInstance().getWallhacks().getNeuWorld()) { cir.setReturnValue(true); } } @Inject(method = "canPlayerSeeNearBlocks", at = @At("HEAD"), cancellable = true, remap = false) public void onPlayerCanSeeNearBlocks(double x, double y, double z, CallbackInfoReturnable<Boolean> cir) { - if (((HaxConfigWorld) NotEnoughUpdates.INSTANCE.config.world).getNeuHaxWallhacks()) { + if (NEUHax.INSTANCE.getConfig().getInstance().getWallhacks().getNeuWorld()) { cir.setReturnValue(true); } } diff --git a/src/main/java/moe/nea/sky/mixin/config/MixinHaxConfigEnchanting.java b/src/main/java/moe/nea/sky/mixin/config/MixinHaxConfigEnchanting.java deleted file mode 100644 index 45b6247..0000000 --- a/src/main/java/moe/nea/sky/mixin/config/MixinHaxConfigEnchanting.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2022 Linnea Gräf - * - * This file is part of NEUHax. - * - * NEUHax is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * NEUHax 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 General Public License for more details. - * You should have received a copy of the GNU General Public License along with NEUHax. If not, see <https://www.gnu.org/licenses/>. - */ - -package moe.nea.sky.mixin.config; - -import com.google.gson.annotations.Expose; -import io.github.moulberry.notenoughupdates.deps.io.github.moulberry.moulconfig.annotations.*; -import io.github.moulberry.notenoughupdates.options.separatesections.Enchanting; -import moe.nea.sky.config.HaxConfigEnchanting; -import org.lwjgl.input.Keyboard; -import org.spongepowered.asm.mixin.Mixin; - -@Mixin(Enchanting.class) -public class MixinHaxConfigEnchanting implements HaxConfigEnchanting { - @ConfigOption(name = "NEU Hax", desc = "NEU Hax enhancements to enchanting") - @ConfigEditorAccordion(id = 10000) - public boolean neuHaxAccordion = false; - - @Expose - @ConfigOption(name = "Auto solve Keybinding", desc = "Press this button to click on the next correct item") - @ConfigAccordionId(id = 10000) - @ConfigEditorKeybind(defaultKey = Keyboard.KEY_SPACE) - public int neuHaxSolveKeybinding = Keyboard.KEY_SPACE; - - @Expose - @ConfigOption(name = "Auto solve speed", desc = "How fast you can press the button to solve, in milliseconds") - @ConfigEditorSlider(minValue = 0, maxValue = 500, minStep = 10) - public int neuHaxTimeout = 50; - - @Override - public int getNeuHaxSolveKeybinding() { - return neuHaxSolveKeybinding; - } - - @Override - public int getNeuHaxTimeout() { - return neuHaxTimeout; - } -} diff --git a/src/main/java/moe/nea/sky/mixin/config/MixinHaxConfigFishing.java b/src/main/java/moe/nea/sky/mixin/config/MixinHaxConfigFishing.java deleted file mode 100644 index 1a39eca..0000000 --- a/src/main/java/moe/nea/sky/mixin/config/MixinHaxConfigFishing.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2022 Linnea Gräf - * - * This file is part of NEUHax. - * - * NEUHax is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * NEUHax 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 General Public License for more details. - * You should have received a copy of the GNU General Public License along with NEUHax. If not, see <https://www.gnu.org/licenses/>. - */ - -package moe.nea.sky.mixin.config; - -import com.google.gson.annotations.Expose; -import io.github.moulberry.notenoughupdates.deps.io.github.moulberry.moulconfig.annotations.*; -import io.github.moulberry.notenoughupdates.options.separatesections.Fishing; -import moe.nea.sky.config.HaxConfigFishing; -import org.spongepowered.asm.mixin.Mixin; - -@Mixin(Fishing.class) -public class MixinHaxConfigFishing implements HaxConfigFishing { - private static final int NEUHAXACCORDIONID = 10000; - @ConfigOption(name = "Auto Fishing", desc = "AutoFishing") - @ConfigEditorAccordion(id = NEUHAXACCORDIONID) - public boolean neuHaxAutoFishing = false; - - @Expose - @ConfigOption( - name = "Enable Auto Fishing", - desc = "Automatically reel in fish") - @ConfigAccordionId(id = NEUHAXACCORDIONID) - @ConfigEditorBoolean() - public boolean neuHaxAutoFishEnable = false; - @Expose - @ConfigOption( - name = "Minimum Delay", - desc = "Minimum delay to wait before reeling in the fish after it gets hooked, in ticks") - @ConfigAccordionId(id = NEUHAXACCORDIONID) - @ConfigEditorSlider(minValue = 0, maxValue = 40, minStep = 1) - public int neuHaxAutoFishMinDelay = 2; - @Expose - @ConfigOption( - name = "Maximum Delay", - desc = "Maximum delay to wait before reeling in the fish after it gets hooked, in ticks") - @ConfigAccordionId(id = NEUHAXACCORDIONID) - @ConfigEditorSlider(minValue = 0, maxValue = 40, minStep = 1) - public int neuHaxAutoFishMaxDelay = 10; - - @Expose - @ConfigOption( - name = "Reextend Fishing Rod", - desc = "Automatically start fishing again after fishing up something") - @ConfigAccordionId(id = NEUHAXACCORDIONID) - @ConfigEditorBoolean() - public boolean neuHaxReengageFishingRod = false; - - @Override - public boolean getNeuHaxAutoFishEnable() { - return neuHaxAutoFishEnable; - } - - @Override - public boolean getNeuHaxReengageFishingRod() { - return neuHaxReengageFishingRod; - } - - @Override - public int getNeuHaxAutoFishDelayMinimum() { - return neuHaxAutoFishMinDelay; - } - - @Override - public int getNeuHaxAutoFishDelayMaximum() { - return neuHaxAutoFishMaxDelay; - } -} diff --git a/src/main/java/moe/nea/sky/mixin/config/MixinHaxConfigNeuConfig.java b/src/main/java/moe/nea/sky/mixin/config/MixinHaxConfigNeuConfig.java deleted file mode 100644 index 99a56bc..0000000 --- a/src/main/java/moe/nea/sky/mixin/config/MixinHaxConfigNeuConfig.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2022 Linnea Gräf - * - * This file is part of NEUHax. - * - * NEUHax is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * NEUHax 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 General Public License for more details. - * You should have received a copy of the GNU General Public License along with NEUHax. If not, see <https://www.gnu.org/licenses/>. - */ - -package moe.nea.sky.mixin.config; - -import com.google.gson.annotations.Expose; -import io.github.moulberry.notenoughupdates.deps.io.github.moulberry.moulconfig.annotations.*; -import io.github.moulberry.notenoughupdates.options.NEUConfig; -import moe.nea.sky.config.HaxConfigNeuConfig; -import moe.nea.sky.config.HaxConfigNeuHax; -import org.jetbrains.annotations.NotNull; -import org.spongepowered.asm.mixin.Mixin; - -@Mixin(NEUConfig.class) -public class MixinHaxConfigNeuConfig implements HaxConfigNeuConfig { - - @Expose - @Category( - name = "NEU Hax", - desc = "NEU Hax specific settings" - ) - public HaxConfigNeuHax neuHax = new HaxConfigNeuHax(); - - @NotNull - @Override - public HaxConfigNeuHax getNeuHax() { - return neuHax; - } -} diff --git a/src/main/java/moe/nea/sky/mixin/config/MixinHaxConfigWorld.java b/src/main/java/moe/nea/sky/mixin/config/MixinHaxConfigWorld.java deleted file mode 100644 index 17705fe..0000000 --- a/src/main/java/moe/nea/sky/mixin/config/MixinHaxConfigWorld.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2022 Linnea Gräf - * - * This file is part of NEUHax. - * - * NEUHax is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * NEUHax 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 General Public License for more details. - * You should have received a copy of the GNU General Public License along with NEUHax. If not, see <https://www.gnu.org/licenses/>. - */ - -package moe.nea.sky.mixin.config; - -import com.google.gson.annotations.Expose; -import io.github.moulberry.notenoughupdates.deps.io.github.moulberry.moulconfig.annotations.*; -import io.github.moulberry.notenoughupdates.options.separatesections.WorldConfig; -import moe.nea.sky.config.HaxConfigWorld; -import org.spongepowered.asm.mixin.Mixin; - -@Mixin(WorldConfig.class) -public class MixinHaxConfigWorld implements HaxConfigWorld { - @ConfigOption(name = "NEU Hax", desc = "NEU Hax enhancements to the world") - @ConfigEditorAccordion(id = 10000) - public boolean neuHaxAccordion = false; - - @Expose - @ConfigOption(name = "Wallhacks", desc = "See highlighted blocks through walls") - @ConfigAccordionId(id = 10000) - @ConfigEditorBoolean - public boolean neuHaxMushroomWallhacks = true; - - @Override - public boolean getNeuHaxWallhacks() { - return this.neuHaxMushroomWallhacks; - } - - @Override - public void setNeuHaxWallhacks(boolean b) { - this.neuHaxMushroomWallhacks = b; - } -} diff --git a/src/main/kotlin/moe/nea/sky/NEUHax.kt b/src/main/kotlin/moe/nea/sky/NEUHax.kt index 6ae49f0..581aff9 100644 --- a/src/main/kotlin/moe/nea/sky/NEUHax.kt +++ b/src/main/kotlin/moe/nea/sky/NEUHax.kt @@ -10,10 +10,10 @@ package moe.nea.sky -import io.github.moulberry.notenoughupdates.NotEnoughUpdates +import io.github.moulberry.moulconfig.managed.ManagedConfig import io.github.moulberry.notenoughupdates.util.brigadier.BrigadierRoot import moe.nea.sky.commands.NEUHaxCommand -import moe.nea.sky.config.HaxConfigNeuConfig +import moe.nea.sky.config.NeuHaxConfig import moe.nea.sky.features.fopt.OptifineCustomItemCache import moe.nea.sky.features.gui.Enchanting import moe.nea.sky.features.gui.Melody @@ -29,6 +29,7 @@ import net.minecraftforge.fml.common.Mod import net.minecraftforge.fml.common.Mod.EventHandler import net.minecraftforge.fml.common.event.FMLInitializationEvent import net.minecraftforge.fml.common.event.FMLPreInitializationEvent +import java.io.File @Mod( @@ -40,7 +41,8 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent object NEUHax { val version: String by lazy { Loader.instance().indexedModList[MODID]!!.version } - val neuHaxConfig get() = (NotEnoughUpdates.INSTANCE.config as HaxConfigNeuConfig).neuHax + + val config by lazy { ManagedConfig.create(File("config/neuhax/config.json"), NeuHaxConfig::class.java) } val deobf by lazy { Launch.blackboard["fml.deobfuscatedEnvironment"] == true } diff --git a/src/main/kotlin/moe/nea/sky/commands/NEUHaxCommand.kt b/src/main/kotlin/moe/nea/sky/commands/NEUHaxCommand.kt index 5c9c298..8075c8d 100644 --- a/src/main/kotlin/moe/nea/sky/commands/NEUHaxCommand.kt +++ b/src/main/kotlin/moe/nea/sky/commands/NEUHaxCommand.kt @@ -10,6 +10,8 @@ package moe.nea.sky.commands +import io.github.moulberry.notenoughupdates.NotEnoughUpdates +import moe.nea.sky.NEUHax import moe.nea.sky.util.showMessage import net.minecraft.command.CommandBase import net.minecraft.command.ICommandSender @@ -35,6 +37,10 @@ object NEUHaxCommand : CommandBase() { override fun processCommand(sender: ICommandSender, args: Array<out String>) { val verb = args.singleOrNull() when (verb) { + "config" -> { + NotEnoughUpdates.INSTANCE.openGui = NEUHax.config.getGui() + } + else -> { sendHelp(sender) } diff --git a/src/main/kotlin/moe/nea/sky/config/EnchantingConfig.kt b/src/main/kotlin/moe/nea/sky/config/EnchantingConfig.kt new file mode 100644 index 0000000..01212cc --- /dev/null +++ b/src/main/kotlin/moe/nea/sky/config/EnchantingConfig.kt @@ -0,0 +1,29 @@ +package moe.nea.sky.config + +import com.google.gson.annotations.Expose +import io.github.moulberry.moulconfig.annotations.Accordion +import io.github.moulberry.moulconfig.annotations.ConfigEditorKeybind +import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider +import io.github.moulberry.moulconfig.annotations.ConfigOption +import org.lwjgl.input.Keyboard + + +class EnchantingConfig { + + @Expose + @ConfigOption(name = "Experimentation Helper", desc = "Helps with experimentations") + @Accordion + val experimentations = Experimentation() + + class Experimentation { + @Expose + @ConfigOption(name = "Auto solve Keybinding", desc = "Press this button to click on the next correct item") + @ConfigEditorKeybind(defaultKey = Keyboard.KEY_SPACE) + var neuHaxSolveKeybinding: Int = Keyboard.KEY_SPACE + + @Expose + @ConfigOption(name = "Auto solve speed", desc = "How fast you can press the button to solve, in milliseconds") + @ConfigEditorSlider(minValue = 0F, maxValue = 500F, minStep = 10F) + var neuHaxTimeout: Int = 50 + } +} diff --git a/src/main/kotlin/moe/nea/sky/config/FishingConfig.kt b/src/main/kotlin/moe/nea/sky/config/FishingConfig.kt new file mode 100644 index 0000000..75bc8b5 --- /dev/null +++ b/src/main/kotlin/moe/nea/sky/config/FishingConfig.kt @@ -0,0 +1,39 @@ +package moe.nea.sky.config + +import com.google.gson.annotations.Expose +import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean +import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider +import io.github.moulberry.moulconfig.annotations.ConfigOption + +class FishingConfig { + + @Expose + @ConfigOption( + name = "Enable Auto Fishing", + desc = "Automatically reel in your fishing rod when something bites. Uses NEU" + ) + @ConfigEditorBoolean + var enableAutoFishing = false + + @Expose + @ConfigOption( + name = "Minimum Delay", + desc = "Minimum delay to wait before reeling in the fish after it gets hooked, in ticks" + ) + @ConfigEditorSlider(minValue = 0F, maxValue = 40F, minStep = 1F) + var autoFishingMinimumDelay: Int = 2 + + @Expose + @ConfigOption( + name = "Maximum Delay", + desc = "Maximum delay to wait before reeling in the fish after it gets hooked, in ticks" + ) + @ConfigEditorSlider(minValue = 0F, maxValue = 40F, minStep = 1F) + var autoFishingMaximumDelay: Int = 10 + + @Expose + @ConfigOption(name = "Reextend Fishing Rod", desc = "Automatically start fishing again after fishing up something") + @ConfigEditorBoolean + var autoFishingReextendFishingRod: Boolean = false + +} diff --git a/src/main/kotlin/moe/nea/sky/config/HaxConfigEnchanting.kt b/src/main/kotlin/moe/nea/sky/config/HaxConfigEnchanting.kt deleted file mode 100644 index d8a6364..0000000 --- a/src/main/kotlin/moe/nea/sky/config/HaxConfigEnchanting.kt +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2022 Linnea Gräf - * - * This file is part of NEUHax. - * - * NEUHax is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * NEUHax 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 General Public License for more details. - * You should have received a copy of the GNU General Public License along with NEUHax. If not, see <https://www.gnu.org/licenses/>. - */ - -package moe.nea.sky.config - -interface HaxConfigEnchanting { - val neuHaxSolveKeybinding: Int - val neuHaxTimeout: Int -}
\ No newline at end of file diff --git a/src/main/kotlin/moe/nea/sky/config/HaxConfigFishing.kt b/src/main/kotlin/moe/nea/sky/config/HaxConfigFishing.kt deleted file mode 100644 index 98f33eb..0000000 --- a/src/main/kotlin/moe/nea/sky/config/HaxConfigFishing.kt +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2022 Linnea Gräf - * - * This file is part of NEUHax. - * - * NEUHax is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * NEUHax 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 General Public License for more details. - * You should have received a copy of the GNU General Public License along with NEUHax. If not, see <https://www.gnu.org/licenses/>. - */ - -package moe.nea.sky.config - -interface HaxConfigFishing { - val neuHaxAutoFishEnable: Boolean - // TODO: val neuHaxAutoFishToggleButton: Int - val neuHaxAutoFishDelayMinimum: Int - val neuHaxAutoFishDelayMaximum: Int - val neuHaxReengageFishingRod: Boolean -}
\ No newline at end of file diff --git a/src/main/kotlin/moe/nea/sky/config/HaxConfigNeuConfig.kt b/src/main/kotlin/moe/nea/sky/config/HaxConfigNeuConfig.kt deleted file mode 100644 index 31eda8b..0000000 --- a/src/main/kotlin/moe/nea/sky/config/HaxConfigNeuConfig.kt +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (C) 2022 Linnea Gräf - * - * This file is part of NEUHax. - * - * NEUHax is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * NEUHax 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 General Public License for more details. - * You should have received a copy of the GNU General Public License along with NEUHax. If not, see <https://www.gnu.org/licenses/>. - */ - -package moe.nea.sky.config - -interface HaxConfigNeuConfig { - val neuHax: HaxConfigNeuHax -}
\ No newline at end of file diff --git a/src/main/kotlin/moe/nea/sky/config/HaxConfigNeuHax.kt b/src/main/kotlin/moe/nea/sky/config/HaxConfigNeuHax.kt deleted file mode 100644 index 7d57688..0000000 --- a/src/main/kotlin/moe/nea/sky/config/HaxConfigNeuHax.kt +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2022 Linnea Gräf - * - * This file is part of NEUHax. - * - * NEUHax is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * NEUHax 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 General Public License for more details. - * You should have received a copy of the GNU General Public License along with NEUHax. If not, see <https://www.gnu.org/licenses/>. - */ - -package moe.nea.sky.config - -import com.google.gson.annotations.Expose -import io.github.moulberry.notenoughupdates.deps.io.github.moulberry.moulconfig.annotations.* -import org.lwjgl.input.Keyboard - -class HaxConfigNeuHax { - - @Expose - @ConfigOption( - name = "Auto Melody", - desc = "Automatically play back melody songs" - ) - @ConfigEditorBoolean - @JvmField - var autoMelody: Boolean = false - - @ConfigOption(name = "Yaw Snapping", desc = "") - @ConfigEditorAccordion(id = 6) - @JvmField - var yawSnappingAccordion = false - - @Expose - @ConfigOption(name = "Enable Yaw Snapping", desc = "Align your yaw with certain angles") - @ConfigEditorBoolean - @JvmField - @ConfigAccordionId(id = 6) - var yawSnapping = false - - @Expose - @ConfigOption(name = "Release Distance", desc = "How much you have to overshoot an angle to release yaw snapping") - @ConfigEditorSlider(minValue = 0F, maxValue = 180F, minStep = 1F) - @ConfigAccordionId(id = 6) - @JvmField - var yawTightness = 90f - - @Expose - @ConfigOption(name = "Intervals", desc = "In which intervals do you want to enable yaw snapping (45°, 90°, etc.)") - @ConfigEditorSlider(minValue = 1F, maxValue = 180F, minStep = 1F) - @ConfigAccordionId(id = 6) - @JvmField - var yawIntervals = 45f - - @JvmField - @Expose - @ConfigOption(name = "Yaw Overlay", desc = "Display your current yaw over your cursor") - @ConfigEditorBoolean - @ConfigAccordionId(id = 6) - var displayYawOverlay = true - - @JvmField - @Expose - @ConfigOption(name = "Yaw Snapping Keybinding", desc = "Press to toggle yaw snapping") - @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE) - @ConfigAccordionId(id = 6) - var yawSnappingKeybinding = Keyboard.KEY_NONE -}
\ No newline at end of file diff --git a/src/main/kotlin/moe/nea/sky/config/HaxConfigWorld.kt b/src/main/kotlin/moe/nea/sky/config/HaxConfigWorld.kt deleted file mode 100644 index d4c654f..0000000 --- a/src/main/kotlin/moe/nea/sky/config/HaxConfigWorld.kt +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (C) 2022 Linnea Gräf - * - * This file is part of NEUHax. - * - * NEUHax is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * NEUHax 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 General Public License for more details. - * You should have received a copy of the GNU General Public License along with NEUHax. If not, see <https://www.gnu.org/licenses/>. - */ - -package moe.nea.sky.config - -interface HaxConfigWorld { - var neuHaxWallhacks: Boolean -}
\ No newline at end of file diff --git a/src/main/kotlin/moe/nea/sky/config/MetaConfig.kt b/src/main/kotlin/moe/nea/sky/config/MetaConfig.kt new file mode 100644 index 0000000..1ab9ad4 --- /dev/null +++ b/src/main/kotlin/moe/nea/sky/config/MetaConfig.kt @@ -0,0 +1,14 @@ +package moe.nea.sky.config + +import com.google.gson.annotations.Expose +import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean +import io.github.moulberry.moulconfig.annotations.ConfigOption + +class MetaConfig { + + @Expose + @ConfigOption(name = "Check for Updates", desc = "Check for updates on startup") + @ConfigEditorBoolean + val enableAutoUpdateCheck = true + +} diff --git a/src/main/kotlin/moe/nea/sky/config/MiscellaneousConfig.kt b/src/main/kotlin/moe/nea/sky/config/MiscellaneousConfig.kt new file mode 100644 index 0000000..440be10 --- /dev/null +++ b/src/main/kotlin/moe/nea/sky/config/MiscellaneousConfig.kt @@ -0,0 +1,50 @@ +package moe.nea.sky.config + +import com.google.gson.annotations.Expose +import io.github.moulberry.moulconfig.annotations.* +import org.lwjgl.input.Keyboard + +class MiscellaneousConfig { + @Accordion + @ConfigOption(name = "Yaw Snapping", desc = "") + val yawSnapping = YawSnappingConfig() + + class YawSnappingConfig { + @Expose + @ConfigOption(name = "Enable Yaw Snapping", desc = "Align your yaw with certain angles") + @ConfigEditorBoolean + var yawSnapping = false + + @Expose + @ConfigOption( + name = "Release Distance", + desc = "How much you have to overshoot an angle to release yaw snapping" + ) + @ConfigEditorSlider(minValue = 0F, maxValue = 180F, minStep = 1F) + var yawTightness = 90f + + @Expose + @ConfigOption( + name = "Intervals", + desc = "In which intervals do you want to enable yaw snapping (45°, 90°, etc.)" + ) + @ConfigEditorSlider(minValue = 1F, maxValue = 180F, minStep = 1F) + var yawIntervals = 45f + + @Expose + @ConfigOption(name = "Yaw Overlay", desc = "Display your current yaw over your cursor") + @ConfigEditorBoolean + var displayYawOverlay = true + + @Expose + @ConfigOption(name = "Yaw Snapping Keybinding", desc = "Press to toggle yaw snapping") + @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE) + var yawSnappingKeybinding = Keyboard.KEY_NONE + + } + + @ConfigOption(name = "Auto Melody", desc = "Automatically click inside the melody GUI for you") + @Expose + @ConfigEditorBoolean + var autoMelody = false +} diff --git a/src/main/kotlin/moe/nea/sky/config/NeuHaxConfig.kt b/src/main/kotlin/moe/nea/sky/config/NeuHaxConfig.kt new file mode 100644 index 0000000..d418464 --- /dev/null +++ b/src/main/kotlin/moe/nea/sky/config/NeuHaxConfig.kt @@ -0,0 +1,27 @@ +package moe.nea.sky.config + +import com.google.gson.annotations.Expose +import io.github.moulberry.moulconfig.Config +import io.github.moulberry.moulconfig.annotations.Category + +class NeuHaxConfig : Config() { + @Category(name = "Misc", desc = "Misc macros") + @Expose + val meta = MetaConfig() + @Category(name = "Fishing", desc = "Fishing features") + @Expose + val fishing = FishingConfig() + @Category(name = "Enchanting", desc = "Enchanting features") + @Expose + val enchanting = EnchantingConfig() + @Category(name = "Wallhacks", desc = "Misc macros") + @Expose + val wallhacks = WallhackConfig() + @Category(name = "Misc", desc = "Misc macros") + @Expose + val miscellaneous = MiscellaneousConfig() + + override fun getTitle(): String { + return "§ZThe most legitimate NEU features available this side of the danube" + } +}
\ No newline at end of file diff --git a/src/main/kotlin/moe/nea/sky/config/WallhackConfig.kt b/src/main/kotlin/moe/nea/sky/config/WallhackConfig.kt new file mode 100644 index 0000000..6b2db13 --- /dev/null +++ b/src/main/kotlin/moe/nea/sky/config/WallhackConfig.kt @@ -0,0 +1,12 @@ +package moe.nea.sky.config + +import com.google.gson.annotations.Expose +import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean +import io.github.moulberry.moulconfig.annotations.ConfigOption + +class WallhackConfig { + @Expose + @ConfigOption(name = "NEU World Wallhacks", desc = "Wallhacks for the neu world renderer") + @ConfigEditorBoolean + var neuWorld = false +} diff --git a/src/main/kotlin/moe/nea/sky/features/gui/Enchanting.kt b/src/main/kotlin/moe/nea/sky/features/gui/Enchanting.kt index 6737806..75b9e7c 100644 --- a/src/main/kotlin/moe/nea/sky/features/gui/Enchanting.kt +++ b/src/main/kotlin/moe/nea/sky/features/gui/Enchanting.kt @@ -12,7 +12,7 @@ package moe.nea.sky.features.gui import io.github.moulberry.notenoughupdates.NotEnoughUpdates import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers -import moe.nea.sky.config.HaxConfigEnchanting +import moe.nea.sky.NEUHax import moe.nea.sky.util.TimedBackoff import moe.nea.sky.util.middleClickOn import net.minecraft.client.gui.inventory.GuiChest @@ -47,7 +47,7 @@ object Enchanting { val containerIndex: Int } - val config get() = NotEnoughUpdates.INSTANCE.config.enchantingSolvers as HaxConfigEnchanting + val config get() = NEUHax.config.instance.enchanting.experimentations val timer = TimedBackoff() diff --git a/src/main/kotlin/moe/nea/sky/features/gui/Melody.kt b/src/main/kotlin/moe/nea/sky/features/gui/Melody.kt index 033d0e1..7bcf9e5 100644 --- a/src/main/kotlin/moe/nea/sky/features/gui/Melody.kt +++ b/src/main/kotlin/moe/nea/sky/features/gui/Melody.kt @@ -29,7 +29,7 @@ object Melody { @SubscribeEvent fun onGuiTick(event: ClientTickEvent) { - if (!NEUHax.neuHaxConfig.autoMelody) return + if (!NEUHax.config.instance.miscellaneous.autoMelody) return if (event.phase == TickEvent.Phase.START) return val guiChest = mc.currentScreen as? GuiChest ?: return val content = guiChest.inventorySlots as? ContainerChest ?: return diff --git a/src/main/kotlin/moe/nea/sky/features/meta/AutoUpdate.kt b/src/main/kotlin/moe/nea/sky/features/meta/AutoUpdate.kt index 2dff1f6..6ff6e64 100644 --- a/src/main/kotlin/moe/nea/sky/features/meta/AutoUpdate.kt +++ b/src/main/kotlin/moe/nea/sky/features/meta/AutoUpdate.kt @@ -14,6 +14,7 @@ import moe.nea.sky.util.showMessage import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent import java.util.concurrent.CompletableFuture +import kotlin.properties.Delegates object AutoUpdate { val updater = UpdateContext( @@ -28,16 +29,16 @@ object AutoUpdate { } var potentialUpdate = updater.checkUpdate("") - var notified = false + var shouldNotify = NEUHax.config.instance.meta.enableAutoUpdateCheck var notifyNonUpdate = false @SubscribeEvent fun onFirstPlayerInteraction(event: TickEvent.ClientTickEvent) { - if (notified) return + if (!shouldNotify) return if (event.phase != TickEvent.Phase.START) return val p = MC.thePlayer ?: return val update = potentialUpdate.getNow(null) ?: return - notified = true + shouldNotify = false if (!update.isUpdateAvailable && notifyNonUpdate) { p.showMessage { text("§eNo update found.") @@ -61,7 +62,7 @@ object AutoUpdate { event.command("nhupdate") { thenExecute { potentialUpdate = updater.checkUpdate("") - notified = false + shouldNotify = true notifyNonUpdate = true } }.withHelp("Update NEUHAX") diff --git a/src/main/kotlin/moe/nea/sky/features/world/AutoFishing.kt b/src/main/kotlin/moe/nea/sky/features/world/AutoFishing.kt index 487f64d..3955a0e 100644 --- a/src/main/kotlin/moe/nea/sky/features/world/AutoFishing.kt +++ b/src/main/kotlin/moe/nea/sky/features/world/AutoFishing.kt @@ -11,9 +11,8 @@ package moe.nea.sky.features.world import cc.polyfrost.oneconfig.utils.dsl.mc -import io.github.moulberry.notenoughupdates.NotEnoughUpdates import io.github.moulberry.notenoughupdates.miscfeatures.FishingHelper -import moe.nea.sky.config.HaxConfigFishing +import moe.nea.sky.NEUHax import net.minecraft.entity.projectile.EntityFishHook import net.minecraft.init.Items import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -28,18 +27,18 @@ import kotlin.random.Random */ object AutoFishing { - val config get() = NotEnoughUpdates.INSTANCE.config.fishing as HaxConfigFishing + val config get() = NEUHax.config.instance.fishing private fun randomDelay() = Random.Default.nextInt( - config.neuHaxAutoFishDelayMinimum, - config.neuHaxAutoFishDelayMaximum.coerceAtLeast(config.neuHaxAutoFishDelayMinimum) + config.autoFishingMinimumDelay, + config.autoFishingMaximumDelay.coerceAtLeast(config.autoFishingMinimumDelay) ) private var delay = -1 private var shouldReengage = false private var lastFishingHook: EntityFishHook? = null private fun shouldAutoFish(): Boolean { - if (!config.neuHaxAutoFishEnable) + if (!config.enableAutoFishing) return false if (delay == 0) { delay = -1 @@ -73,7 +72,7 @@ object AutoFishing { if (lastFishingHook != p.fishEntity && p.fishEntity != null && shouldAutoFish()) { mc.playerController.sendUseItem(p, p.worldObj, p.heldItem) lastFishingHook = p.fishEntity - if (config.neuHaxReengageFishingRod) { + if (config.autoFishingReextendFishingRod) { shouldReengage = true } } diff --git a/src/main/kotlin/moe/nea/sky/features/world/YawSnapping.kt b/src/main/kotlin/moe/nea/sky/features/world/YawSnapping.kt index 0f41467..a2fbf6a 100644 --- a/src/main/kotlin/moe/nea/sky/features/world/YawSnapping.kt +++ b/src/main/kotlin/moe/nea/sky/features/world/YawSnapping.kt @@ -29,16 +29,16 @@ import kotlin.math.sign object YawSnapping { - fun isEnabled(): Boolean = - /*LorenzUtils.inSkyBlock && // */ - NEUHax.neuHaxConfig.yawSnapping + val config get() = NEUHax.config.instance.miscellaneous.yawSnapping + fun isEnabled(): Boolean = config.yawSnapping + var overshot = 0F var isLocking = false private val snapPoints get() = - generateSequence(0F) { it + NEUHax.neuHaxConfig.yawIntervals } + generateSequence(0F) { it + config.yawIntervals } .takeWhile { it <= 360 } @@ -46,8 +46,8 @@ object YawSnapping { fun onKeybind(event: KeyInputEvent) { if (!Keyboard.getEventKeyState()) return - if (event.getEffectiveKeyCode() == NEUHax.neuHaxConfig.yawSnappingKeybinding) { - NEUHax.neuHaxConfig.yawSnapping = !NEUHax.neuHaxConfig.yawSnapping + if (event.getEffectiveKeyCode() == config.yawSnappingKeybinding) { + config.yawSnapping = !config.yawSnapping showPlayerMessage { text("Yaw Snapping ${if (isEnabled()) "${GREEN}Enabled" else "${RED}Disabled"}") } @@ -57,7 +57,7 @@ object YawSnapping { @SubscribeEvent fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (!isEnabled()) return - if (!NEUHax.neuHaxConfig.displayYawOverlay) return + if (!config.displayYawOverlay) return if (event.type != RenderGameOverlayEvent.ElementType.ALL) return val sr = ScaledResolution(Minecraft.getMinecraft()) GlStateManager.pushMatrix() @@ -98,7 +98,7 @@ object YawSnapping { } } if (isLocking) { - val overshotPos = overshot * 200 / NEUHax.neuHaxConfig.yawTightness + val overshotPos = overshot * 200 / config.yawTightness Gui.drawRect( overshotPos.toInt(), font.FONT_HEIGHT / 2, @@ -120,7 +120,7 @@ object YawSnapping { } if (isLocking) { overshot += event.yawDelta - if (overshot.absoluteValue > NEUHax.neuHaxConfig.yawTightness) { + if (overshot.absoluteValue > config.yawTightness) { isLocking = false } else { event.isCanceled = true |