Fix "overlayMessage" rendering in ForgeIngameGui being different than vanilla (#6748)

This commit is contained in:
Take Weiland 2020-06-07 17:47:59 +02:00 committed by GitHub
parent 28f7b5d885
commit 5dbea9ea8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -675,17 +675,18 @@ public class ForgeIngameGui extends IngameGui
{ {
mc.getProfiler().startSection("overlayMessage"); mc.getProfiler().startSection("overlayMessage");
float hue = (float)overlayMessageTime - partialTicks; float hue = (float)overlayMessageTime - partialTicks;
int opacity = (int)(hue * 256.0F / 20.0F); int opacity = (int)(hue * 255.0F / 20.0F);
if (opacity > 255) opacity = 255; if (opacity > 255) opacity = 255;
if (opacity > 0) if (opacity > 8)
{ {
RenderSystem.pushMatrix(); RenderSystem.pushMatrix();
RenderSystem.translatef((float)(width / 2), (float)(height - 68), 0.0F); RenderSystem.translatef((float)(width / 2), (float)(height - 68), 0.0F);
RenderSystem.enableBlend(); RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc(); RenderSystem.defaultBlendFunc();
int color = (animateOverlayMessageColor ? MathHelper.hsvToRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE); int color = (animateOverlayMessageColor ? MathHelper.hsvToRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE);
fontrenderer.drawStringWithShadow(overlayMessage, -fontrenderer.getStringWidth(overlayMessage) / 2, -4, color | (opacity << 24)); renderTextBackground(fontrenderer, -4, fontrenderer.getStringWidth(overlayMessage));
fontrenderer.drawString(overlayMessage, -fontrenderer.getStringWidth(overlayMessage) / 2, -4, color | (opacity << 24));
RenderSystem.disableBlend(); RenderSystem.disableBlend();
RenderSystem.popMatrix(); RenderSystem.popMatrix();
} }

View file

@ -17,6 +17,7 @@ protected net.minecraft.client.gui.IngameGui func_194802_a(Lnet/minecraft/scoreb
protected net.minecraft.client.gui.IngameGui func_194805_e(F)V protected net.minecraft.client.gui.IngameGui func_194805_e(F)V
protected net.minecraft.client.gui.IngameGui func_194808_p()V protected net.minecraft.client.gui.IngameGui func_194808_p()V
protected net.minecraft.client.gui.IngameGui func_212303_b(Lnet/minecraft/entity/Entity;)V protected net.minecraft.client.gui.IngameGui func_212303_b(Lnet/minecraft/entity/Entity;)V
protected net.minecraft.client.gui.IngameGui func_212909_a(Lnet/minecraft/client/gui/FontRenderer;II)V # renderTextBackground
public net.minecraft.client.gui.ScreenManager func_216911_a(Lnet/minecraft/inventory/container/ContainerType;Lnet/minecraft/client/gui/ScreenManager$IScreenFactory;)V # registerFactory public net.minecraft.client.gui.ScreenManager func_216911_a(Lnet/minecraft/inventory/container/ContainerType;Lnet/minecraft/client/gui/ScreenManager$IScreenFactory;)V # registerFactory
public net.minecraft.client.gui.ScreenManager$IScreenFactory public net.minecraft.client.gui.ScreenManager$IScreenFactory
protected net.minecraft.client.gui.overlay.DebugOverlayGui field_211537_g # rayTraceBlock protected net.minecraft.client.gui.overlay.DebugOverlayGui field_211537_g # rayTraceBlock