aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/garden
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-03-07 21:46:17 +1100
committerGitHub <noreply@github.com>2024-03-07 11:46:17 +0100
commit7facd340b6e51d862a9e32977e56a7b0f69f3da0 (patch)
tree977d9d9c01518f660ed1b461e1ff2d3fc51d2612 /src/main/java/at/hannibal2/skyhanni/features/garden
parent1181ef837104b4a5f68de6cf5793b21ad7573e03 (diff)
downloadskyhanni-7facd340b6e51d862a9e32977e56a7b0f69f3da0.tar.gz
skyhanni-7facd340b6e51d862a9e32977e56a7b0f69f3da0.tar.bz2
skyhanni-7facd340b6e51d862a9e32977e56a7b0f69f3da0.zip
Backend: Use less forge events (#1085)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt6
3 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
index 586906554..e1a02630a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
@@ -68,6 +68,10 @@ class GardenOptimalSpeed {
@SubscribeEvent
fun onGuiOpen(event: GuiOpenEvent) {
+ if (!isRancherOverlayEnabled()) return
+ val gui = event.gui
+ if (gui !is GuiEditSign) return
+ if (!gui.isRancherSign()) return
rancherOverlayList = CropType.entries.map { crop ->
listOf(crop.icon, Renderable.link("${crop.cropName} - ${crop.getOptimalSpeed()}") {
LorenzUtils.setTextIntoSign("${crop.getOptimalSpeed()}")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
index 11669cece..d63127c87 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
@@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent
import at.hannibal2.skyhanni.events.ProfileJoinEvent
import at.hannibal2.skyhanni.events.SackDataUpdateEvent
+import at.hannibal2.skyhanni.events.SkyHanniRenderEntityEvent
import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptEvent
import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptedEvent
import at.hannibal2.skyhanni.events.garden.visitor.VisitorArrivalEvent
@@ -63,7 +64,6 @@ import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.item.ItemStack
import net.minecraftforge.client.event.GuiScreenEvent.DrawScreenEvent
-import net.minecraftforge.client.event.RenderLivingEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.math.round
@@ -593,7 +593,7 @@ class GardenVisitorFeatures {
}
@SubscribeEvent(priority = EventPriority.HIGH)
- fun onRenderLiving(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) {
+ fun onRenderLiving(event: SkyHanniRenderEntityEvent.Specials.Pre<EntityLivingBase>) {
if (!config.coloredName) return
val entity = event.entity
val entityId = entity.entityId
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt
index dac868528..85fb441ab 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.garden.visitor
import at.hannibal2.skyhanni.config.features.garden.visitor.VisitorConfig
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
+import at.hannibal2.skyhanni.events.GuiKeyPressEvent
import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
@@ -29,7 +30,6 @@ import net.minecraft.client.Minecraft
import net.minecraft.client.gui.inventory.GuiContainer
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.network.play.client.C02PacketUseEntity
-import net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent
import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -119,10 +119,10 @@ class VisitorListener {
}
@SubscribeEvent
- fun onKeybind(event: KeyboardInputEvent.Post) {
+ fun onKeybind(event: GuiKeyPressEvent) {
if (!VisitorAPI.inInventory) return
if (!config.acceptHotkey.isKeyHeld()) return
- val inventory = event.gui as? AccessorGuiContainer ?: return
+ val inventory = event.guiContainer as? AccessorGuiContainer ?: return
inventory as GuiContainer
val slot = inventory.inventorySlots.getSlot(29)
inventory.handleMouseClick_skyhanni(slot, slot.slotIndex, 0, 0)