-
-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1.21.3] Fix nametag rendering and optional text filtering (#1604)
- Loading branch information
Showing
6 changed files
with
156 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
patches/net/minecraft/client/gui/font/GlyphRenderTypes.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- a/net/minecraft/client/gui/font/GlyphRenderTypes.java | ||
+++ b/net/minecraft/client/gui/font/GlyphRenderTypes.java | ||
@@ -7,22 +_,42 @@ | ||
import net.neoforged.api.distmarker.OnlyIn; | ||
|
||
@OnlyIn(Dist.CLIENT) | ||
-public record GlyphRenderTypes(RenderType normal, RenderType seeThrough, RenderType polygonOffset) { | ||
+public record GlyphRenderTypes(RenderType normal, RenderType seeThrough, RenderType polygonOffset, RenderType normalBlur, RenderType seeThroughBlur, RenderType polygonOffsetBlur) { | ||
+ /** @deprecated Neo: Use {@link GlyphRenderTypes(RenderType,RenderType,RenderType,RenderType,RenderType,RenderType)} instead */ | ||
+ @Deprecated | ||
+ public GlyphRenderTypes(RenderType normal, RenderType seeThrough, RenderType polygonOffset) { | ||
+ this(normal, seeThrough, polygonOffset, normal, seeThrough, polygonOffset); | ||
+ } | ||
+ | ||
public static GlyphRenderTypes createForIntensityTexture(ResourceLocation p_285411_) { | ||
return new GlyphRenderTypes( | ||
RenderType.textIntensity(p_285411_), RenderType.textIntensitySeeThrough(p_285411_), RenderType.textIntensityPolygonOffset(p_285411_) | ||
+ , net.neoforged.neoforge.client.NeoForgeRenderTypes.getTextIntensityFiltered(p_285411_), | ||
+ net.neoforged.neoforge.client.NeoForgeRenderTypes.getTextIntensitySeeThroughFiltered(p_285411_), | ||
+ net.neoforged.neoforge.client.NeoForgeRenderTypes.getTextIntensityPolygonOffsetFiltered(p_285411_) | ||
); | ||
} | ||
|
||
public static GlyphRenderTypes createForColorTexture(ResourceLocation p_285486_) { | ||
- return new GlyphRenderTypes(RenderType.text(p_285486_), RenderType.textSeeThrough(p_285486_), RenderType.textPolygonOffset(p_285486_)); | ||
+ return new GlyphRenderTypes(RenderType.text(p_285486_), RenderType.textSeeThrough(p_285486_), RenderType.textPolygonOffset(p_285486_), | ||
+ net.neoforged.neoforge.client.NeoForgeRenderTypes.getTextFiltered(p_285486_), | ||
+ net.neoforged.neoforge.client.NeoForgeRenderTypes.getTextSeeThroughFiltered(p_285486_), | ||
+ net.neoforged.neoforge.client.NeoForgeRenderTypes.getTextPolygonOffsetFiltered(p_285486_) | ||
+ ); | ||
} | ||
|
||
public RenderType select(Font.DisplayMode p_285259_) { | ||
+ return this.select(p_285259_, false); | ||
+ } | ||
+ | ||
+ /** | ||
+ * Neo: returns the {@link RenderType} to use for the given {@link Font.DisplayMode} and blur setting | ||
+ */ | ||
+ public RenderType select(Font.DisplayMode p_285259_, boolean blur) { | ||
return switch (p_285259_) { | ||
- case NORMAL -> this.normal; | ||
- case SEE_THROUGH -> this.seeThrough; | ||
- case POLYGON_OFFSET -> this.polygonOffset; | ||
+ case NORMAL -> blur ? this.normalBlur : this.normal; | ||
+ case SEE_THROUGH -> blur ? this.seeThroughBlur : this.seeThrough; | ||
+ case POLYGON_OFFSET -> blur ? this.polygonOffsetBlur : this.polygonOffset; | ||
}; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
patches/net/minecraft/client/gui/font/glyphs/BakedGlyph.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- a/net/minecraft/client/gui/font/glyphs/BakedGlyph.java | ||
+++ b/net/minecraft/client/gui/font/glyphs/BakedGlyph.java | ||
@@ -75,6 +_,15 @@ | ||
p_95223_.addVertex(p_254370_, p_95221_.x0, p_95221_.y1, p_95221_.depth).setColor(p_95221_.color).setUv(this.u1, this.v0).setLight(p_95224_); | ||
} | ||
|
||
+ /** | ||
+ * Neo: returns the {@link RenderType} to use for the given {@link Font.DisplayMode} and blur setting | ||
+ */ | ||
+ public RenderType renderType(Font.DisplayMode p_181388_, boolean blur) { | ||
+ return this.renderTypes.select(p_181388_, blur); | ||
+ } | ||
+ | ||
+ /** @deprecated Neo: Use {@link #renderType(Font.DisplayMode, boolean)} instead */ | ||
+ @Deprecated | ||
public RenderType renderType(Font.DisplayMode p_181388_) { | ||
return this.renderTypes.select(p_181388_); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.