Do not cache supported glyphs in lazy provider
This commit is contained in:
parent
02f486ebf4
commit
2050516bf1
|
|
@ -4,7 +4,6 @@ import com.mojang.blaze3d.font.GlyphInfo;
|
||||||
import com.mojang.blaze3d.font.GlyphProvider;
|
import com.mojang.blaze3d.font.GlyphProvider;
|
||||||
import com.mojang.datafixers.util.Either;
|
import com.mojang.datafixers.util.Either;
|
||||||
import com.mojang.serialization.MapCodec;
|
import com.mojang.serialization.MapCodec;
|
||||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||||
import net.minecraft.client.gui.font.providers.GlyphProviderDefinition;
|
import net.minecraft.client.gui.font.providers.GlyphProviderDefinition;
|
||||||
import net.minecraft.client.gui.font.providers.GlyphProviderType;
|
import net.minecraft.client.gui.font.providers.GlyphProviderType;
|
||||||
|
|
@ -21,8 +20,6 @@ public class LazyGlyphProvider implements GlyphProvider {
|
||||||
|
|
||||||
private SoftReference<GlyphProvider> innerProvider = new SoftReference<>(null);
|
private SoftReference<GlyphProvider> innerProvider = new SoftReference<>(null);
|
||||||
|
|
||||||
private IntSet supportedGlyphs;
|
|
||||||
|
|
||||||
LazyGlyphProvider(GlyphProviderDefinition.Loader loader, ResourceManager manager) {
|
LazyGlyphProvider(GlyphProviderDefinition.Loader loader, ResourceManager manager) {
|
||||||
this.loader = loader;
|
this.loader = loader;
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
|
|
@ -61,16 +58,13 @@ public class LazyGlyphProvider implements GlyphProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized IntSet getSupportedGlyphs() {
|
public IntSet getSupportedGlyphs() {
|
||||||
if (supportedGlyphs == null) {
|
var prov = getGlyphProvider();
|
||||||
var prov = getGlyphProvider();
|
if (prov != null) {
|
||||||
if (prov != null) {
|
return prov.getSupportedGlyphs();
|
||||||
supportedGlyphs = new IntOpenHashSet(prov.getSupportedGlyphs());
|
} else {
|
||||||
} else {
|
return IntSet.of();
|
||||||
supportedGlyphs = IntSet.of();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return supportedGlyphs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Definition implements GlyphProviderDefinition {
|
private static class Definition implements GlyphProviderDefinition {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user