diff options
| author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-03-07 21:46:17 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-07 11:46:17 +0100 |
| commit | 7facd340b6e51d862a9e32977e56a7b0f69f3da0 (patch) | |
| tree | 977d9d9c01518f660ed1b461e1ff2d3fc51d2612 /src/main/java/at/hannibal2/skyhanni/features/misc | |
| parent | 1181ef837104b4a5f68de6cf5793b21ad7573e03 (diff) | |
| download | skyhanni-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/misc')
3 files changed, 9 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt index d8409416b..cd842f6bb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.misc.HideArmorConfig.ModeEntry +import at.hannibal2.skyhanni.events.SkyHanniRenderEntityEvent import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.EntityUtils.getArmorInventory import at.hannibal2.skyhanni.utils.EntityUtils.hasPotionEffect @@ -13,7 +14,6 @@ import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.player.EntityPlayer import net.minecraft.item.ItemStack import net.minecraft.potion.Potion -import net.minecraftforge.client.event.RenderLivingEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HideArmor { @@ -38,7 +38,7 @@ class HideArmor { } @SubscribeEvent - fun onRenderLivingPre(event: RenderLivingEvent.Pre<EntityLivingBase>) { + fun onRenderLivingPre(event: SkyHanniRenderEntityEvent.Pre<EntityLivingBase>) { val entity = event.entity if (!shouldHideArmor(entity)) return val armorInventory = entity.getArmorInventory() ?: return @@ -56,7 +56,7 @@ class HideArmor { } @SubscribeEvent - fun onRenderLivingPost(event: RenderLivingEvent.Post<EntityLivingBase>) { + fun onRenderLivingPost(event: SkyHanniRenderEntityEvent.Post<EntityLivingBase>) { val entity = event.entity if (!shouldHideArmor(entity)) return val armorInventory = entity.getArmorInventory() ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt index 71ee70b55..aacec8be7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc.items import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.events.GuiKeyPressEvent import at.hannibal2.skyhanni.events.InventoryUpdatedEvent import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.InventoryUtils @@ -17,8 +18,6 @@ import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern -import net.minecraft.client.gui.inventory.GuiContainer -import net.minecraftforge.client.event.GuiScreenEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AuctionHouseCopyUnderbidPrice { @@ -57,13 +56,11 @@ class AuctionHouseCopyUnderbidPrice { } @SubscribeEvent - fun onKeybind(event: GuiScreenEvent.KeyboardInputEvent.Post) { + fun onKeybind(event: GuiKeyPressEvent) { if (!config.copyUnderbidKeybind.isKeyHeld()) return if (!LorenzUtils.inSkyBlock) return if (!allowedInventoriesPattern.matches(InventoryUtils.openInventoryName())) return - - val gui = event.gui as? GuiContainer ?: return - val stack = gui.slotUnderMouse?.stack ?: return + val stack = event.guiContainer.slotUnderMouse?.stack ?: return val lore = stack.getLore() for (line in lore) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt index 3b08970cf..fa2f5c551 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt @@ -2,12 +2,12 @@ package at.hannibal2.skyhanni.features.misc.teleportpad import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.SkyHanniRenderEntityEvent import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand -import net.minecraftforge.client.event.RenderLivingEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -23,8 +23,8 @@ class TeleportPadCompactName { ) @SubscribeEvent(priority = EventPriority.HIGH) - fun onRenderLivingB(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) { - if (!IslandType.PRIVATE_ISLAND.isInIsland()) return + fun onRenderLivingB(event: SkyHanniRenderEntityEvent.Specials.Pre<EntityLivingBase>) { + if (!IslandType.PRIVATE_ISLAND.isInIsland()) return if (!SkyHanniMod.feature.misc.teleportPad.compactName) return val entity = event.entity if (entity !is EntityArmorStand) return |
