diff options
9 files changed, 37 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 42416c69d..7d21fa92e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -195,6 +195,10 @@ object Commands { "Prints the SkyHanni version in the chat" ) { SkyHanniDebugsAndTests.debugVersion() } registerCommand( + "shrendertoggle", + "Disables/enables the rendering of all skyhanni guis." + ) { SkyHanniDebugsAndTests.toggleRender() } + registerCommand( "shcarrot", "Toggles receiving the 12 fortune from carrots" ) { CaptureFarmingGear.reverseCarrotFortune() } diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt index 2201ffd8b..69cbb0dd3 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.config.core.config.gui.GuiPositionEditor import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzKeyPressEvent +import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isRancherSign import at.hannibal2.skyhanni.utils.NEUItems @@ -65,6 +66,7 @@ class GuiEditManager { @JvmStatic fun renderLast() { if (!isInGui()) return + if (!SkyHanniDebugsAndTests.globalRenderToggle) return GlStateManager.translate(0f, 0f, 200f) diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt index 30f2b51b7..f48829e22 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.GuiRenderItemEvent import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.mixins.transformers.gui.AccessorGuiContainer +import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.drawSlotText @@ -39,6 +40,7 @@ class ItemTipHelper { @SubscribeEvent(priority = EventPriority.HIGHEST) fun onRenderInventoryItemOverlayPost(event: DrawScreenAfterEvent) { if (!LorenzUtils.inSkyBlock) return + if (!SkyHanniDebugsAndTests.globalRenderToggle) return val gui = Minecraft.getMinecraft().currentScreen if (gui !is GuiChest) return diff --git a/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt b/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt index 1d7a544ca..6479816ef 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI +import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.client.gui.inventory.GuiInventory @@ -15,6 +16,7 @@ class RenderGuiData { @SubscribeEvent fun onRenderOverlay(event: RenderGameOverlayEvent.Pre) { if (event.type != RenderGameOverlayEvent.ElementType.HOTBAR) return + if (!SkyHanniDebugsAndTests.globalRenderToggle) return if (GuiEditManager.isInGui() || FFGuideGUI.isInGui()) return GuiRenderEvent.GuiOverlayRenderEvent().postAndCatch() @@ -22,6 +24,7 @@ class RenderGuiData { @SubscribeEvent fun onBackgroundDraw(event: GuiScreenEvent.BackgroundDrawnEvent) { + if (!SkyHanniDebugsAndTests.globalRenderToggle) return if (GuiEditManager.isInGui() || FFGuideGUI.isInGui()) return val currentScreen = Minecraft.getMinecraft().currentScreen ?: return if (currentScreen !is GuiInventory && currentScreen !is GuiChest) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt index 59ecd2724..427a49ba2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.data.FriendAPI import at.hannibal2.skyhanni.data.GuildAPI import at.hannibal2.skyhanni.data.PartyAPI import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager +import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -114,7 +115,10 @@ object AdvancedPlayerList { return newList } - fun ignoreCustomTabList() = SkyHanniMod.feature.dev.debugEnabled && KeyboardManager.isControlKeyDown() + fun ignoreCustomTabList(): Boolean { + val denyKeyPressed = SkyHanniMod.feature.dev.debugEnabled && KeyboardManager.isControlKeyDown() + return denyKeyPressed || !SkyHanniDebugsAndTests.globalRenderToggle + } private val listOfSkyHanniDevsOrPeopeWhoKnowALotAboutModdingSeceneButAreBadInCoding = listOf( "hannibal2", diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt index 5b41f87c2..136ce8b11 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.events.DrawScreenAfterEvent import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiContainerEvent.CloseWindowEvent import at.hannibal2.skyhanni.events.GuiContainerEvent.SlotClickEvent +import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import net.minecraft.client.gui.inventory.GuiContainer import net.minecraft.inventory.Slot import org.spongepowered.asm.mixin.injection.callback.CallbackInfo @@ -21,6 +22,7 @@ class GuiContainerHook(guiAny: Any) { } fun backgroundDrawn(mouseX: Int, mouseY: Int, partialTicks: Float) { + if (!SkyHanniDebugsAndTests.globalRenderToggle) return GuiContainerEvent.BackgroundDrawnEvent(gui, gui.inventorySlots, mouseX, mouseY, partialTicks).postAndCatch() } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt index ae9b02354..d65d36cdd 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.mixins.hooks import at.hannibal2.skyhanni.events.GuiRenderItemEvent import at.hannibal2.skyhanni.events.RenderRealOverlayEvent +import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import net.minecraft.client.gui.FontRenderer import net.minecraft.item.ItemStack @@ -12,6 +13,7 @@ fun renderItemOverlayPost( yPosition: Int, text: String?, ) { + if (!SkyHanniDebugsAndTests.globalRenderToggle) return GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost( fr, stack, @@ -22,5 +24,6 @@ fun renderItemOverlayPost( } fun renderItemReturn(stack: ItemStack, x: Int, y: Int) { + if (!SkyHanniDebugsAndTests.globalRenderToggle) return RenderRealOverlayEvent(stack, x, y).postAndCatch() } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt index 805b48af2..060de8d3e 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.mixins.hooks import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.RenderMobColoredEvent import at.hannibal2.skyhanni.events.ResetEntityHurtEvent +import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import net.minecraft.entity.EntityLivingBase import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -40,6 +41,7 @@ class RenderLivingEntityHelper { } fun <T : EntityLivingBase> setColorMultiplier(entity: T): Int { + if (!SkyHanniDebugsAndTests.globalRenderToggle) return 0 if (entityColorMap.containsKey(entity)) { val condition = entityColorCondition[entity]!! if (condition.invoke()) { @@ -48,12 +50,14 @@ class RenderLivingEntityHelper { } //TODO remove event + if (!SkyHanniDebugsAndTests.globalRenderToggle) return 0 val event = RenderMobColoredEvent(entity, 0) event.postAndCatch() return event.color } fun <T : EntityLivingBase> changeHurtTime(entity: T): Int { + if (!SkyHanniDebugsAndTests.globalRenderToggle) return 0 if (entityNoHurTime.contains(entity)) { val condition = entityNoHurTimeCondition[entity]!! if (condition.invoke()) { diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index 6e2d2d1ab..9d4363b9b 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -43,6 +43,8 @@ class SkyHanniDebugsAndTests { var displayLine = "" var displayList = emptyList<List<Any>>() + var globalRenderToggle = true + var a = 1.0 var b = 60.0 var c = 0.0 @@ -211,6 +213,7 @@ class SkyHanniDebugsAndTests { builder.append("player name: '${LorenzUtils.getPlayerName()}'\n") builder.append("player uuid: '${LorenzUtils.getPlayerUuid()}'\n") builder.append("repoAutoUpdate: ${config.repoAutoUpdate}\n") + builder.append("globalRenderToggle: ${globalRenderToggle}\n") builder.append("\n") builder.append("onHypixel: ${LorenzUtils.onHypixel}\n") @@ -264,6 +267,15 @@ class SkyHanniDebugsAndTests { OSUtils.copyToClipboard(rawInternalName) LorenzUtils.chat("§eCopied internal name §7$rawInternalName §eto the clipboard!") } + + fun toggleRender() { + globalRenderToggle = !globalRenderToggle + if (globalRenderToggle) { + LorenzUtils.chat("§e[SkyHanni] §cEnabled global render toggle! Run this command again to show SkyHanni elements again.") + } else { + LorenzUtils.chat("§e[SkyHanni] §aDisabled global render toggle!") + } + } } @SubscribeEvent |