Skip to content

Commit

Permalink
Merge branch '1.18.x' into 1.19.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Gu-ZT committed Feb 16, 2023
2 parents 41872b3 + 6f0aa5e commit a419d46
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.4
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.4
loader_version=0.14.13
# Mod Properties
mod_version=1.0.0
Expand Down
17 changes: 13 additions & 4 deletions src/main/java/dev/dubhe/bugjump/mixin/FontStorageMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import net.minecraft.client.font.FontStorage;
import net.minecraft.client.font.Glyph;
import net.minecraft.client.font.RenderableGlyph;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -14,15 +16,22 @@
public abstract class FontStorageMixin {
@Shadow
@Final
private Int2ObjectMap<FontStorage.GlyphPair> glyphCache;
private Int2ObjectMap<Glyph> glyphCache;

@Shadow
protected abstract FontStorage.GlyphPair findGlyph(int codePoint);
@Nullable
protected abstract Glyph getEmptyGlyph(int codePoint);

@Shadow
protected abstract RenderableGlyph getRenderableGlyph(int codePoint);

@Inject(method = "getGlyph", at = @At("HEAD"), cancellable = true)
private synchronized void getGlyph(int codePoint, boolean validateAdvance, CallbackInfoReturnable<Glyph> cir) {
private synchronized void getGlyph(int codePoint, CallbackInfoReturnable<Glyph> cir) {
cir.setReturnValue(
this.glyphCache.computeIfAbsent(codePoint, this::findGlyph).getGlyph(validateAdvance)
this.glyphCache.computeIfAbsent(codePoint, (codePointx) -> {
Glyph glyph = this.getEmptyGlyph(codePointx);
return (Glyph) (glyph == null ? this.getRenderableGlyph(codePointx) : glyph);
})
);
}
}
2 changes: 0 additions & 2 deletions src/main/resources/bugjump.accesswidener
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
accessWidener v1 named
accessible class net/minecraft/client/font/FontStorage$GlyphPair
accessible method net/minecraft/client/font/FontStorage$GlyphPair getGlyph (Z)Lnet/minecraft/client/font/Glyph;
accessible method net/minecraft/client/gui/DrawableHelper drawTexturedQuad (Lnet/minecraft/util/math/Matrix4f;IIIIIFFFF)V

0 comments on commit a419d46

Please sign in to comment.