Fix skin in Player Overview and first person on 1.8.9 (fixes #749)

No clue why `getResourceLocationForPlayerUUID` was implemented the way it was,
that commit dates back to 2015 (332c36a), but if the skin isn't loaded yet, it
won't load it, so sometimes it just won't show properly in first person and in
the Player Overview.
This commit just calls `AbstractClientPlayer.getSkinTexture` instead.

Unclear which MC versions are affected. At some point before 1.16.4 something
else was introduced which loads the skin for us, hence why modern versions were
not affected.
This commit is contained in:
Jonas Herzig
2022-07-17 16:02:41 +02:00
parent 3526ec526c
commit 42aef017c1
3 changed files with 5 additions and 34 deletions

View File

@@ -1,6 +1,5 @@
package com.replaymod.extras.playeroverview;
import com.replaymod.core.utils.Utils;
import com.replaymod.replay.ReplayModReplay;
import de.johni0702.minecraft.gui.GuiRenderer;
import de.johni0702.minecraft.gui.RenderInfo;
@@ -20,6 +19,7 @@ import de.johni0702.minecraft.gui.layout.HorizontalLayout;
import de.johni0702.minecraft.gui.utils.Colors;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Identifier;
@@ -94,7 +94,8 @@ public class PlayerOverviewGui extends GuiScreen implements Closeable {
Collections.sort(players, new PlayerComparator()); // Sort by name, spectators last
for (final PlayerEntity p : players) {
final Identifier texture = Utils.getResourceLocationForPlayerUUID(p.getUuid());
if (!(p instanceof AbstractClientPlayerEntity)) continue;
final Identifier texture = ((AbstractClientPlayerEntity) p).getSkinTexture();
final GuiClickable panel = new GuiClickable().setLayout(new HorizontalLayout().setSpacing(2)).addElements(
new HorizontalLayout.Data(0.5), new GuiImage() {
@Override