diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-10 03:17:06 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-10 03:17:06 +0100 |
commit | 6261932897d45407964f1d6024a5c75a0ed2b8b5 (patch) | |
tree | 774e2ab0a1683c76ab8423b3df98faf313529ac5 /src/main | |
parent | 158693dc3fc2605889cde4c981fd0463f1738a9a (diff) | |
download | skyhanni-6261932897d45407964f1d6024a5c75a0ed2b8b5.tar.gz skyhanni-6261932897d45407964f1d6024a5c75a0ed2b8b5.tar.bz2 skyhanni-6261932897d45407964f1d6024a5c75a0ed2b8b5.zip |
Added option to toggle WorldEdit in the dev category.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/dev/DevConfig.java | 5 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/WorldEdit.kt | 15 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dev/DevConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DevConfig.java index 6a2ee9708..8b7b924b5 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/dev/DevConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DevConfig.java @@ -39,6 +39,11 @@ public class DevConfig { @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE) public int showSlotNumberKey = Keyboard.KEY_NONE; + @Expose + @ConfigOption(name = "World Edit", desc = "Use wood axe or command /shworldedit to render a box, similar like the WorldEdit plugin.") + @ConfigEditorBoolean + public boolean worldEdit = false; + @ConfigOption(name = "Parkour Waypoints", desc = "") @Accordion @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/test/WorldEdit.kt b/src/main/java/at/hannibal2/skyhanni/test/WorldEdit.kt index 8a26e474c..26ac4d9a7 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/WorldEdit.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/WorldEdit.kt @@ -1,7 +1,9 @@ package at.hannibal2.skyhanni.test +import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.events.BlockClickEvent +import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.utils.ClipboardUtils import at.hannibal2.skyhanni.utils.LocationUtils @@ -12,7 +14,6 @@ import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getItemId import net.minecraft.util.AxisAlignedBB import net.minecraft.util.BlockPos import net.minecraftforge.client.event.RenderWorldLastEvent -import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color @@ -50,7 +51,9 @@ object WorldEdit { @SubscribeEvent fun onBlockClick(event: BlockClickEvent) { + if (!isEnabled()) return if (event.itemInHand?.getItemId() != "WOOD_AXE") return + if (event.clickType == ClickType.LEFT_CLICK) { leftPos = event.position.toBlockPos() } else if (event.clickType == ClickType.RIGHT_CLICK) { @@ -59,13 +62,15 @@ object WorldEdit { } @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { + fun onWorldChange(event: LorenzWorldChangeEvent) { leftPos = null rightPos = null } @SubscribeEvent fun onRenderWorldLast(event: RenderWorldLastEvent) { + if (!isEnabled()) return + leftPos?.let { l -> RenderUtils.drawWireframeBoundingBox_nea( funAABB(l, l).expandBlock(), @@ -91,6 +96,10 @@ object WorldEdit { } fun command(it: Array<String>) { + if (!isEnabled()) { + LorenzUtils.userError("World Edit is disabled in the config. Enable it if you want to use it.") + return + } when (it.firstOrNull()) { null, "help" -> { LorenzUtils.chat("Use a wood axe and left/right click to select a region in the world. Then use /shworldedit copy or /shworldedit reset.") @@ -122,4 +131,6 @@ object WorldEdit { } } } + + fun isEnabled() = SkyHanniMod.feature.dev.worldEdit } |