Skip to content

Commit

Permalink
Fix: FF Bugs (#3196)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thunderblade73 authored Jan 11, 2025
1 parent 3d3a031 commit 7ccacdc
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import net.minecraft.item.ItemStack
class FFGuideGUI : GuideGUI<FFGuideGUI.FortuneGuidePage>(FortuneGuidePage.OVERVIEW) {

override val sizeX = 360
override val sizeY = 200
override val sizeY = 225

companion object {

Expand Down Expand Up @@ -66,26 +66,26 @@ class FFGuideGUI : GuideGUI<FFGuideGUI.FortuneGuidePage>(FortuneGuidePage.OVERVI
},
vTab(
ItemStack(Items.map),
Renderable.string("§eUpgrades")
Renderable.string("§eUpgrades"),
) {
currentPage = FortuneGuidePage.UPGRADES
}
},
)
horizontalTabs = buildList {
add(
hTab(ItemStack(Blocks.grass), Renderable.string("§eOverview")) {
currentCrop = null

it.pageSwitchHorizontal()
}
},
)
for (crop in CropType.entries) {
add(
hTab(crop.icon, Renderable.string("§e${crop.cropName}")) {
currentCrop = crop

it.pageSwitchHorizontal()
}
},
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ internal enum class FFInfos(
FarmingItems.MOOSHROOM_COW -> 158
FarmingItems.BEE -> 30
FarmingItems.SLUG -> 100
FarmingItems.HEDGEHOG -> 45
FarmingItems.HEDGEHOG -> 45 * 3
else -> 0
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getFarmingForDummiesCount
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetItem
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetLevel
import at.hannibal2.skyhanni.utils.SkyBlockTime
import net.minecraft.item.ItemStack
import kotlin.math.floor

object FFStats {

@Suppress("PropertyWrapping")
private val mathCrops = setOf(CropType.WHEAT, CropType.CARROT, CropType.POTATO, CropType.SUGAR_CANE, CropType.NETHER_WART)
private val dicerCrops = setOf(CropType.PUMPKIN, CropType.MELON)

private val farmingBoots = setOf("RANCHERS_BOOTS", "FARMER_BOOTS")

var cakeExpireTime
Expand Down Expand Up @@ -64,7 +61,7 @@ object FFStats {
FarmingFortuneDisplay.loadFortuneLineData(tool, 0.0)

when (crop) {
in mathCrops -> {
CropType.WHEAT, CropType.CARROT, CropType.POTATO, CropType.SUGAR_CANE, CropType.NETHER_WART -> {
FortuneStats.BASE_TOOL.set(FarmingFortuneDisplay.getToolFortune(tool), 50.0)
FortuneStats.COUNTER.set(FarmingFortuneDisplay.getCounterFortune(tool), 96.0)
FortuneStats.HARVESTING.set(FarmingFortuneDisplay.getHarvestingFortune(tool), 75.0)
Expand All @@ -73,7 +70,7 @@ object FFStats {
FortuneStats.GEMSTONE.set(FarmingFortuneDisplay.gemstoneFortune, 30.0)
}

in dicerCrops -> {
CropType.PUMPKIN, CropType.MELON -> {
FortuneStats.SUNDER.set(FarmingFortuneDisplay.getSunderFortune(tool), 75.0)
FortuneStats.REFORGE.set(FarmingFortuneDisplay.reforgeFortune, 20.0)
FortuneStats.GEMSTONE.set(FarmingFortuneDisplay.gemstoneFortune, 30.0)
Expand Down Expand Up @@ -188,7 +185,7 @@ object FFStats {
rawInternalName.contains("BEE;2") -> 0.2 * petLevel
rawInternalName.contains("BEE;3") || rawInternalName.contains("BEE;4") -> 0.3 * petLevel
rawInternalName.contains("SLUG;4") -> 1.0 * petLevel
rawInternalName.contains("HEDGEHOG;4") -> 0.45 * petLevel
rawInternalName.contains("HEDGEHOG;4") -> 0.45 * petLevel * if (SkyBlockTime.isDay()) 1.0 else 3.0
else -> 0.0
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class CropPage(val crop0: () -> CropType, sizeX: Int, sizeY: Int, paddingX: Int
2,
verticalAlign = RenderUtils.VerticalAlignment.BOTTOM,
),
164,
sizeY - 36,
horizontalAlign = RenderUtils.HorizontalAlignment.CENTER,
verticalAlign = RenderUtils.VerticalAlignment.BOTTOM,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import at.hannibal2.skyhanni.utils.TimeUtils.format
import at.hannibal2.skyhanni.utils.guide.GuideTablePage
import at.hannibal2.skyhanni.utils.renderables.Renderable

class OverviewPage(sizeX: Int, sizeY: Int, paddingX: Int = 15, paddingY: Int = 7, footerSpacing: Int = 6) :
GuideTablePage(
sizeX, sizeY, paddingX, paddingY, footerSpacing,
) {
class OverviewPage(sizeX: Int, sizeY: Int, paddingX: Int = 15, paddingY: Int = 7, footerSpacing: Int = 6) : GuideTablePage(
sizeX, sizeY, paddingX, paddingY, footerSpacing,
) {

override fun onEnter() {
val (content, footer) = getPage()
Expand Down Expand Up @@ -209,28 +208,24 @@ class OverviewPage(sizeX: Int, sizeY: Int, paddingX: Int = 15, paddingY: Int = 7
),
)

footer.add(
Renderable.horizontalContainer(
FarmingItems.getPetsDisplay(true),
4,
horizontalAlign = RenderUtils.HorizontalAlignment.CENTER,
verticalAlign = RenderUtils.VerticalAlignment.CENTER,
),
val petFooter = Renderable.horizontalContainer(
FarmingItems.getPetsDisplay(true),
4,
horizontalAlign = RenderUtils.HorizontalAlignment.CENTER,
verticalAlign = RenderUtils.VerticalAlignment.CENTER,
)

footer.add(
FFInfos.TOTAL_PET.bar(
"§2Total Pet Fortune",
"§7§2The total fortune from your pet and its item",
72,
),
)

footer.add(
FFInfos.PET_BASE.bar(
"§2Base Pet Fortune",
"§7§2The base fortune from your pet",
72,
),
)

Expand All @@ -243,7 +238,6 @@ class OverviewPage(sizeX: Int, sizeY: Int, paddingX: Int = 15, paddingY: Int = 7
"MINOS_RELIC" -> "§cGreen Bandana is better for fortune than minos relic!"
else -> "No fortune boosting pet item"
},
72,
),
)

Expand All @@ -268,7 +262,21 @@ class OverviewPage(sizeX: Int, sizeY: Int, paddingX: Int = 15, paddingY: Int = 7
),
)

return content to footer
val realFooter = Renderable.verticalContainer(
listOf(
petFooter,
Renderable.horizontalContainer(
footer,
spacing = 15,
horizontalAlign = RenderUtils.HorizontalAlignment.CENTER, verticalAlign = RenderUtils.VerticalAlignment.CENTER,
),
),
spacing = 2,
horizontalAlign = RenderUtils.HorizontalAlignment.CENTER,
verticalAlign = RenderUtils.VerticalAlignment.CENTER,
)

return content to listOf(realFooter)
}

private fun FFTypes.notSaved(): Boolean = FFStats.baseFF[this]?.let {
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/at/hannibal2/skyhanni/utils/SkyBlockTime.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.utils

import net.minecraft.client.Minecraft
import java.time.Instant

/**
Expand Down Expand Up @@ -46,8 +47,8 @@ data class SkyBlockTime(
Instant.ofEpochMilli(
SKYBLOCK_EPOCH_START_MILLIS +
(SKYBLOCK_YEAR_MILLIS * year) +
(SKYBLOCK_MONTH_MILLIS * (season.getMonth(modifier)))
)
(SKYBLOCK_MONTH_MILLIS * (season.getMonth(modifier))),
),
)
}

Expand Down Expand Up @@ -77,7 +78,7 @@ data class SkyBlockTime(
day: Int,
hour: Int,
minute: Int,
second: Int
second: Int,
): Long {
var time = 0L
time += year * SKYBLOCK_YEAR_MILLIS
Expand Down Expand Up @@ -123,6 +124,8 @@ data class SkyBlockTime(
val millis = toMillis() + duration.inWholeMilliseconds
return fromInstant(Instant.ofEpochMilli(millis))
}

fun isDay(): Boolean = Minecraft.getMinecraft().theWorld.worldTime % 24000 in 1..12000
}
}

Expand Down

0 comments on commit 7ccacdc

Please sign in to comment.