diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2023-08-14 05:03:45 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-13 21:03:45 +0200 |
commit | de8413bad3c6fdf7ba3668b6ae1ef8979529f0b5 (patch) | |
tree | e5c13ecd50ab914f852e5888db0e017c71be61e9 | |
parent | 834e057cb34ac1cec13d5ae95d59e94ca2626f31 (diff) | |
download | skyhanni-de8413bad3c6fdf7ba3668b6ae1ef8979529f0b5.tar.gz skyhanni-de8413bad3c6fdf7ba3668b6ae1ef8979529f0b5.tar.bz2 skyhanni-de8413bad3c6fdf7ba3668b6ae1ef8979529f0b5.zip |
Merge pull request #381
* round down in composter
* Using NEUInternalName in MinionCraftHelper SkyHanniTestCommand
4 files changed, 28 insertions, 19 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java index 6492a3200..f7ee9f765 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java @@ -47,7 +47,7 @@ public class DevConfig { public boolean showInternalName = false; @Expose - @ConfigOption(name = "Show empty internal names", desc = "Shows internal name even if it is blank.") + @ConfigOption(name = "Show empty internal names", desc = "Shows internal name even for items with none.") @ConfigEditorBoolean @ConfigAccordionId(id = 0) public boolean showEmptyNames = false; diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/GardenConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/GardenConfig.java index a9360b814..36d2fbb50 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/GardenConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/GardenConfig.java @@ -5,17 +5,7 @@ import at.hannibal2.skyhanni.config.core.config.Position; import at.hannibal2.skyhanni.features.garden.inventory.GardenPlotIcon; import at.hannibal2.skyhanni.utils.LorenzUtils; import com.google.gson.annotations.Expose; -import io.github.moulberry.moulconfig.annotations.Accordion; -import io.github.moulberry.moulconfig.annotations.ConfigAccordionId; -import io.github.moulberry.moulconfig.annotations.ConfigEditorAccordion; -import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; -import io.github.moulberry.moulconfig.annotations.ConfigEditorButton; -import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; -import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; -import io.github.moulberry.moulconfig.annotations.ConfigEditorKeybind; -import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider; -import io.github.moulberry.moulconfig.annotations.ConfigEditorText; -import io.github.moulberry.moulconfig.annotations.ConfigOption; +import io.github.moulberry.moulconfig.annotations.*; import io.github.moulberry.moulconfig.observer.Property; import net.minecraft.client.Minecraft; import org.lwjgl.input.Keyboard; @@ -766,7 +756,7 @@ public class GardenConfig { @Expose @ConfigOption(name = "Overtake ETA", desc = "Show a timer estimating when you'll move up a spot in the leaderboard! " + - "Will show an ETA to rank #1000 if you're not on the leaderboard yet.") + "Will show an ETA to rank #10,000 if you're not on the leaderboard yet.") @ConfigEditorBoolean @ConfigAccordionId(id = 11) public boolean eliteFarmingWeightOvertakeETA = false; @@ -778,7 +768,7 @@ public class GardenConfig { public boolean eliteFarmingWeightOvertakeETAAlways = true; @Expose - @ConfigOption(name = "ETA Goal", desc = "Override the Overtake ETA to show when you'll reach the specified rank (if not there yet). (Default: \"10000\")") + @ConfigOption(name = "ETA Goal", desc = "Override the Overtake ETA to show when you'll reach the specified rank (if not there yet). (Default: \"10,000\")") @ConfigEditorText @ConfigAccordionId(id = 11) public String eliteFarmingWeightETAGoalRank = "10000"; @@ -1075,6 +1065,15 @@ public class GardenConfig { @Expose @ConfigOption( + name = "Round Amount Needed", + desc = "Rounds the amount needed to fill your composter down so that you don't overspend." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 17) + public boolean composterRoundDown = true; + + @Expose + @ConfigOption( name = "Highlight Upgrade", desc = "Highlight Upgrades that can be bought right now." ) 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>() diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt index 2cfb5ae94..684a1a97d 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.features.dungeon.DungeonData import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorColorNames import at.hannibal2.skyhanni.utils.* -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import net.minecraft.nbt.NBTTagCompound @@ -228,9 +228,9 @@ class SkyHanniTestCommand { if (!SkyHanniMod.feature.dev.showInternalName) return val itemStack = event.itemStack if (itemStack != null) { - val internalName = itemStack.getInternalName_old() - if (internalName == "" && !SkyHanniMod.feature.dev.showEmptyNames) return - event.toolTip.add("Internal Name: '$internalName'") + val internalName = itemStack.getInternalName() + if ((internalName == NEUInternalName.NONE) && !SkyHanniMod.feature.dev.showEmptyNames) return + event.toolTip.add("Internal Name: '${internalName.asString()}'") } } |