aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-04-09 18:20:58 +0200
committerGitHub <noreply@github.com>2024-04-09 18:20:58 +0200
commit85138c09082541e0b9c8b9b50c9e7afce2e03101 (patch)
tree6327639d292c2b870ae7e92c86b9f61b545bfb85 /src/main/java
parent6767e9ed500526f931b5bd19da11c7631ca19b6b (diff)
downloadskyhanni-85138c09082541e0b9c8b9b50c9e7afce2e03101.tar.gz
skyhanni-85138c09082541e0b9c8b9b50c9e7afce2e03101.tar.bz2
skyhanni-85138c09082541e0b9c8b9b50c9e7afce2e03101.zip
Fix: Item Render in Next Contest Overlay (#1403)
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt19
4 files changed, 15 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
index 8f44e5caa..bad129824 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
@@ -158,7 +158,7 @@ object GardenAPI {
fun readCounter(itemStack: ItemStack): Long = itemStack.getHoeCounter() ?: itemStack.getCultivatingCounter() ?: -1L
fun MutableList<Any>.addCropIcon(crop: CropType, highlight: Boolean = false) =
- addItemIcon(crop.icon.copy(), highlight)
+ addItemIcon(crop.icon.copy(), highlight, 1.0)
fun hideExtraGuis() = ComposterOverlay.inInventory || AnitaMedalProfit.inInventory ||
SkyMartCopperPrice.inInventory || FarmingContestAPI.inInventory || VisitorAPI.inInventory || FFGuideGUI.isInGui()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
index 43142be27..1e2748086 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
@@ -390,7 +390,6 @@ object GardenNextJacobContest {
duration -= contestDuration
}
for (crop in nextContest.crops) {
- list.add(" ")
list.addCropIcon(crop, highlight = (crop == boostedCrop))
nextContestCrops.add(crop)
}
@@ -494,7 +493,7 @@ object GardenNextJacobContest {
if (display.isEmpty()) {
config.pos.renderStrings(simpleDisplay, posLabel = "Next Jacob Contest")
} else {
- config.pos.renderSingleLineWithItems(display, 1.0, posLabel = "Next Jacob Contest")
+ config.pos.renderSingleLineWithItems(display, posLabel = "Next Jacob Contest")
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
index 8d22a6c4c..47785eba9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
@@ -238,7 +238,6 @@ object GardenVisitorFeatures {
list.add(" §7(§c?§7)")
continue
}
- list.add(" ")
if (items.isEmpty()) {
list.add("§7(§fAny§7)")
} else {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index 4e8f41757..6aa9c5479 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -12,8 +12,8 @@ import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.renderables.RenderableUtils.renderXAligned
import at.hannibal2.skyhanni.utils.shader.ShaderManager
-import io.github.notenoughupdates.moulconfig.internal.TextRenderUtils
import io.github.moulberry.notenoughupdates.util.Utils
+import io.github.notenoughupdates.moulconfig.internal.TextRenderUtils
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.FontRenderer
import net.minecraft.client.gui.Gui
@@ -558,12 +558,15 @@ object RenderUtils {
*/
fun Position.renderSingleLineWithItems(
list: List<Any?>,
- itemScale: Double = NEUItems.itemFontSize,
posLabel: String
) {
if (list.isEmpty()) return
- val longestX = renderLine(list, 0, itemScale)
- GuiEditManager.add(this, posLabel, longestX, 10)
+ renderRenderables(
+ listOf(
+ Renderable.horizontalContainer(
+ list.mapNotNull { Renderable.fromAny(it) }
+ )), posLabel = posLabel)
+ // TODO Future write that better
}
private fun Position.renderLine(line: List<Any?>, offsetY: Int, itemScale: Double = NEUItems.itemFontSize): Int {
@@ -584,13 +587,17 @@ object RenderUtils {
return offsetX
}
- fun MutableList<Any>.addItemIcon(item: ItemStack, highlight: Boolean = false) {
+ fun MutableList<Any>.addItemIcon(
+ item: ItemStack,
+ highlight: Boolean = false,
+ scale: Double = NEUItems.itemFontSize
+ ) {
try {
if (highlight) {
// Hack to add enchant glint, like Hypixel does it
item.addEnchantment(Enchantment.protection, 0)
}
- add(item)
+ add(Renderable.itemStack(item, scale))
} catch (e: NullPointerException) {
ErrorManager.logErrorWithData(
e, "Add item icon to renderable list",