diff options
Diffstat (limited to 'src/main')
19 files changed, 69 insertions, 36 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/FmlEventApi.kt b/src/main/java/at/hannibal2/skyhanni/api/FmlEventApi.kt new file mode 100644 index 000000000..7af401401 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/api/FmlEventApi.kt @@ -0,0 +1,23 @@ +package at.hannibal2.skyhanni.api + +import at.hannibal2.skyhanni.events.entity.EntityEnterWorldEvent +import at.hannibal2.skyhanni.events.minecraft.ClientDisconnectEvent +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import net.minecraftforge.event.entity.EntityJoinWorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.network.FMLNetworkEvent + +@SkyHanniModule +object FmlEventApi { + + @SubscribeEvent + fun onDisconnect(event: FMLNetworkEvent.ClientDisconnectionFromServerEvent) { + ClientDisconnectEvent().postAndCatch() + } + + // TODO when we have generic events, make this support generics + @SubscribeEvent + fun onEntityJoinWorld(event: EntityJoinWorldEvent) { + EntityEnterWorldEvent(event.entity).postAndCatch() + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiData.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiData.kt index c0cd46365..94c43ac06 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiData.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.NEURenderEvent +import at.hannibal2.skyhanni.events.minecraft.ClientDisconnectEvent import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import io.github.moulberry.notenoughupdates.NEUApi @@ -13,7 +14,6 @@ import net.minecraftforge.client.event.GuiOpenEvent import net.minecraftforge.client.event.GuiScreenEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.network.FMLNetworkEvent import org.lwjgl.input.Keyboard object GuiData { @@ -59,7 +59,7 @@ object GuiData { } @SubscribeEvent - fun onDisconnect(event: FMLNetworkEvent.ClientDisconnectionFromServerEvent) { + fun onDisconnect(event: ClientDisconnectEvent) { preDrawEventCanceled = false } diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index dbf153c57..a46ff6de4 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.events.WidgetUpdateEvent +import at.hannibal2.skyhanni.events.minecraft.ClientDisconnectEvent import at.hannibal2.skyhanni.features.bingo.BingoAPI import at.hannibal2.skyhanni.features.dungeon.DungeonAPI import at.hannibal2.skyhanni.features.rift.RiftAPI @@ -30,7 +31,6 @@ import com.google.gson.JsonObject import io.github.moulberry.notenoughupdates.NotEnoughUpdates import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.network.FMLNetworkEvent import kotlin.concurrent.thread import kotlin.time.Duration.Companion.seconds @@ -116,7 +116,7 @@ class HypixelData { var locrawData: JsonObject? = null private var locraw: MutableMap<String, String> = listOf( "server", "gametype", "lobbyname", "lobbytype", "mode", "map" - ).associate { it to "" }.toMutableMap() + ).associateWith { "" }.toMutableMap() val server get() = locraw["server"] ?: "" val gameType get() = locraw["gametype"] ?: "" @@ -236,7 +236,7 @@ class HypixelData { } @SubscribeEvent - fun onDisconnect(event: FMLNetworkEvent.ClientDisconnectionFromServerEvent) { + fun onDisconnect(event: ClientDisconnectEvent) { hypixelLive = false hypixelAlpha = false skyBlock = false diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt index a521e2354..f85e63420 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt @@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.MobEvent import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.events.minecraft.ClientDisconnectEvent import at.hannibal2.skyhanni.utils.CollectionUtils.drainForEach import at.hannibal2.skyhanni.utils.CollectionUtils.drainTo import at.hannibal2.skyhanni.utils.CollectionUtils.put @@ -31,7 +32,6 @@ import net.minecraft.network.play.server.S01PacketJoinGame import net.minecraft.network.play.server.S0CPacketSpawnPlayer import net.minecraft.network.play.server.S0FPacketSpawnMob import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.network.FMLNetworkEvent import java.util.concurrent.ConcurrentLinkedQueue import java.util.concurrent.atomic.AtomicBoolean @@ -331,7 +331,7 @@ class MobDetection { } @SubscribeEvent - fun onDisconnect(event: FMLNetworkEvent.ClientDisconnectionFromServerEvent) { + fun onDisconnect(event: ClientDisconnectEvent) { shouldClear.set(true) } diff --git a/src/main/java/at/hannibal2/skyhanni/events/entity/EntityEnterWorldEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/entity/EntityEnterWorldEvent.kt new file mode 100644 index 000000000..14283f2fe --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/entity/EntityEnterWorldEvent.kt @@ -0,0 +1,6 @@ +package at.hannibal2.skyhanni.events.entity + +import at.hannibal2.skyhanni.events.LorenzEvent +import net.minecraft.entity.Entity + +class EntityEnterWorldEvent(val entity: Entity) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/minecraft/ClientDisconnectEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/minecraft/ClientDisconnectEvent.kt new file mode 100644 index 000000000..b041fc595 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/minecraft/ClientDisconnectEvent.kt @@ -0,0 +1,5 @@ +package at.hannibal2.skyhanni.events.minecraft + +import at.hannibal2.skyhanni.events.LorenzEvent + +class ClientDisconnectEvent : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt index ca761b580..21a70fe4e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt @@ -15,6 +15,7 @@ import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.SkyHanniRenderEntityEvent +import at.hannibal2.skyhanni.events.entity.EntityEnterWorldEvent import at.hannibal2.skyhanni.features.dungeon.DungeonAPI import at.hannibal2.skyhanni.features.slayer.blaze.HellionShield import at.hannibal2.skyhanni.features.slayer.blaze.setHellionShield @@ -54,7 +55,6 @@ import net.minecraft.entity.monster.EntityEnderman import net.minecraft.entity.monster.EntityMagmaCube import net.minecraft.entity.monster.EntityZombie import net.minecraft.entity.passive.EntityWolf -import net.minecraftforge.event.entity.EntityJoinWorldEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.UUID @@ -850,7 +850,7 @@ class DamageIndicatorManager { } @SubscribeEvent - fun onEntityJoin(event: EntityJoinWorldEvent) { + fun onEntityJoin(event: EntityEnterWorldEvent) { mobFinder?.handleNewEntity(event.entity) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt index d296680c0..85bb5fb74 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.EntityCustomNameUpdateEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.events.entity.EntityEnterWorldEvent import at.hannibal2.skyhanni.features.event.winter.UniqueGiftCounter import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.utils.ColorUtils.withAlpha @@ -23,7 +24,6 @@ import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.player.EntityPlayer -import net.minecraftforge.event.entity.EntityJoinWorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object UniqueGiftingOpportunitiesFeatures { @@ -72,13 +72,13 @@ object UniqueGiftingOpportunitiesFeatures { } @SubscribeEvent - fun onEntityJoinWorld(event: EntityJoinWorldEvent) { + fun onEntityJoinWorld(event: EntityEnterWorldEvent) { playerColor(event) val entity = event.entity as? EntityArmorStand ?: return analyzeArmorStand(entity) } - private fun playerColor(event: EntityJoinWorldEvent) { + private fun playerColor(event: EntityEnterWorldEvent) { if (event.entity is EntityOtherPlayerMP) { val entity = event.entity as EntityOtherPlayerMP if (entity.isNPC() || isIronman(entity) || isBingo(entity)) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt index f49376e37..a2842c5ba 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.Perk import at.hannibal2.skyhanni.data.PetAPI import at.hannibal2.skyhanni.events.diana.InquisitorFoundEvent +import at.hannibal2.skyhanni.events.entity.EntityEnterWorldEvent import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils @@ -11,7 +12,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.item.ItemStack -import net.minecraftforge.event.entity.EntityJoinWorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object DianaAPI { @@ -32,7 +32,7 @@ object DianaAPI { private fun hasSpadeInInventory() = InventoryUtils.getItemsInOwnInventory().any { it.isDianaSpade } @SubscribeEvent - fun onJoinWorld(event: EntityJoinWorldEvent) { + fun onJoinWorld(event: EntityEnterWorldEvent) { if (!LorenzUtils.inSkyBlock) return val entity = event.entity 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) 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 f16750eda..d0e68b41b 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 @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.GuiKeyPressEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent +import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent @@ -22,16 +23,15 @@ import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matches +import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern 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.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds @@ -138,7 +138,7 @@ class VisitorListener { } @SubscribeEvent(priority = EventPriority.HIGH) - fun onTooltip(event: ItemTooltipEvent) { + fun onTooltip(event: LorenzToolTipEvent) { if (!GardenAPI.onBarnPlot) return if (!VisitorAPI.inInventory) return val visitor = VisitorAPI.getVisitor(lastClickedNpc) ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt index b62f65cad..67cdce92b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.visitor import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI.ACCEPT_SLOT import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI.REFUSE_SLOT @@ -17,7 +18,6 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawBorder import at.hannibal2.skyhanni.utils.RenderUtils.highlight import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.inventory.Slot -import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.math.absoluteValue @@ -85,7 +85,7 @@ class VisitorRewardWarning { } @SubscribeEvent(priority = EventPriority.HIGH) - fun onTooltip(event: ItemTooltipEvent) { + fun onTooltip(event: LorenzToolTipEvent) { if (!GardenAPI.onBarnPlot) return if (!VisitorAPI.inInventory) return val visitor = VisitorAPI.getVisitor(lastClickedNpc) ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt index 4478114ec..1198456ed 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt @@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.RenderItemTipEvent +import at.hannibal2.skyhanni.events.minecraft.ClientDisconnectEvent import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -24,7 +25,6 @@ import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.client.player.inventory.ContainerLocalMenu import net.minecraft.item.Item import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.network.FMLNetworkEvent import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds @@ -129,7 +129,7 @@ object HarpFeatures { } @SubscribeEvent - fun onLeave(event: FMLNetworkEvent.ClientDisconnectionFromServerEvent) { + fun onDisconnect(event: ClientDisconnectEvent) { if (!config.guiScale) return unSetGUIScale() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index f87dee33a..2520027bc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.jsonobjects.repo.HideNotClickableItemsJson import at.hannibal2.skyhanni.data.jsonobjects.repo.HideNotClickableItemsJson.SalvageFilter import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.garden.composter.ComposterOverlay import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI @@ -44,7 +45,6 @@ import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest import net.minecraft.item.ItemStack -import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds @@ -113,9 +113,8 @@ class HideNotClickableItems { } @SubscribeEvent(priority = EventPriority.LOWEST) - fun onTooltip(event: ItemTooltipEvent) { + fun onTooltip(event: LorenzToolTipEvent) { if (!isEnabled()) return - if (event.toolTip == null) return if (bypassActive()) return val guiChest = Minecraft.getMinecraft().currentScreen diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt index 8b5fca955..bcdf31bef 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.inventory import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.CRIMSON_ARMOR import at.hannibal2.skyhanni.data.jsonobjects.repo.ItemsJson +import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.inventory.ItemDisplayOverlayFeatures.isSelected @@ -10,7 +11,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern -import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -28,7 +28,7 @@ class ItemStars { private val armorParts = listOf("Helmet", "Chestplate", "Leggings", "Boots") @SubscribeEvent(priority = EventPriority.LOW) - fun onTooltip(event: ItemTooltipEvent) { + fun onTooltip(event: LorenzToolTipEvent) { if (!isEnabled()) return val stack = event.itemStack ?: return if (stack.stackSize != 1) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt index 2b3505f18..b7b8a610f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -16,7 +17,6 @@ import at.hannibal2.skyhanni.utils.ReflectionUtils.makeAccessible import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetExp import at.hannibal2.skyhanni.utils.StringUtils import io.github.moulberry.notenoughupdates.NotEnoughUpdates -import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -28,7 +28,7 @@ class PetExpTooltip { private val level200 = 210_255_385 @SubscribeEvent(priority = EventPriority.LOWEST) - fun onItemTooltipLow(event: ItemTooltipEvent) { + fun onItemTooltipLow(event: LorenzToolTipEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.petDisplay) return if (!KeyboardManager.isShiftKeyDown() && !config.showAlways) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt index b132561ff..f9aeab017 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt @@ -17,6 +17,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.events.SecondPassedEvent +import at.hannibal2.skyhanni.events.minecraft.ClientDisconnectEvent import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ConditionalUtils @@ -32,7 +33,6 @@ import com.jagrosh.discordipc.entities.RichPresenceButton import com.jagrosh.discordipc.entities.pipe.PipeStatus import kotlinx.coroutines.launch import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.network.FMLNetworkEvent import kotlin.time.Duration.Companion.seconds object DiscordRPCManager : IPCListener { @@ -185,7 +185,7 @@ object DiscordRPCManager : IPCListener { } @SubscribeEvent - fun onDisconnect(event: FMLNetworkEvent.ClientDisconnectionFromServerEvent) { + fun onDisconnect(event: ClientDisconnectEvent) { stop() } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt index 54fe13054..2100489ce 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt @@ -27,7 +27,7 @@ object ErrorManager { private val replace = mapOf( "at.hannibal2.skyhanni" to "SH", - "io.mouberry,notenoughupdates" to "NEU", + "io.moulberry.notenoughupdates" to "NEU", "net.minecraft." to "MC.", "net.minecraftforge.fml." to "FML.", ) |