aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/garden/composter
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden/composter')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt12
2 files changed, 13 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt
index 38132e8b6..aab3b082b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt
@@ -14,7 +14,9 @@ import at.hannibal2.skyhanni.utils.TimeUtils
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.*
import kotlin.time.Duration
+import kotlin.time.Duration.Companion.seconds
import kotlin.time.DurationUnit
+import kotlin.math.floor
class ComposterDisplay {
private val config get() = SkyHanniMod.feature.garden
@@ -68,8 +70,8 @@ class ComposterDisplay {
val organicMatterRequired = ComposterAPI.organicMatterRequiredPer(null)
val fuelRequired = ComposterAPI.fuelRequiredPer(null)
- val organicMatterRemaining = organicMatter / organicMatterRequired
- val fuelRemaining = fuel / fuelRequired
+ val organicMatterRemaining = floor(organicMatter / organicMatterRequired)
+ val fuelRemaining = floor(fuel / fuelRequired)
val endOfOrganicMatter = timePerCompost * organicMatterRemaining
val endOfFuel = timePerCompost * fuelRemaining
@@ -142,7 +144,7 @@ class ComposterDisplay {
if (ComposterAPI.getOrganicMatter() <= config.composterNotifyLowOrganicMatter) {
if (System.currentTimeMillis() >= hidden.informedAboutLowMatter) {
if (config.composterNotifyLowTitle) {
- TitleUtils.sendTitle("§cYour Organic Matter is low", 4_000)
+ TitleUtils.sendTitle("§cYour Organic Matter is low", 4.seconds)
}
LorenzUtils.chat("§e[SkyHanni] §cYour Organic Matter is low!")
hidden.informedAboutLowMatter = System.currentTimeMillis() + 60_000 * 5
@@ -153,7 +155,7 @@ class ComposterDisplay {
System.currentTimeMillis() >= hidden.informedAboutLowFuel
) {
if (config.composterNotifyLowTitle) {
- TitleUtils.sendTitle("§cYour Fuel is low", 4_000)
+ TitleUtils.sendTitle("§cYour Fuel is low", 4.seconds)
}
LorenzUtils.chat("§e[SkyHanni] §cYour Fuel is low!")
hidden.informedAboutLowFuel = System.currentTimeMillis() + 60_000 * 5
@@ -203,6 +205,6 @@ class ComposterDisplay {
if (System.currentTimeMillis() < storage.lastComposterEmptyWarningTime + 1000 * 60 * 2) return
storage.lastComposterEmptyWarningTime = System.currentTimeMillis()
LorenzUtils.chat("§e[SkyHanni] $warningMessage")
- TitleUtils.sendTitle("§eComposter Warning!", 3_000)
+ TitleUtils.sendTitle("§eComposter Warning!", 3.seconds)
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
index 66c7b2c41..e86d4124a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
@@ -201,9 +201,9 @@ class ComposterOverlay {
val matterPer = ComposterAPI.organicMatterRequiredPer(null)
val matterPerPreview = ComposterAPI.organicMatterRequiredPer(upgrade)
- val matterMaxDuration = ComposterAPI.timePerCompost(null) * (maxOrganicMatter / matterPer)
+ val matterMaxDuration = ComposterAPI.timePerCompost(null) * floor(maxOrganicMatter / matterPer)
val matterMaxDurationPreview =
- ComposterAPI.timePerCompost(upgrade) * (maxOrganicMatterPreview / matterPerPreview)
+ ComposterAPI.timePerCompost(upgrade) * floor(maxOrganicMatterPreview / matterPerPreview)
var format = formatTime(matterMaxDuration)
var formatPreview =
@@ -217,9 +217,9 @@ class ComposterOverlay {
val fuelRequiredPer = ComposterAPI.fuelRequiredPer(null)
val fuelRequiredPerPreview = ComposterAPI.fuelRequiredPer(upgrade)
- val fuelMaxDuration = ComposterAPI.timePerCompost(null) * (maxFuel / fuelRequiredPer)
+ val fuelMaxDuration = ComposterAPI.timePerCompost(null) * floor(maxFuel / fuelRequiredPer)
val fuelMaxDurationPreview =
- ComposterAPI.timePerCompost(upgrade) * (maxFuelPreview / fuelRequiredPerPreview)
+ ComposterAPI.timePerCompost(upgrade) * floor(maxFuelPreview / fuelRequiredPerPreview)
format = formatTime(fuelMaxDuration)
formatPreview =
@@ -350,8 +350,8 @@ class ComposterOverlay {
val priceCompost = getPrice("COMPOST")
- val profit = (priceCompost - (fuelPricePer + organicMatterPricePer)) * multiplier
- val profitPreview = (priceCompost - (fuelPricePerPreview + organicMatterPricePerPreview)) * multiplierPreview
+ val profit = ((priceCompost * multiDropFactor) - (fuelPricePer + organicMatterPricePer)) * timeMultiplier
+ val profitPreview = ((priceCompost * multiDropFactorPreview) - (fuelPricePerPreview + organicMatterPricePerPreview)) * timeMultiplierPreview
val profitFormatPreview = if (profit != profitPreview) " §c➜ §6" + NumberUtil.format(profitPreview) else ""
val profitFormat = " §7Profit per $timeText: §6${NumberUtil.format(profit)}$profitFormatPreview"