Skip to content

Commit

Permalink
feat: Sort Chest Profit items by value
Browse files Browse the repository at this point in the history
  • Loading branch information
My-Name-Is-Jeff committed Feb 25, 2025
1 parent e90f2c3 commit c2c0956
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import net.minecraft.item.ItemStack
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.TreeSet


/**
Expand Down Expand Up @@ -154,7 +155,7 @@ object KuudraChestProfit {

var keyNeeded: KuudraKey? = null
var value = 0.0
val items = ArrayList<KuudraChestLootItem>()
val items = TreeSet<KuudraChestLootItem>().descendingSet()

fun reset() {
keyNeeded = null
Expand Down Expand Up @@ -204,7 +205,9 @@ object KuudraChestProfit {
}

private var textShadow_ = SmartFontRenderer.TextShadow.NORMAL
private class KuudraChestLootItem(var stackSize: Int, var displayText: String, var value: Double)
private data class KuudraChestLootItem(var stackSize: Int, var displayText: String, var value: Double) : Comparable<KuudraChestLootItem> {
override fun compareTo(other: KuudraChestLootItem): Int = value.compareTo(other.value)
}
class KuudraChestProfitElement : GuiElement("Kuudra Chest Profit", x = 200, y = 120) {
override fun render() {
if (toggled && SBInfo.mode == SkyblockIsland.KuudraHollow.mode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.awt.Color
import java.util.TreeSet


/**
Expand Down Expand Up @@ -268,7 +269,7 @@ object DungeonChestProfit {

var price = 0.0
var value = 0.0
var items = ArrayList<DungeonChestLootItem>()
var items = TreeSet<DungeonChestLootItem>().descendingSet()
val profit
get() = value - price

Expand All @@ -289,7 +290,9 @@ object DungeonChestProfit {
}

private var textShadow_ = SmartFontRenderer.TextShadow.NORMAL
private class DungeonChestLootItem(var item: ItemStack, var value: Double)
private data class DungeonChestLootItem(var item: ItemStack, var value: Double) : Comparable<DungeonChestLootItem> {
override fun compareTo(other: DungeonChestLootItem): Int = value.compareTo(other.value)
}
class DungeonChestProfitElement : GuiElement("Dungeon Chest Profit", x = 200, y = 120) {
override fun render() {
if (toggled && (Utils.inDungeons || SBInfo.mode == SkyblockIsland.DungeonHub.mode)) {
Expand Down

0 comments on commit c2c0956

Please sign in to comment.