From 6c968778dab9c04b0ff4fec7b4eb61f36e23660d Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Wed, 17 Apr 2024 17:49:07 +0200 Subject: Fix: Removed the Player (#1473) --- .../hannibal2/skyhanni/config/features/dev/DebugMobConfig.java | 2 +- src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt | 2 +- src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt | 10 ++-------- src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt | 2 +- 4 files changed, 5 insertions(+), 11 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugMobConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugMobConfig.java index 709aa883e..c149b6195 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugMobConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugMobConfig.java @@ -44,7 +44,7 @@ public class DebugMobConfig { public boolean logEvents = false; @Expose - @ConfigOption(name = "Show RayHit", desc = "Highlights the mob that is currently in front of your view (only SkyblockMob).") + @ConfigOption(name = "Show RayHit", desc = "Highlights the mob that is currently in front of your view.") @ConfigEditorBoolean public boolean showRayHit = false; diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt index a1e894d32..bb9eb7ac0 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt @@ -46,7 +46,7 @@ class MobDebug { fun onWorldRenderDebug(event: LorenzRenderWorldEvent) { if (config.showRayHit || config.showInvisible) { lastRayHit = MobUtils.rayTraceForMobs(Minecraft.getMinecraft().thePlayer, event.partialTicks) - ?.firstOrNull { it.canBeSeen() && (config.showInvisible || it.isInvisible()) } + ?.firstOrNull { it.canBeSeen() && (!config.showInvisible || !it.isInvisible()) } } if (config.skyblockMob.isHighlight()) { 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 d3f8601d2..b31b2a47b 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt @@ -8,7 +8,6 @@ import at.hannibal2.skyhanni.data.mob.MobFilter.isRealPlayer import at.hannibal2.skyhanni.data.mob.MobFilter.isSkyBlockMob import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent -import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.MobEvent import at.hannibal2.skyhanni.events.PacketEvent @@ -20,7 +19,7 @@ import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.getLorenzVec -import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityPlayerSP import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.EntityCreeper @@ -96,7 +95,7 @@ class MobDetection { MobData.previousEntityLiving.addAll(MobData.currentEntityLiving) MobData.currentEntityLiving.clear() MobData.currentEntityLiving.addAll(EntityUtils.getEntities() - .filter { it !is EntityArmorStand }) + .filter { it !is EntityArmorStand && it !is EntityPlayerSP }) if (forceReset) { MobData.currentEntityLiving.clear() // Naturally removing the mobs using the despawn @@ -319,11 +318,6 @@ class MobDetection { } } - @SubscribeEvent - fun onIslandChange(event: IslandChangeEvent) { - MobData.currentEntityLiving.remove(Minecraft.getMinecraft().thePlayer) // Fix for the Player - } - private val allEntitiesViaPacketId = mutableSetOf() private fun addEntityUpdate(id: Int) = if (allEntitiesViaPacketId.contains(id)) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt index e1b165d25..1c632bcee 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt @@ -72,7 +72,7 @@ object MobUtils { ) }.values if (possibleEntities.isEmpty()) return null - return possibleEntities.distinct().sortedBy { it.baseEntity.distanceTo(pos) }.drop(1) // drop to remove player + return possibleEntities.distinct().sortedBy { it.baseEntity.distanceTo(pos) } } val EntityLivingBase.mob get() = MobData.entityToMob[this] -- cgit