aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/fishing
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-06-05 22:32:03 +1000
committerGitHub <noreply@github.com>2024-06-05 14:32:03 +0200
commit406eaec8bd9e7ca630d1f79ffe2ddda8493778eb (patch)
tree1a3688b0629a924908476dc4787221596e92a0a4 /src/main/java/at/hannibal2/skyhanni/features/fishing
parente61f260fa2a094a43ebe1ab3d3305874dee6b716 (diff)
downloadskyhanni-406eaec8bd9e7ca630d1f79ffe2ddda8493778eb.tar.gz
skyhanni-406eaec8bd9e7ca630d1f79ffe2ddda8493778eb.tar.bz2
skyhanni-406eaec8bd9e7ca630d1f79ffe2ddda8493778eb.zip
Fix: Crash and use less forge events (#1986)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/fishing')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt
index 72a7cb131..3a7447a8d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt
@@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.ItemInHandChangeEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
+import at.hannibal2.skyhanni.events.entity.EntityEnterWorldEvent
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.getFilletValue
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity
@@ -27,7 +28,6 @@ import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.entity.projectile.EntityFishHook
import net.minecraft.init.Blocks
import net.minecraft.item.ItemStack
-import net.minecraftforge.event.entity.EntityJoinWorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object FishingAPI {
@@ -54,7 +54,7 @@ object FishingAPI {
var wearingTrophyArmor = false
@SubscribeEvent
- fun onJoinWorld(event: EntityJoinWorldEvent) {
+ fun onJoinWorld(event: EntityEnterWorldEvent) {
if (!LorenzUtils.inSkyBlock || !holdingRod) return
val entity = event.entity ?: return
if (entity !is EntityFishHook) return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt
index 32e31edf0..a11014095 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt
@@ -6,10 +6,10 @@ import at.hannibal2.skyhanni.events.FishingBobberCastEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
+import at.hannibal2.skyhanni.events.entity.EntityEnterWorldEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import net.minecraft.entity.item.EntityArmorStand
-import net.minecraftforge.event.entity.EntityJoinWorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class FishingHookDisplay {
@@ -47,9 +47,9 @@ class FishingHookDisplay {
}
@SubscribeEvent
- fun onJoinWorld(event: EntityJoinWorldEvent) {
+ fun onJoinWorld(event: EntityEnterWorldEvent) {
if (!isEnabled()) return
- val entity = event.entity ?: return
+ val entity = event.entity
if (entity !is EntityArmorStand) return
potentionArmorStands.add(entity)