aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--FEATURES.md7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Garden.java3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/CropSpeedMeter.kt134
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt22
7 files changed, 156 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 79ee0c2a3..14a76c851 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -61,6 +61,7 @@
+ Added **Tooltip Tweaks Compact Descriptions** - Hides redundant parts of reforge descriptions, generic counter description, and Farmhand perk explanation. (contributed by appable)
+ Added **Tooltip Tweaks Breakdown Hotkey** - When the keybind is pressed, show a breakdown of all fortune sources on a tool. (contributed by appable)
+ Added **Tooltip Tweaks Tooltip Format** - Show crop-specific farming fortune in tooltip. (contributed by appable)
++ Added command **/shcropspeedmeter** - Helps calculate the real farming fortune with the formula crops broken per block.
### Features from other Mods
diff --git a/FEATURES.md b/FEATURES.md
index c5d52c5b7..be44806d8 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -210,9 +210,10 @@
+ **Tooltip Tweaks Tooltip Format** - Show crop-specific farming fortune in tooltip. (contributed by appable)
## Commands
-- /wiki (using hypixel-skyblock.fandom.com instead of Hypixel wiki)
-- /shmarkplayer <player> (marking a player with yellow color)
-- /shtrackcollection <item> - This tracks the number of items you collect, but it does not work with sacks.
++ **/wiki <search term>** - using hypixel-skyblock.fandom.com instead of Hypixel wiki.
++ **/shmarkplayer <player>** - marking a player with yellow color.
++ **/shtrackcollection <item>** - This tracks the number of items you collect, but it does not work with sacks.
++ **/shcropspeedmeter** - Helps calculate the real farming fortune with the formula crops broken per block.
## Misc
- Allow to copy, paste, and mark selected text in signs (not visual, but it's working still)
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index 20359056d..3392e83c7 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -247,6 +247,7 @@ public class SkyHanniMod {
loadModule(new ComposterInventoryNumbers());
loadModule(new FarmingFortuneDisplay());
loadModule(new ToolTooltipTweaks());
+ loadModule(new CropSpeedMeter());
Commands.INSTANCE.init();
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
index b808c4b31..f45c8a035 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.features.bazaar.BazaarDataGrabber
import at.hannibal2.skyhanni.features.bingo.BingoCardDisplay
import at.hannibal2.skyhanni.features.bingo.BingoNextStepHelper
import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper
+import at.hannibal2.skyhanni.features.garden.CropSpeedMeter
import at.hannibal2.skyhanni.features.misc.CollectionCounter
import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager
import at.hannibal2.skyhanni.test.LorenzTest
@@ -55,6 +56,7 @@ object Commands {
registerCommand("shtestgardenvisitors") { LorenzTest.testGardenVisitors() }
registerCommand("shresetitemnames") { BazaarDataGrabber.resetItemNames() }
registerCommand("shtogglehypixelapierrors") { APIUtil.toggleApiErrorMessages() }
+ registerCommand("shcropspeedmeter") { CropSpeedMeter.toggle() }
}
private fun registerCommand(name: String, function: (Array<String>) -> Unit) {
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
index 1e01135ce..fcacb9ddb 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
@@ -822,4 +822,7 @@ public class Garden {
@ConfigOption(name = "Fungi Cutter Warning", desc = "Warn when breaking mushroom with the wrong Fungi Cutter mode.")
@ConfigEditorBoolean
public boolean fungiCutterWarn = true;
+
+ @Expose
+ public Position cropSpeedMeterPos = new Position(278, -236, false, true);
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropSpeedMeter.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropSpeedMeter.kt
new file mode 100644
index 000000000..98c595a63
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropSpeedMeter.kt
@@ -0,0 +1,134 @@
+package at.hannibal2.skyhanni.features.garden
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getCounter
+import at.hannibal2.skyhanni.events.BlockClickEvent
+import at.hannibal2.skyhanni.events.CropMilestoneUpdateEvent
+import at.hannibal2.skyhanni.events.GuiRenderEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.round
+import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
+import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+
+class CropSpeedMeter {
+ private var display = listOf<String>()
+ private var currentCrop: CropType? = null
+ private var currentBlocks = 0
+ private var tick = 0
+ private var snapshot = listOf<String>()
+
+ @SubscribeEvent
+ fun onBlockBreak(event: BlockClickEvent) {
+ if (!isEnabled()) return
+ val cropBroken = CropType.getByBlock(event.getBlockState) ?: return
+ if (startCrops.isEmpty()) return
+
+ if (currentCrop != cropBroken) {
+ currentCrop = cropBroken
+ currentBlocks = 0
+ snapshot = emptyList()
+ }
+ breakBlock()
+ }
+
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ if (!isEnabled()) return
+ if (tick++ % 30 != 0) return
+
+ updateDisplay()
+ }
+
+ private fun updateDisplay() {
+ display = renderDisplay()
+ }
+
+ private fun renderDisplay(): MutableList<String> {
+ val list = mutableListOf<String>()
+ list.add("§7Crop Speed Meter")
+ if (startCrops.isEmpty()) {
+ list.add("§cOpen §e/cropmilestones §cto start!")
+ return list
+ }
+
+ if (currentCrop == null) {
+ list.add("§cStart breaking blocks!")
+ return list
+ }
+ currentCrop?.let {
+ list.add(" §7Current ${it.cropName} counter: §e${currentBlocks.addSeparators()}")
+ }
+
+ if (snapshot.isNotEmpty()) {
+ list += snapshot
+ } else {
+ list.add("§cOpen §e/cropmilestones §cagain to calculate!")
+ }
+
+ return list
+ }
+
+ @SubscribeEvent
+ fun onCropMilestoneUpdate(event: CropMilestoneUpdateEvent) {
+ if (!isEnabled()) return
+ val counters = mutableMapOf<CropType, Long>()
+ for (cropType in CropType.values()) {
+ counters[cropType] = cropType.getCounter()
+ }
+ if (startCrops.isEmpty()) {
+ startCrops = counters
+ currentCrop = null
+ snapshot = emptyList()
+ } else {
+ currentCrop?.let {
+ val crops = it.getCounter() - startCrops[it]!!
+ val blocks = currentBlocks
+ val cropsPerBlocks = (crops.toDouble() / blocks.toDouble()).round(3)
+
+ val list = mutableListOf<String>()
+ list.add("")
+ list.add("§6Calculation results")
+ list.add(" §7Crops collected: " + crops.addSeparators())
+ list.add(" §7Blocks broken: " + blocks.addSeparators())
+ list.add(" §7Crops per Block: " + cropsPerBlocks.addSeparators())
+
+ val baseDrops = it.baseDrops
+ val farmingFortune = (cropsPerBlocks * 100 / baseDrops).round(3)
+
+
+ list.add(" §7Calculated farming Fortune: §e" + farmingFortune.addSeparators())
+ list.add("§cOpen /cropmilestones again to recalculate!")
+
+ snapshot = list
+ updateDisplay()
+ }
+ }
+ }
+
+ private fun breakBlock() {
+ currentBlocks++
+ }
+
+ companion object {
+ var enabled = false
+ private var startCrops = mapOf<CropType, Long>()
+
+ fun toggle() {
+ enabled = !enabled
+ LorenzUtils.chat("§e[SkyHanni] Crop Speed Meter " + if (enabled) "§aEnabled" else "§cDisabled")
+ startCrops = emptyMap()
+
+ }
+ }
+
+ @SubscribeEvent
+ fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) {
+ if (!isEnabled()) return
+
+ SkyHanniMod.feature.garden.cropSpeedMeterPos.renderStrings(display, posLabel = "Crop Speed Meter")
+ }
+
+ fun isEnabled() = enabled && GardenAPI.inGarden()
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt
index d8c05dff0..11deea8d4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt
@@ -6,17 +6,17 @@ import net.minecraft.init.Items
import net.minecraft.item.EnumDyeColor
import net.minecraft.item.ItemStack
-enum class CropType(val cropName: String, val toolName: String, iconSupplier: () -> ItemStack) {
- WHEAT("Wheat", "THEORETICAL_HOE_WHEAT", { ItemStack(Items.wheat) }),
- CARROT("Carrot", "THEORETICAL_HOE_CARROT", { ItemStack(Items.carrot) }),
- POTATO("Potato", "THEORETICAL_HOE_POTATO", { ItemStack(Items.potato) }),
- NETHER_WART("Nether Wart", "THEORETICAL_HOE_WARTS", { ItemStack(Items.nether_wart) }),
- PUMPKIN("Pumpkin", "PUMPKIN_DICER", { ItemStack(Blocks.pumpkin) }),
- MELON("Melon", "MELON_DICER", { ItemStack(Items.melon) }),
- COCOA_BEANS("Cocoa Beans", "COCO_CHOPPER", { ItemStack(Items.dye, 1, EnumDyeColor.BROWN.dyeDamage) }),
- SUGAR_CANE("Sugar Cane", "THEORETICAL_HOE_CANE", { ItemStack(Items.reeds) }),
- CACTUS("Cactus", "CACTUS_KNIFE", { ItemStack(Blocks.cactus) }),
- MUSHROOM("Mushroom", "FUNGI_CUTTER", { ItemStack(Blocks.red_mushroom_block) }),
+enum class CropType(val cropName: String, val toolName: String, val baseDrops: Double, iconSupplier: () -> ItemStack) {
+ WHEAT("Wheat", "THEORETICAL_HOE_WHEAT", 1.0, { ItemStack(Items.wheat) }),
+ CARROT("Carrot", "THEORETICAL_HOE_CARROT", 3.0, { ItemStack(Items.carrot) }),
+ POTATO("Potato", "THEORETICAL_HOE_POTATO", 3.0, { ItemStack(Items.potato) }),
+ NETHER_WART("Nether Wart", "THEORETICAL_HOE_WARTS", 2.5, { ItemStack(Items.nether_wart) }),
+ PUMPKIN("Pumpkin", "PUMPKIN_DICER", 1.0, { ItemStack(Blocks.pumpkin) }),
+ MELON("Melon", "MELON_DICER", 5.0, { ItemStack(Items.melon) }),
+ COCOA_BEANS("Cocoa Beans", "COCO_CHOPPER", 3.0, { ItemStack(Items.dye, 1, EnumDyeColor.BROWN.dyeDamage) }),
+ SUGAR_CANE("Sugar Cane", "THEORETICAL_HOE_CANE", 2.0, { ItemStack(Items.reeds) }),
+ CACTUS("Cactus", "CACTUS_KNIFE", 2.0, { ItemStack(Blocks.cactus) }),
+ MUSHROOM("Mushroom", "FUNGI_CUTTER", 1.0, { ItemStack(Blocks.red_mushroom_block) }),
;
val icon by lazy { iconSupplier() }