diff --git a/src/main/java/net/wurstclient/util/FakePlayerEntity.java b/src/main/java/net/wurstclient/util/FakePlayerEntity.java index 0d999cca36..9ba7fe637d 100644 --- a/src/main/java/net/wurstclient/util/FakePlayerEntity.java +++ b/src/main/java/net/wurstclient/util/FakePlayerEntity.java @@ -7,8 +7,14 @@ */ package net.wurstclient.util; +import java.util.UUID; + +import org.jetbrains.annotations.Nullable; + +import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.network.OtherClientPlayerEntity; +import net.minecraft.client.network.PlayerListEntry; import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.Entity; import net.minecraft.entity.data.DataTracker; @@ -19,10 +25,12 @@ public class FakePlayerEntity extends OtherClientPlayerEntity { private final ClientPlayerEntity player = WurstClient.MC.player; private final ClientWorld world = WurstClient.MC.world; + private PlayerListEntry playerListEntry; public FakePlayerEntity() { super(WurstClient.MC.world, WurstClient.MC.player.getGameProfile()); + setUuid(UUID.randomUUID()); copyPositionAndRotation(player); copyInventory(); @@ -33,6 +41,16 @@ public FakePlayerEntity() spawn(); } + @Override + protected @Nullable PlayerListEntry getPlayerListEntry() + { + if(playerListEntry == null) + playerListEntry = MinecraftClient.getInstance().getNetworkHandler() + .getPlayerListEntry(getGameProfile().getId()); + + return playerListEntry; + } + private void copyInventory() { getInventory().clone(player.getInventory());