Skip to content

Commit

Permalink
fix player head rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
RacoonDog authored and arlomcwalter committed Dec 23, 2022
1 parent b7d8481 commit 70876a9
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import net.minecraft.network.message.MessageSignatureData;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand Down Expand Up @@ -111,8 +112,12 @@ private void onRender(MatrixStack matrices, int currentTick, int mouseX, int mou
double g = 9.0D * (mc.options.getChatLineSpacing().getValue() + 1.0D);
double h = -8.0D * (mc.options.getChatLineSpacing().getValue() + 1.0D) + 4.0D * mc.options.getChatLineSpacing().getValue() + 8.0D;

float chatScale = (float) this.getChatScale();
float scaledHeight = mc.getWindow().getScaledHeight();

matrices.push();
matrices.translate(2, -0.1f, 10);
matrices.scale(chatScale, chatScale, 1.0f);
matrices.translate(2.0f, MathHelper.floor((scaledHeight - 40) / chatScale) - g - 0.1f, 10.0f);
RenderSystem.enableBlend();
for(int m = 0; m + this.scrolledLines < this.visibleMessages.size() && m < maxLineCount; ++m) {
ChatHudLine.Visible chatHudLine = this.visibleMessages.get(m + this.scrolledLines);
Expand Down Expand Up @@ -153,6 +158,9 @@ private static double getMessageOpacityMultiplier(int age) {
@Final
private List<ChatHudLine> messages;

@Shadow
public abstract double getChatScale();

private void drawIcon(MatrixStack matrices, String line, int y, float opacity) {
if (METEOR_PREFIX_REGEX.matcher(line).find()) {
RenderSystem.setShaderTexture(0, METEOR_CHAT_ICON);
Expand Down

0 comments on commit 70876a9

Please sign in to comment.