From b1c713ca9b25784c8cd00d8ab6a4c09338a5167f Mon Sep 17 00:00:00 2001 From: desyncfy Date: Wed, 3 Jul 2024 07:21:42 -0700 Subject: [PATCH] Disable functions if you aren't playing Dungeonfy ATTEMPT 2 --- .../kotlin/chickenmanfy/scify/SciFyClient.kt | 18 +++------ .../chickenmanfy/scify/modules/AutoWelcome.kt | 12 +++++- .../kotlin/chickenmanfy/scify/modules/Bars.kt | 37 +++++++++++-------- .../scify/modules/FishingNotif.kt | 12 +++++- .../chickenmanfy/scify/modules/LivelyMode.kt | 12 +++++- 5 files changed, 58 insertions(+), 33 deletions(-) diff --git a/src/client/kotlin/chickenmanfy/scify/SciFyClient.kt b/src/client/kotlin/chickenmanfy/scify/SciFyClient.kt index 21756ac..ed69546 100644 --- a/src/client/kotlin/chickenmanfy/scify/SciFyClient.kt +++ b/src/client/kotlin/chickenmanfy/scify/SciFyClient.kt @@ -2,23 +2,17 @@ package chickenmanfy.scify import chickenmanfy.scify.modules.* // woo fancy import all modules import net.fabricmc.api.ClientModInitializer -import net.minecraft.client.MinecraftClient object SciFyClient : ClientModInitializer { val debugUser = "Chickenmanfy" override fun onInitializeClient() { + + // Run the Modules Hotkey().hotkeys() - // Run the modules - if (MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "dungeonfy.minehut.gg" || - MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "51.222.121.148:25599" || - MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "minehut.com" || // if you join minehut.com and type /join dungeonfy - MinecraftClient.getInstance().player?.name?.string == debugUser) // Test override - { - AutoWelcome().autoWelcome() - FishingNotif().fishingNotif() - Bars().bars() - //LivelyMode().livelyMode() - } + AutoWelcome().autoWelcome() + FishingNotif().fishingNotif() + Bars().bars() + //LivelyMode().livelyMode() } } diff --git a/src/client/kotlin/chickenmanfy/scify/modules/AutoWelcome.kt b/src/client/kotlin/chickenmanfy/scify/modules/AutoWelcome.kt index 95412ff..d7726f7 100644 --- a/src/client/kotlin/chickenmanfy/scify/modules/AutoWelcome.kt +++ b/src/client/kotlin/chickenmanfy/scify/modules/AutoWelcome.kt @@ -1,5 +1,8 @@ package chickenmanfy.scify.modules +import chickenmanfy.scify.SciFyClient.debugUser +import net.minecraft.client.MinecraftClient + var autoWelcomeToggle: Boolean = false class AutoWelcome { fun toggleAutoWelcome() { @@ -7,8 +10,13 @@ class AutoWelcome { } fun autoWelcome() { - if (autoWelcomeToggle) { - return + if (MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "dungeonfy.minehut.gg" || + MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "51.222.121.148:25599" || + MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "minehut.com" || // if you join minehut.com and type /join dungeonfy + MinecraftClient.getInstance().player?.name?.string == debugUser) { + if (autoWelcomeToggle) { + return + } } } } \ No newline at end of file diff --git a/src/client/kotlin/chickenmanfy/scify/modules/Bars.kt b/src/client/kotlin/chickenmanfy/scify/modules/Bars.kt index 758a78e..4adaf80 100644 --- a/src/client/kotlin/chickenmanfy/scify/modules/Bars.kt +++ b/src/client/kotlin/chickenmanfy/scify/modules/Bars.kt @@ -1,7 +1,9 @@ package chickenmanfy.scify.modules +import chickenmanfy.scify.SciFyClient.debugUser import com.mojang.blaze3d.systems.RenderSystem import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback +import net.minecraft.client.MinecraftClient import net.minecraft.client.gui.DrawContext import net.minecraft.client.render.* import net.minecraft.util.Identifier @@ -13,23 +15,28 @@ class Bars { } fun bars() { - HudRenderCallback.EVENT.register(HudRenderCallback { drawContext: DrawContext?, tickDelta: Float -> - val tessellator: Tessellator = Tessellator.getInstance() - val buffer: BufferBuilder = tessellator.buffer - val positionMatrix = drawContext?.matrices?.peek()?.positionMatrix - if (barsToggle) { - buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE) - buffer.vertex(positionMatrix, 20F, 20F, 0F).color(1f, 1f, 1f, 1f).texture(0f, 0f).next() - buffer.vertex(positionMatrix, 20F, 60F, 0F).color(1f, 1f, 1f, 1f).texture(0f, 1f).next() - buffer.vertex(positionMatrix, 60F, 60F, 0F).color(1f, 1f, 1f, 1f).texture(1f, 1f).next() - buffer.vertex(positionMatrix, 60F, 20F, 0F).color(1f, 1f, 1f, 1f).texture(1f, 0f).next() + if (MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "dungeonfy.minehut.gg" || + MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "51.222.121.148:25599" || + MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "minehut.com" || // if you join minehut.com and type /join dungeonfy + MinecraftClient.getInstance().player?.name?.string == debugUser) { + HudRenderCallback.EVENT.register(HudRenderCallback { drawContext: DrawContext?, tickDelta: Float -> + val tessellator: Tessellator = Tessellator.getInstance() + val buffer: BufferBuilder = tessellator.buffer + val positionMatrix = drawContext?.matrices?.peek()?.positionMatrix + if (barsToggle) { + buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE) + buffer.vertex(positionMatrix, 20F, 20F, 0F).color(1f, 1f, 1f, 1f).texture(0f, 0f).next() + buffer.vertex(positionMatrix, 20F, 60F, 0F).color(1f, 1f, 1f, 1f).texture(0f, 1f).next() + buffer.vertex(positionMatrix, 60F, 60F, 0F).color(1f, 1f, 1f, 1f).texture(1f, 1f).next() + buffer.vertex(positionMatrix, 60F, 20F, 0F).color(1f, 1f, 1f, 1f).texture(1f, 0f).next() - RenderSystem.setShader { GameRenderer.getPositionColorTexProgram() } - RenderSystem.setShaderTexture(0, Identifier("scify", "scify.png")) - RenderSystem.setShaderColor(1f, 1f, 1f, 1f) + RenderSystem.setShader { GameRenderer.getPositionColorTexProgram() } + RenderSystem.setShaderTexture(0, Identifier("scify", "scify.png")) + RenderSystem.setShaderColor(1f, 1f, 1f, 1f) - tessellator.draw() + tessellator.draw() + } + }) } - }) } } \ No newline at end of file diff --git a/src/client/kotlin/chickenmanfy/scify/modules/FishingNotif.kt b/src/client/kotlin/chickenmanfy/scify/modules/FishingNotif.kt index 974f661..bff4643 100644 --- a/src/client/kotlin/chickenmanfy/scify/modules/FishingNotif.kt +++ b/src/client/kotlin/chickenmanfy/scify/modules/FishingNotif.kt @@ -1,5 +1,8 @@ package chickenmanfy.scify.modules +import chickenmanfy.scify.SciFyClient.debugUser +import net.minecraft.client.MinecraftClient + var fishingToggle: Boolean = false class FishingNotif { // Fishing Notification Toggle @@ -12,8 +15,13 @@ class FishingNotif { // toggleFishingNotif() fun fishingNotif() { - if (fishingToggle) { - return + if (MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "dungeonfy.minehut.gg" || + MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "51.222.121.148:25599" || + MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "minehut.com" || // if you join minehut.com and type /join dungeonfy + MinecraftClient.getInstance().player?.name?.string == debugUser) { + if (fishingToggle) { + return + } } } } \ No newline at end of file diff --git a/src/client/kotlin/chickenmanfy/scify/modules/LivelyMode.kt b/src/client/kotlin/chickenmanfy/scify/modules/LivelyMode.kt index f787eb3..b79b2d7 100644 --- a/src/client/kotlin/chickenmanfy/scify/modules/LivelyMode.kt +++ b/src/client/kotlin/chickenmanfy/scify/modules/LivelyMode.kt @@ -1,5 +1,8 @@ package chickenmanfy.scify.modules +import chickenmanfy.scify.SciFyClient.debugUser +import net.minecraft.client.MinecraftClient + var livelyModeToggle: Boolean = false class LivelyMode { fun toggleLivelyMode() { @@ -7,8 +10,13 @@ class LivelyMode { } fun livelyMode() { - if (livelyModeToggle) { - return + if (MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "dungeonfy.minehut.gg" || + MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "51.222.121.148:25599" || + MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "minehut.com" || // if you join minehut.com and type /join dungeonfy + MinecraftClient.getInstance().player?.name?.string == debugUser) { + if (livelyModeToggle) { + return + } } } } \ No newline at end of file