aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2021-05-01 17:25:46 -0400
committerMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2021-05-01 17:25:46 -0400
commit31047dfb3ec31ac262211d0f93acf243894f9622 (patch)
treee4958fea50c9263c8ce50fb4e1cef9456bed2b7e /src/main
parente7d55fb6186e60d917872bfa0038183312bcce33 (diff)
downloadSkytilsMod-31047dfb3ec31ac262211d0f93acf243894f9622.tar.gz
SkytilsMod-31047dfb3ec31ac262211d0f93acf243894f9622.tar.bz2
SkytilsMod-31047dfb3ec31ac262211d0f93acf243894f9622.zip
highlight disabled effects, hide effects in inv
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/skytils/skytilsmod/mixins/MixinInventoryEffectRenderer.java35
-rw-r--r--src/main/kotlin/skytils/skytilsmod/core/Config.kt19
-rw-r--r--src/main/kotlin/skytils/skytilsmod/features/impl/misc/MiscFeatures.kt32
-rw-r--r--src/main/resources/mixins.skytils.json1
4 files changed, 83 insertions, 4 deletions
diff --git a/src/main/java/skytils/skytilsmod/mixins/MixinInventoryEffectRenderer.java b/src/main/java/skytils/skytilsmod/mixins/MixinInventoryEffectRenderer.java
new file mode 100644
index 00000000..1d1cb7a0
--- /dev/null
+++ b/src/main/java/skytils/skytilsmod/mixins/MixinInventoryEffectRenderer.java
@@ -0,0 +1,35 @@
+/*
+ * Skytils - Hypixel Skyblock Quality of Life Mod
+ * Copyright (C) 2021 Skytils
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package skytils.skytilsmod.mixins;
+
+import net.minecraft.client.renderer.InventoryEffectRenderer;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.ModifyVariable;
+import skytils.skytilsmod.Skytils;
+import skytils.skytilsmod.utils.Utils;
+
+@Mixin(InventoryEffectRenderer.class)
+public abstract class MixinInventoryEffectRenderer extends MixinGuiContainer {
+ @ModifyVariable(method = "updateActivePotionEffects", at = @At("STORE"), ordinal = 0, require = 1)
+ private boolean noDisplayPotionEffects(boolean bool) {
+ if (Skytils.config.hidePotionEffects && Utils.inSkyblock) return false;
+ return bool;
+ }
+}
diff --git a/src/main/kotlin/skytils/skytilsmod/core/Config.kt b/src/main/kotlin/skytils/skytilsmod/core/Config.kt
index 1486aa50..7e944d5c 100644
--- a/src/main/kotlin/skytils/skytilsmod/core/Config.kt
+++ b/src/main/kotlin/skytils/skytilsmod/core/Config.kt
@@ -1284,6 +1284,25 @@ class Config : Vigilant(File("./config/skytils/config.toml"), "Skytils", sorting
@Property(
type = PropertyType.SWITCH,
+ name = "Hide Potion Effects in Inventory",
+ description = "Prevents the game from rendering the potion effects in inventories while in Skyblock.",
+ category = "Miscellaneous",
+ subcategory = "Quality of Life"
+ )
+ @JvmField
+ var hidePotionEffects = false
+
+ @Property(
+ type = PropertyType.SWITCH,
+ name = "Highlight Disabled Potion Effects",
+ description = "Marks disabled potion effects in the toggle menu.",
+ category = "Miscellaneous",
+ subcategory = "Quality of Life"
+ )
+ var highlightDisabledPotionEffects = false
+
+ @Property(
+ type = PropertyType.SWITCH,
name = "Highlight Salvageable Items",
description = "Highlights items that can be salvaged.",
category = "Miscellaneous",
diff --git a/src/main/kotlin/skytils/skytilsmod/features/impl/misc/MiscFeatures.kt b/src/main/kotlin/skytils/skytilsmod/features/impl/misc/MiscFeatures.kt
index 713d39b8..51cd0c1e 100644
--- a/src/main/kotlin/skytils/skytilsmod/features/impl/misc/MiscFeatures.kt
+++ b/src/main/kotlin/skytils/skytilsmod/features/impl/misc/MiscFeatures.kt
@@ -31,9 +31,12 @@ import net.minecraft.entity.player.EntityPlayer
import net.minecraft.init.Blocks
import net.minecraft.init.Items
import net.minecraft.inventory.ContainerChest
-import net.minecraft.item.*
+import net.minecraft.item.Item
+import net.minecraft.item.ItemMonsterPlacer
+import net.minecraft.item.ItemStack
import net.minecraft.network.play.server.S29PacketSoundEffect
-import net.minecraft.util.*
+import net.minecraft.util.BlockPos
+import net.minecraft.util.ResourceLocation
import net.minecraftforge.client.event.ClientChatReceivedEvent
import net.minecraftforge.client.event.RenderBlockOverlayEvent
import net.minecraftforge.client.event.RenderGameOverlayEvent
@@ -44,23 +47,29 @@ import skytils.skytilsmod.Skytils
import skytils.skytilsmod.core.GuiManager.Companion.createTitle
import skytils.skytilsmod.core.structure.FloatPair
import skytils.skytilsmod.core.structure.GuiElement
-import skytils.skytilsmod.events.*
+import skytils.skytilsmod.events.BossBarEvent
+import skytils.skytilsmod.events.CheckRenderEntityEvent
+import skytils.skytilsmod.events.GuiContainerEvent
import skytils.skytilsmod.events.GuiContainerEvent.SlotClickEvent
import skytils.skytilsmod.events.PacketEvent.ReceiveEvent
-import skytils.skytilsmod.utils.*
+import skytils.skytilsmod.utils.ItemUtil
import skytils.skytilsmod.utils.ItemUtil.getExtraAttributes
import skytils.skytilsmod.utils.ItemUtil.getSkyBlockItemID
import skytils.skytilsmod.utils.NumberUtil.round
+import skytils.skytilsmod.utils.RenderUtil.highlight
import skytils.skytilsmod.utils.RenderUtil.renderItem
import skytils.skytilsmod.utils.RenderUtil.renderTexture
+import skytils.skytilsmod.utils.SBInfo
import skytils.skytilsmod.utils.StringUtils.startsWithAny
import skytils.skytilsmod.utils.StringUtils.stripControlCodes
+import skytils.skytilsmod.utils.Utils
import skytils.skytilsmod.utils.Utils.equalsOneOf
import skytils.skytilsmod.utils.Utils.isInTablist
import skytils.skytilsmod.utils.graphics.ScreenRenderer
import skytils.skytilsmod.utils.graphics.SmartFontRenderer.TextAlignment
import skytils.skytilsmod.utils.graphics.SmartFontRenderer.TextShadow
import skytils.skytilsmod.utils.graphics.colors.CommonColors
+import java.awt.Color
class MiscFeatures {
@SubscribeEvent
@@ -122,6 +131,21 @@ class MiscFeatures {
}
@SubscribeEvent
+ fun onDrawSlot(event: GuiContainerEvent.DrawSlotEvent.Pre) {
+ if (!Utils.inSkyblock || event.container !is ContainerChest) return
+ if (Skytils.config.highlightDisabledPotionEffects && event.slot.hasStack && SBInfo.lastOpenContainerName?.startsWith("Toggle Potion Effects") == true) {
+ var item = event.slot.stack
+ if (item.item == Items.potionitem) {
+ if (ItemUtil.getItemLore(item).any {
+ it == "§7Currently: §cDISABLED"
+ }) {
+ event.slot highlight Color(0, 0, 0, 80)
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
fun onJoin(event: EntityJoinWorldEvent) {
if (!Utils.inSkyblock || mc.thePlayer == null || mc.theWorld == null) return
if (event.entity is EntityArmorStand) {
diff --git a/src/main/resources/mixins.skytils.json b/src/main/resources/mixins.skytils.json
index e504b458..484cd141 100644
--- a/src/main/resources/mixins.skytils.json
+++ b/src/main/resources/mixins.skytils.json
@@ -21,6 +21,7 @@
"MixinEntityRenderer",
"MixinGuiContainer",
"MixinGuiIngame",
+ "MixinInventoryEffectRenderer",
"MixinGuiScreen",
"MixinItemArmor",
"MixinItemStack",