diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-04-07 14:23:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-07 14:23:06 +0200 |
commit | d3cd3c4ff4c51a8f047d396fb5edbb7cf523ca84 (patch) | |
tree | 2fec2b35a50cea15ea7da188549cc3fd21b8ee82 /src/main/java/at/hannibal2/skyhanni/features | |
parent | fcd404d862b4b051474898076fcc06b406d1ea91 (diff) | |
download | skyhanni-d3cd3c4ff4c51a8f047d396fb5edbb7cf523ca84.tar.gz skyhanni-d3cd3c4ff4c51a8f047d396fb5edbb7cf523ca84.tar.bz2 skyhanni-d3cd3c4ff4c51a8f047d396fb5edbb7cf523ca84.zip |
Improvement: fillTable now uses Renderable.table (#1376)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt | 28 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt | 17 |
2 files changed, 26 insertions, 19 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt index 84ca5b235..497932ae4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt @@ -6,7 +6,6 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import at.hannibal2.skyhanni.test.command.ErrorManager -import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.DisplayTableEntry import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils @@ -14,20 +13,21 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LorenzUtils.fillTable +import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NumberUtil -import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems +import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.renderables.Renderable import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AnitaMedalProfit { private val config get() = GardenAPI.config.anitaShop - private var display = emptyList<List<Any>>() + private var display = emptyList<Renderable>() companion object { @@ -70,9 +70,9 @@ class AnitaMedalProfit { } } - val newList = mutableListOf<List<Any>>() - newList.addAsSingletonList("§eMedal Profit") - newList.fillTable(table) + val newList = mutableListOf<Renderable>() + newList.add(Renderable.string("§eMedal Profit")) + newList.add(LorenzUtils.fillTable(table, padding = 5, itemScale = 1.7)) display = newList } @@ -108,7 +108,16 @@ class AnitaMedalProfit { "§7Material cost: §6${NumberUtil.format(fullCost)} ", "§7Final profit: §6${profitFormat} ", ) - table.add(DisplayTableEntry(itemName, "$color$profitFormat", profit, internalName, hover, highlightsOnHoverSlots = listOf(slot))) + table.add( + DisplayTableEntry( + itemName, + "$color$profitFormat", + profit, + internalName, + hover, + highlightsOnHoverSlots = listOf(slot) + ) + ) } private fun getItemName(item: ItemStack): String? { @@ -167,10 +176,9 @@ class AnitaMedalProfit { @SubscribeEvent fun onBackgroundDraw(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { if (inInventory) { - config.medalProfitPos.renderStringsAndItems( + config.medalProfitPos.renderRenderables( display, extraSpace = 5, - itemScale = 1.7, posLabel = "Anita Medal Profit" ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt index 9e5ec780c..29623653b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt @@ -5,20 +5,20 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.garden.GardenAPI -import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.DisplayTableEntry import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.itemName -import at.hannibal2.skyhanni.utils.LorenzUtils.fillTable +import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatInt -import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems +import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.renderables.Renderable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -30,7 +30,7 @@ class SkyMartCopperPrice { "§c(?<amount>.*) Copper" ) - private var display = emptyList<List<Any>>() + private var display = emptyList<Renderable>() private val config get() = GardenAPI.config.skyMart companion object { @@ -97,9 +97,9 @@ class SkyMartCopperPrice { } } - val newList = mutableListOf<List<Any>>() - newList.addAsSingletonList("§eCoins per Copper§f:") - newList.fillTable(table) + val newList = mutableListOf<Renderable>() + newList.add(Renderable.string("§eCoins per Copper§f:")) + newList.add(LorenzUtils.fillTable(table, padding = 5, itemScale = config.itemScale)) display = newList } @@ -111,10 +111,9 @@ class SkyMartCopperPrice { @SubscribeEvent fun onBackgroundDraw(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { if (inInventory) { - config.copperPricePos.renderStringsAndItems( + config.copperPricePos.renderRenderables( display, extraSpace = 5, - itemScale = config.itemScale, posLabel = "SkyMart Copper Price" ) } |