diff options
author | jani270 <69345714+jani270@users.noreply.github.com> | 2025-01-24 23:23:50 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2025-01-25 20:02:31 +0100 |
commit | 02830fc904792aa1945f5072e0815dbf02baebe7 (patch) | |
tree | 57ae73e9411ca3ed6172bd1eb22ff0848f9c2fb2 /mod/src | |
parent | 723124f5843142928ae0b71ace24a5135480216c (diff) | |
download | LocalTransactionLedger-02830fc904792aa1945f5072e0815dbf02baebe7.tar.gz LocalTransactionLedger-02830fc904792aa1945f5072e0815dbf02baebe7.tar.bz2 LocalTransactionLedger-02830fc904792aa1945f5072e0815dbf02baebe7.zip |
feat: Caducous (Hard word) Feeder Detection
Diffstat (limited to 'mod/src')
-rw-r--r-- | mod/src/main/kotlin/moe/nea/ledger/Ledger.kt | 2 | ||||
-rw-r--r-- | mod/src/main/kotlin/moe/nea/ledger/modules/CaducousFeederDetection.kt | 46 |
2 files changed, 48 insertions, 0 deletions
diff --git a/mod/src/main/kotlin/moe/nea/ledger/Ledger.kt b/mod/src/main/kotlin/moe/nea/ledger/Ledger.kt index b126c4a..9bbc8e1 100644 --- a/mod/src/main/kotlin/moe/nea/ledger/Ledger.kt +++ b/mod/src/main/kotlin/moe/nea/ledger/Ledger.kt @@ -22,6 +22,7 @@ import moe.nea.ledger.modules.BazaarDetection import moe.nea.ledger.modules.BazaarOrderDetection import moe.nea.ledger.modules.BitsDetection import moe.nea.ledger.modules.BitsShopDetection +import moe.nea.ledger.modules.CaducousFeederDetection import moe.nea.ledger.modules.DragonEyePlacementDetection import moe.nea.ledger.modules.DragonSacrificeDetection import moe.nea.ledger.modules.DungeonChestDetection @@ -136,6 +137,7 @@ class Ledger { BazaarOrderDetection::class.java, BitsDetection::class.java, BitsShopDetection::class.java, + CaducousFeederDetection::class.java, ConfigCommand::class.java, DebugDataCommand::class.java, DragonEyePlacementDetection::class.java, diff --git a/mod/src/main/kotlin/moe/nea/ledger/modules/CaducousFeederDetection.kt b/mod/src/main/kotlin/moe/nea/ledger/modules/CaducousFeederDetection.kt new file mode 100644 index 0000000..76374ef --- /dev/null +++ b/mod/src/main/kotlin/moe/nea/ledger/modules/CaducousFeederDetection.kt @@ -0,0 +1,46 @@ +package moe.nea.ledger.modules + +import moe.nea.ledger.ItemChange +import moe.nea.ledger.LedgerEntry +import moe.nea.ledger.LedgerLogger +import moe.nea.ledger.TransactionType +import moe.nea.ledger.events.GuiClickEvent +import moe.nea.ledger.gen.ItemIds +import moe.nea.ledger.getDisplayNameU +import moe.nea.ledger.getInternalId +import moe.nea.ledger.unformattedString +import moe.nea.ledger.utils.di.Inject +import net.minecraft.client.Minecraft +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.time.Instant + +class CaducousFeederDetection { + + @Inject + lateinit var logger: LedgerLogger + + @Inject + lateinit var minecraft: Minecraft + + @SubscribeEvent + fun onFeederClick(event: GuiClickEvent) { + val slot = event.slotIn ?: return + val displayName = slot.inventory.displayName.unformattedText + if (!displayName.unformattedString().contains("Confirm Caducous Feeder")) return + val stack = slot.stack ?: return + val player = minecraft.thePlayer ?: return + val hasCarrotCandy = player.inventory.mainInventory.any { it?.getInternalId() == ItemIds.ULTIMATE_CARROT_CANDY } + + if (hasCarrotCandy && stack.getDisplayNameU() == "§aUse Caducous Feeder") { + logger.logEntry( + LedgerEntry( + TransactionType.CADUCOUS_FEEDER_USED, + Instant.now(), + listOf( + ItemChange.lose(ItemIds.ULTIMATE_CARROT_CANDY, 1) + ) + ) + ) + } + } +}
\ No newline at end of file |