diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-04-03 15:12:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-03 15:12:37 +0200 |
commit | 3154264c4b895f5dd8f84ddff12b6bff9a075400 (patch) | |
tree | fcd51b7ff2b0afe768c0f567373f5eafef65ccb2 /src/main | |
parent | 046007d70f5d22be540b9a27d00d8b5aff645f4a (diff) | |
download | skyhanni-3154264c4b895f5dd8f84ddff12b6bff9a075400.tar.gz skyhanni-3154264c4b895f5dd8f84ddff12b6bff9a075400.tar.bz2 skyhanni-3154264c4b895f5dd8f84ddff12b6bff9a075400.zip |
Fix: All Names Party Tab (#1340)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main')
3 files changed, 17 insertions, 8 deletions
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<String>() } - 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<EntityOtherPlayerMP> { + val list = mutableListOf<EntityOtherPlayerMP>() + 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, |