Skip to content

Commit

Permalink
Fixes auto refill indicators showing when auto refill is disabled.
Browse files Browse the repository at this point in the history
fixes #431
  • Loading branch information
blackd committed Aug 14, 2024
1 parent 816e51c commit 740cb62
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ plugins {
id("fabric-loom") version("1.7-SNAPSHOT") apply false
id("com.matthewprenger.cursegradle") version "1.4.+" apply false
id("com.modrinth.minotaur") version "2.+" apply false
id("net.neoforged.gradle.userdev") version "7.0.145" apply false
id("net.neoforged.gradle.userdev") version "7+" apply false
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import org.anti_ad.mc.alias.item.ShovelItem
import org.anti_ad.mc.alias.item.SwordItem
import org.anti_ad.mc.alias.item.ToolItem
import org.anti_ad.mc.alias.text.fromSerializedJson
import org.anti_ad.mc.alias.world.GameType
import org.anti_ad.mc.common.extensions.tryCatch
import org.anti_ad.mc.common.gui.NativeContext
import org.anti_ad.mc.common.math2d.Point
Expand All @@ -53,6 +54,7 @@ import org.anti_ad.mc.common.vanilla.showSubTitle
import org.anti_ad.mc.ipnext.config.AutoRefillNbtMatchType
import org.anti_ad.mc.ipnext.config.AutoRefillSettings
import org.anti_ad.mc.ipnext.config.Hotkeys
import org.anti_ad.mc.ipnext.config.ModSettings
import org.anti_ad.mc.ipnext.config.ThresholdUnit.ABSOLUTE
import org.anti_ad.mc.ipnext.config.ThresholdUnit.PERCENTAGE
import org.anti_ad.mc.ipnext.config.ToolReplaceVisualNotification
Expand Down Expand Up @@ -789,7 +791,7 @@ object AutoRefillHandler: InventoryOverlay {
}

override val enabledForeground: Boolean
get() = AutoRefillSettings.AUTO_REFILL_ENABLE_INDICATOR_ICONS.value && AutoRefillSettings.AUTO_REFILL_ENABLE_PER_SLOT_CONFIG.value
get() = ModSettings.ENABLE_AUTO_REFILL.value && AutoRefillSettings.AUTO_REFILL_ENABLE_INDICATOR_ICONS.value && AutoRefillSettings.AUTO_REFILL_ENABLE_PER_SLOT_CONFIG.value

override val enabledBackground: Boolean = false

Expand Down Expand Up @@ -854,8 +856,10 @@ object AutoRefillHandler: InventoryOverlay {
rEnableDepth()
}

fun postRenderHud(context: NativeContext) { //if (AutoRefillSettings.ALSO_SHOW_LOCKED_SLOTS_IN_HOTBAR.value && GameType.SPECTATOR != Vanilla.gameMode()) {
drawHotSprite(context) //}
fun postRenderHud(context: NativeContext) {
if (enabledForeground && GameType.SPECTATOR != Vanilla.gameMode()) {
drawHotSprite(context)
}
}

fun preRenderHud(context: NativeContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ object SlotHighlightHandler: InventoryOverlay {
}

override val enabledBackground: Boolean
get() = ModSettings.HIGHLIGHT_FOUSED_ITEMS.booleanValue && !ModSettings.HIGHLIGHT_FOUSED_ITEMS_FOREGROUND.booleanValue
get() = ModSettings.HIGHLIGHT_FOUSED_ITEMS.value && !ModSettings.HIGHLIGHT_FOUSED_ITEMS_FOREGROUND.value

override fun drawBackground(context: NativeContext) {
drawSprite(context)
}

override val enabledForeground: Boolean
get() = ModSettings.HIGHLIGHT_FOUSED_ITEMS.booleanValue && ModSettings.HIGHLIGHT_FOUSED_ITEMS_FOREGROUND.booleanValue
get() = ModSettings.HIGHLIGHT_FOUSED_ITEMS.value && ModSettings.HIGHLIGHT_FOUSED_ITEMS_FOREGROUND.value

override fun drawForeground(context: NativeContext) {
drawSprite(context)
Expand All @@ -84,7 +84,7 @@ object SlotHighlightHandler: InventoryOverlay {

val defaultAlpha: Int
get() {
return if (ModSettings.HIGHLIGHT_FOUSED_ITEMS_FOREGROUND.booleanValue) {
return if (ModSettings.HIGHLIGHT_FOUSED_ITEMS_FOREGROUND.value) {
ModSettings.HIGHLIGHT_FOUSED_ITEMS_COLOR.value.alpha
} else {
ModSettings.HIGHLIGHT_FOUSED_ITEMS_BG_COLOR.value.alpha
Expand Down

0 comments on commit 740cb62

Please sign in to comment.