From 3154264c4b895f5dd8f84ddff12b6bff9a075400 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Wed, 3 Apr 2024 15:12:37 +0200 Subject: Fix: All Names Party Tab (#1340) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../at/hannibal2/skyhanni/features/commands/PartyCommands.kt | 4 +++- .../features/commands/tabcomplete/PlayerTabComplete.kt | 10 +++------- src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt | 11 +++++++++++ 3 files changed, 17 insertions(+), 8 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt index 2d595eef7..e58d6c275 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.data.PartyAPI import at.hannibal2.skyhanni.events.MessageSendToServerEvent import at.hannibal2.skyhanni.features.misc.limbo.LimboTimeTracker import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.EntityUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object PartyCommands { @@ -93,7 +94,8 @@ object PartyCommands { } else { emptyList() } - return friends + getPartyCommands() + val allOnLobby = EntityUtils.getPlayerEntities().map { it.name } + return friends + getPartyCommands() + allOnLobby } return null } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt index 014df63f7..4be8b51b8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt @@ -6,9 +6,7 @@ import at.hannibal2.skyhanni.data.FriendAPI import at.hannibal2.skyhanni.data.PartyAPI import at.hannibal2.skyhanni.data.jsonobjects.repo.VipVisitsJson import at.hannibal2.skyhanni.events.RepositoryReloadEvent -import at.hannibal2.skyhanni.utils.EntityUtils.isNPC -import net.minecraft.client.Minecraft -import net.minecraft.client.entity.EntityOtherPlayerMP +import at.hannibal2.skyhanni.utils.EntityUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object PlayerTabComplete { @@ -59,10 +57,8 @@ object PlayerTabComplete { } if (config.islandPlayers && PlayerCategory.ISLAND_PLAYERS !in ignored) { - for (entity in Minecraft.getMinecraft().theWorld.playerEntities) { - if (!entity.isNPC() && entity is EntityOtherPlayerMP) { - add(entity.name) - } + for (entity in EntityUtils.getPlayerEntities()) { + add(entity.name) } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index 3a86c8b54..b2ffc2826 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.utils.LocationUtils.distanceTo import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import net.minecraft.block.state.IBlockState import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.entity.Entity import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand @@ -58,6 +59,16 @@ object EntityUtils { } } + fun getPlayerEntities(): MutableList { + val list = mutableListOf() + for (entity in Minecraft.getMinecraft().theWorld.playerEntities) { + if (!entity.isNPC() && entity is EntityOtherPlayerMP) { + list.add(entity) + } + } + return list + } + fun EntityLivingBase.getAllNameTagsInRadiusWith( contains: String, radius: Double = 3.0, -- cgit