Update CustomPlayerListHud.java

Fix invisible player heads, thanks to IMS#7902 on Discord
This commit is contained in:
Ethan Chapman 2021-06-21 23:44:51 -04:00
parent d0dfe0b721
commit 6cea86f9cf

View file

@ -18,6 +18,7 @@ import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.hud.PlayerListHud; import net.minecraft.client.gui.hud.PlayerListHud;
import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.network.PlayerListEntry; import net.minecraft.client.network.PlayerListEntry;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.entity.PlayerModelPart; import net.minecraft.client.render.entity.PlayerModelPart;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -135,7 +136,7 @@ public final class CustomPlayerListHud {
int ab = t + ai * 9; int ab = t + ai * 9;
DrawableHelper.fill(stack, aa, ab, aa + r, ab + 8, w); DrawableHelper.fill(stack, aa, ab, aa + r, ab + 8, w);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
//RenderSystem.enableAlphaTest(); RenderSystem.setShader(GameRenderer::getPositionColorShader);
RenderSystem.enableBlend(); RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc(); RenderSystem.defaultBlendFunc();
if (x < playerList.size()) { if (x < playerList.size()) {
@ -145,7 +146,7 @@ public final class CustomPlayerListHud {
if (displayPlayerIcons) { if (displayPlayerIcons) {
PlayerEntity playerEntity = mc.world.getPlayerByUuid(gameProfile.getId()); PlayerEntity playerEntity = mc.world.getPlayerByUuid(gameProfile.getId());
boolean bl2 = playerEntity != null && playerEntity.isPartVisible(PlayerModelPart.CAPE) && ("Dinnerbone".equals(gameProfile.getName()) || "Grumm".equals(gameProfile.getName())); boolean bl2 = playerEntity != null && playerEntity.isPartVisible(PlayerModelPart.CAPE) && ("Dinnerbone".equals(gameProfile.getName()) || "Grumm".equals(gameProfile.getName()));
mc.getTextureManager().bindTexture(player.getSkinTexture()); RenderSystem.setShaderTexture(0, player.getSkinTexture());
ah = 8 + (bl2 ? 8 : 0); ah = 8 + (bl2 ? 8 : 0);
int ad = 8 * (bl2 ? -1 : 1); int ad = 8 * (bl2 ? -1 : 1);
DrawableHelper.drawTexture(stack, aa, ab, 8, 8, 8.0F, (float)ah, 8, ad, 64, 64); DrawableHelper.drawTexture(stack, aa, ab, 8, 8, 8.0F, (float)ah, 8, ad, 64, 64);