aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2023-08-14 05:03:45 +1000
committerGitHub <noreply@github.com>2023-08-13 21:03:45 +0200
commitde8413bad3c6fdf7ba3668b6ae1ef8979529f0b5 (patch)
treee5c13ecd50ab914f852e5888db0e017c71be61e9 /src/main/java/at/hannibal2/skyhanni/features
parent834e057cb34ac1cec13d5ae95d59e94ca2626f31 (diff)
downloadskyhanni-de8413bad3c6fdf7ba3668b6ae1ef8979529f0b5.tar.gz
skyhanni-de8413bad3c6fdf7ba3668b6ae1ef8979529f0b5.tar.bz2
skyhanni-de8413bad3c6fdf7ba3668b6ae1ef8979529f0b5.zip
Merge pull request #381
* round down in composter * Using NEUInternalName in MinionCraftHelper SkyHanniTestCommand
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt12
1 files changed, 11 insertions, 1 deletions
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 41f370e6a..66c7b2c41 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
@@ -28,6 +28,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.*
import kotlin.math.ceil
+import kotlin.math.floor
import kotlin.time.Duration
import kotlin.time.DurationUnit
@@ -388,7 +389,16 @@ class ComposterOverlay {
val item = NEUItems.getItemStack(internalName)
val itemName = item.name!!
val price = getPrice(internalName)
- val itemsNeeded = ceil(missing / factor)
+ val itemsNeeded = if (config.composterRoundDown) {
+ val amount = missing / factor
+ if (amount > .75 && amount < 1.0) {
+ 1.0
+ } else {
+ floor(amount)
+ }
+ } else {
+ ceil(missing / factor)
+ }
val totalPrice = itemsNeeded * price
val list = mutableListOf<Any>()