From fa7360b6923ca8e4edea5c788cb38a3b941a6e12 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 16 Apr 2023 01:44:38 +0200 Subject: bountiful 0.2 coins bonus gets added to the money/hour (requires you to hold the hoe with bountiful in the hand to update) --- .../java/at/hannibal2/skyhanni/config/features/Hidden.java | 3 +++ .../skyhanni/features/garden/farming/CropMoneyDisplay.kt | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java index f1b161474..209ac61f3 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java @@ -68,4 +68,7 @@ public class Hidden { @Expose public Map gardenComposterUpgrades = new HashMap<>(); + + @Expose + public Map gardenToolHasBountiful = new HashMap<>(); } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index 5757a5c61..d9e9dd7c8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -17,9 +17,11 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getReforgeName import at.hannibal2.skyhanni.utils.StringUtils.removeColor import io.github.moulberry.notenoughupdates.NotEnoughUpdates import kotlinx.coroutines.launch +import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent @@ -32,6 +34,7 @@ class CropMoneyDisplay { private var multipliers = mapOf() private val cropNames = mutableMapOf() // internalName -> cropName private var hasCropInHand = false + private val toolHasBountiful: MutableMap get() = SkyHanniMod.feature.hidden.gardenToolHasBountiful @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { @@ -85,6 +88,13 @@ class CropMoneyDisplay { return newDisplay } + GardenAPI.cropInHand?.let { + val heldItem = Minecraft.getMinecraft().thePlayer.heldItem + val reforgeName = heldItem.getReforgeName() + val bountiful = reforgeName == "bountiful" + toolHasBountiful[it] = bountiful + } + val moneyPerHourData = calculateMoneyPerHour() if (moneyPerHourData.isEmpty()) { if (!GardenAPI.isSpeedDataEmpty()) { @@ -237,7 +247,9 @@ class CropMoneyDisplay { } } - moneyPerHours[internalName] = formatNumbers(sellOffer, instantSell, npcPrice) + val bountifulMoney = if (toolHasBountiful[crop] == true) speedPerHour * 0.2 else 0.0 + moneyPerHours[internalName] = + formatNumbers(sellOffer + bountifulMoney, instantSell + bountifulMoney, npcPrice + bountifulMoney) } return moneyPerHours } -- cgit