From 18d9d598b851c4b1940e0a85eed0ddf0b0170af4 Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Wed, 8 Jan 2025 01:27:43 +0100 Subject: [PATCH] Merge font rendering changes again, overall cleanup --- .../features/FeaturesLoading.java | 4 + .../RenderableGlyphDiff.java | 2 +- .../BuiltinEmptyGlyph1_12_2.java | 2 +- .../replace_blank_glyph/FontCacheReload.java | 39 +++++++ .../MixinFontStorage.java | 52 ++++++++- .../settings/impl/DebugSettings.java | 7 ++ .../assets/viafabricplus/lang/de_de.json | 2 +- .../assets/viafabricplus/lang/en_us.json | 2 +- .../assets/viafabricplus/lang/ja_jp.json | 12 +- .../assets/viafabricplus/lang/ko_kr.json | 10 +- .../assets/viafabricplus/lang/lzh.json | 10 +- .../assets/viafabricplus/lang/pl_pl.json | 2 +- .../assets/viafabricplus/lang/ru_ru.json | 10 +- .../assets/viafabricplus/lang/zh_cn.json | 2 +- .../assets/viafabricplus/lang/zh_tw.json | 2 +- .../resources/viafabricplus.accesswidener | 4 + src/main/resources/viafabricplus.mixins.json | 2 +- .../visuals/ViaFabricPlusVisuals.java | 4 +- .../BuiltinEmptyGlyph1_12_2.java | 71 ------------ .../LanguageUtil.java | 2 +- .../UnicodeFontFix1_12_2.java | 2 +- .../MixinFontStorage.java | 105 ------------------ .../MixinLanguageManager.java | 4 +- .../visuals/settings/VisualSettings.java | 12 -- .../viafabricplus-visuals.accesswidener | 4 - .../viafabricplus-visuals.mixins.json | 3 +- 26 files changed, 136 insertions(+), 235 deletions(-) rename {visuals/src/main/java/com/viaversion/viafabricplus/visuals/features => src/main/java/com/viaversion/viafabricplus/features/font}/filter_non_existing_characters/RenderableGlyphDiff.java (99%) rename src/main/java/com/viaversion/viafabricplus/features/{ => font}/replace_blank_glyph/BuiltinEmptyGlyph1_12_2.java (96%) create mode 100644 src/main/java/com/viaversion/viafabricplus/features/font/replace_blank_glyph/FontCacheReload.java rename src/main/java/com/viaversion/viafabricplus/injection/mixin/features/{replace_blank_glyph => font}/MixinFontStorage.java (63%) delete mode 100644 visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/filter_non_existing_characters/BuiltinEmptyGlyph1_12_2.java rename visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/{filter_non_existing_characters => force_unicode_font}/LanguageUtil.java (94%) rename visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/{filter_non_existing_characters => force_unicode_font}/UnicodeFontFix1_12_2.java (97%) delete mode 100644 visuals/src/main/java/com/viaversion/viafabricplus/visuals/injection/mixin/filter_non_existing_characters/MixinFontStorage.java rename visuals/src/main/java/com/viaversion/viafabricplus/visuals/injection/mixin/{filter_non_existing_characters => force_unicode_font}/MixinLanguageManager.java (89%) diff --git a/src/main/java/com/viaversion/viafabricplus/features/FeaturesLoading.java b/src/main/java/com/viaversion/viafabricplus/features/FeaturesLoading.java index 078e28ec..ffc721a5 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/FeaturesLoading.java +++ b/src/main/java/com/viaversion/viafabricplus/features/FeaturesLoading.java @@ -32,6 +32,7 @@ import com.viaversion.viafabricplus.features.entity.attribute.EnchantmentAttributesEmulation1_20_6; import com.viaversion.viafabricplus.features.footstep_particle.FootStepParticle1_12_2; import com.viaversion.viafabricplus.features.networking.resource_pack_header.ResourcePackHeaderDiff; +import com.viaversion.viafabricplus.features.font.replace_blank_glyph.FontCacheReload; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import net.minecraft.client.MinecraftClient; @@ -65,6 +66,9 @@ public final class FeaturesLoading { // Reloads all bounding boxes of the blocks that we changed CollisionShapes.reloadBlockShapes(); + // Clears the font cache to replace the empty glyph + FontCacheReload.reload(); + // Reloads the clientside recipes if (newVersion.olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { Recipes1_11_2.reset(); diff --git a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/filter_non_existing_characters/RenderableGlyphDiff.java b/src/main/java/com/viaversion/viafabricplus/features/font/filter_non_existing_characters/RenderableGlyphDiff.java similarity index 99% rename from visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/filter_non_existing_characters/RenderableGlyphDiff.java rename to src/main/java/com/viaversion/viafabricplus/features/font/filter_non_existing_characters/RenderableGlyphDiff.java index bef2b45f..638b9f4a 100644 --- a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/filter_non_existing_characters/RenderableGlyphDiff.java +++ b/src/main/java/com/viaversion/viafabricplus/features/font/filter_non_existing_characters/RenderableGlyphDiff.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.visuals.features.filter_non_existing_characters; +package com.viaversion.viafabricplus.features.font.filter_non_existing_characters; import com.viaversion.viafabricplus.ViaFabricPlus; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; diff --git a/src/main/java/com/viaversion/viafabricplus/features/replace_blank_glyph/BuiltinEmptyGlyph1_12_2.java b/src/main/java/com/viaversion/viafabricplus/features/font/replace_blank_glyph/BuiltinEmptyGlyph1_12_2.java similarity index 96% rename from src/main/java/com/viaversion/viafabricplus/features/replace_blank_glyph/BuiltinEmptyGlyph1_12_2.java rename to src/main/java/com/viaversion/viafabricplus/features/font/replace_blank_glyph/BuiltinEmptyGlyph1_12_2.java index 5baca157..098cb50d 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/replace_blank_glyph/BuiltinEmptyGlyph1_12_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features/font/replace_blank_glyph/BuiltinEmptyGlyph1_12_2.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.replace_blank_glyph; +package com.viaversion.viafabricplus.features.font.replace_blank_glyph; import net.minecraft.client.font.BakedGlyph; import net.minecraft.client.font.Glyph; diff --git a/src/main/java/com/viaversion/viafabricplus/features/font/replace_blank_glyph/FontCacheReload.java b/src/main/java/com/viaversion/viafabricplus/features/font/replace_blank_glyph/FontCacheReload.java new file mode 100644 index 00000000..84a82661 --- /dev/null +++ b/src/main/java/com/viaversion/viafabricplus/features/font/replace_blank_glyph/FontCacheReload.java @@ -0,0 +1,39 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus + * Copyright (C) 2021-2025 the original authors + * - FlorianMichael/EnZaXD + * - RK_01/RaphiMC + * Copyright (C) 2023-2025 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.viaversion.viafabricplus.features.font.replace_blank_glyph; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.font.FontStorage; + +public final class FontCacheReload { + + public static void reload() { + final MinecraftClient client = MinecraftClient.getInstance(); + if (client != null) { + for (FontStorage storage : client.fontManager.fontStorages.values()) { + storage.bakedGlyphCache.clear(); + storage.glyphCache.clear(); + } + } + } + +} diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/replace_blank_glyph/MixinFontStorage.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/font/MixinFontStorage.java similarity index 63% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/features/replace_blank_glyph/MixinFontStorage.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/font/MixinFontStorage.java index a5b5ee26..fc29a071 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/replace_blank_glyph/MixinFontStorage.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/font/MixinFontStorage.java @@ -19,12 +19,18 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.features.replace_blank_glyph; +package com.viaversion.viafabricplus.injection.mixin.features.font; -import com.viaversion.viafabricplus.features.replace_blank_glyph.BuiltinEmptyGlyph1_12_2; +import com.viaversion.viafabricplus.ViaFabricPlus; +import com.viaversion.viafabricplus.features.font.filter_non_existing_characters.RenderableGlyphDiff; +import com.viaversion.viafabricplus.features.font.replace_blank_glyph.BuiltinEmptyGlyph1_12_2; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.*; +import net.minecraft.util.Identifier; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; @@ -39,18 +45,35 @@ public abstract class MixinFontStorage { @Shadow private BakedGlyph blankBakedGlyph; - @Shadow - protected abstract BakedGlyph bake(RenderableGlyph c); - + @Final + private Identifier id; @Unique private BakedGlyph viaFabricPlus$blankBakedGlyph1_12_2; + @Shadow + protected abstract BakedGlyph bake(RenderableGlyph c); + @Inject(method = "clear", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/BuiltinEmptyGlyph;bake(Ljava/util/function/Function;)Lnet/minecraft/client/font/BakedGlyph;", ordinal = 0)) private void bakeBlankGlyph1_12_2(CallbackInfo ci) { this.viaFabricPlus$blankBakedGlyph1_12_2 = BuiltinEmptyGlyph1_12_2.INSTANCE.bake(this::bake); } + @Inject(method = "findGlyph", at = @At("RETURN"), cancellable = true) + private void filterGlyphs(int codePoint, CallbackInfoReturnable cir) { + if (this.viaFabricPlusVisuals$shouldBeInvisible(codePoint)) { + cir.setReturnValue(this.viaFabricPlus$getBlankGlyphPair()); + } + } + + @Inject(method = "bake(I)Lnet/minecraft/client/font/BakedGlyph;", at = @At("RETURN"), cancellable = true) + private void filterBakedGlyph(int codePoint, CallbackInfoReturnable cir) { + if (this.viaFabricPlusVisuals$shouldBeInvisible(codePoint)) { + cir.setReturnValue(this.viaFabricPlus$getBlankBakedGlyph()); + } + } + + @Inject(method = "findGlyph", at = @At("RETURN"), cancellable = true) private void fixBlankGlyph1_12_2(int codePoint, CallbackInfoReturnable cir) { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { @@ -61,11 +84,30 @@ private void fixBlankGlyph1_12_2(int codePoint, CallbackInfoReturnable 1.20.4 public final VersionedBooleanSetting dontCreatePacketErrorCrashReports = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.dont_create_packet_error_crash_reports"), VersionRange.andOlder(ProtocolVersion.v1_20_3)); diff --git a/src/main/resources/assets/viafabricplus/lang/de_de.json b/src/main/resources/assets/viafabricplus/lang/de_de.json index 7be5489f..d3497f8e 100644 --- a/src/main/resources/assets/viafabricplus/lang/de_de.json +++ b/src/main/resources/assets/viafabricplus/lang/de_de.json @@ -77,6 +77,7 @@ "debug_settings.viafabricplus.hide_modern_command_block_screen_features": "Moderne Befehlsblock-Bildschirmfunktionen ausblenden", "debug_settings.viafabricplus.disable_server_pinging": "Server-Pinging deaktivieren", "debug_settings.viafabricplus.hide_modern_jigsaw_screen_features": "Moderne Verbundblock-Bildschirmeigenschaften ausblenden", + "debug_settings.viafabricplus.filter_non_existing_glyphs": "Nicht vorhandene Glyphen filtern", "authentication_settings.viafabricplus.use_beta_craft_authentication": "BetaCraft-Authentifizierung verwenden", "authentication_settings.viafabricplus.verify_session_for_online_mode": "Sitzung für Server im Online-Modus verifizieren", @@ -103,7 +104,6 @@ "visual_settings.viafabricplus.hide_furnace_recipe_book": "Ofenrezeptbuch ausblenden", "visual_settings.viafabricplus.hide_crafting_recipe_book": "Handwerksrezeptbuch ausblenden", "visual_settings.viafabricplus.force_unicode_font_for_non_ascii_languages": "Unicode-Schriftart für Nicht-ASCII-Sprachen erzwingen", - "visual_settings.viafabricplus.filter_non_existing_glyphs": "Nicht vorhandene Glyphen filtern", "visual_settings.viafabricplus.sneak_instantly": "Sofort schleichen", "visual_settings.viafabricplus.change_body_rotation_interpolation": "Interpolation der Körperdrehung ändern", diff --git a/src/main/resources/assets/viafabricplus/lang/en_us.json b/src/main/resources/assets/viafabricplus/lang/en_us.json index 2bbb8d56..3d562972 100644 --- a/src/main/resources/assets/viafabricplus/lang/en_us.json +++ b/src/main/resources/assets/viafabricplus/lang/en_us.json @@ -77,6 +77,7 @@ "debug_settings.viafabricplus.emulate_armor_hud": "Emulate armor HUD", "debug_settings.viafabricplus.hide_modern_command_block_screen_features": "Hide modern command block screen features", "debug_settings.viafabricplus.disable_server_pinging": "Disable server pinging", + "debug_settings.viafabricplus.filter_non_existing_glyphs": "Filter non existing glyphs", "authentication_settings.viafabricplus.use_beta_craft_authentication": "Use BetaCraft authentication", "authentication_settings.viafabricplus.verify_session_for_online_mode": "Verify session for online mode servers", @@ -103,7 +104,6 @@ "visual_settings.viafabricplus.hide_furnace_recipe_book": "Hide furnace recipe book", "visual_settings.viafabricplus.hide_crafting_recipe_book": "Hide crafting recipe book", "visual_settings.viafabricplus.force_unicode_font_for_non_ascii_languages": "Force Unicode font for non-ASCII languages", - "visual_settings.viafabricplus.filter_non_existing_glyphs": "Filter non existing glyphs", "visual_settings.viafabricplus.sneak_instantly": "Sneak instantly", "visual_settings.viafabricplus.lock_blocking_arm_rotation": "Lock third-person arm rotation whilst blocking", "visual_settings.viafabricplus.change_body_rotation_interpolation": "Change body rotation interpolation", diff --git a/src/main/resources/assets/viafabricplus/lang/ja_jp.json b/src/main/resources/assets/viafabricplus/lang/ja_jp.json index 43343b77..54e7ffa6 100644 --- a/src/main/resources/assets/viafabricplus/lang/ja_jp.json +++ b/src/main/resources/assets/viafabricplus/lang/ja_jp.json @@ -72,7 +72,12 @@ "debug_settings.viafabricplus.print_networking_errors_to_logs": "ネットワークエラーをログに出力", "debug_settings.viafabricplus.dont_create_packet_error_crash_reports": "パケットエラークラッシュレポートを作成しない", "debug_settings.viafabricplus.ignore_fabric_sync_errors": "ファブリック同期エラーを無視する", - "debug_settings.viafabricplus.legacy_tab_completions": "古いタブ補完", + "debug_settings.viafabricplus.legacy_tab_completions": "古いタブ補完", + "debug_settings.viafabricplus.emulate_armor_hud": "アーマーのHUDをエミュレート", + "debug_settings.viafabricplus.hide_modern_command_block_screen_features": "コマンドブロック画面から新機能を削除", + "debug_settings.viafabricplus.disable_server_pinging": "サーバーへのpingを無効化", + "debug_settings.viafabricplus.hide_modern_jigsaw_screen_features": "最新のジグソー画面機能を非表示", + "debug_settings.viafabricplus.filter_non_existing_glyphs": "存在しないグリフをフィルタリング", "authentication_settings.viafabricplus.use_beta_craft_authentication": "BetaCraft認証を使用", "authentication_settings.viafabricplus.verify_session_for_online_mode": "オンラインモードサーバーのセッションを検証", @@ -88,22 +93,17 @@ "visual_settings.viafabricplus.hide_download_terrain_screen_transition_effects": "ダウンロード地形画面遷移効果を非表示", "visual_settings.viafabricplus.replace_petrified_oak_slab": "石化したオークのハーフブロックを「不明」なテクスチャに置換", "visual_settings.viafabricplus.always_render_crosshair": "常にクロスヘアを描写", - "visual_settings.viafabricplus.emulate_armor_hud": "アーマーのHUDをエミュレート", - "visual_settings.viafabricplus.hide_modern_command_block_screen_features": "コマンドブロック画面から新機能を削除", "visual_settings.viafabricplus.replace_hurt_sound_with_oof_sound": "ダメージ音をオゥに置換", "visual_settings.viafabricplus.hide_modern_hud_elements": "新しいHUD要素を削除", "visual_settings.viafabricplus.replace_creative_inventory_with_classic_inventory": "クリエイティブインベントリを置換", "visual_settings.viafabricplus.old_walking_animation": "古いウォーキングアニメーション", "visual_settings.viafabricplus.swing_hand_on_item_use": "アイテム使用時に手を振る", - "visual_settings.viafabricplus.disable_server_pinging": "サーバーへのpingを無効化", "visual_settings.viafabricplus.sideways_backwards_walking": "横向き後方歩行", "visual_settings.viafabricplus.enable_legacy_tablist": "古いタブリストを有効化", "visual_settings.viafabricplus.tilt_item_positions": "タイトルアイテムの位置", "visual_settings.viafabricplus.hide_furnace_recipe_book": "かまどのレシピブックを非表示", "visual_settings.viafabricplus.hide_crafting_recipe_book": "クラフトレシピブックを非表示", - "visual_settings.viafabricplus.hide_modern_jigsaw_screen_features": "最新のジグソー画面機能を非表示", "visual_settings.viafabricplus.force_unicode_font_for_non_ascii_languages": "非ASCII言語にUnicodeフォントを強制", - "visual_settings.viafabricplus.filter_non_existing_glyphs": "存在しないグリフをフィルタリング", "visual_settings.viafabricplus.sneak_instantly": "即座にスニーク", "visual_settings.viafabricplus.lock_blocking_arm_rotation": "ブロック中の三人称の腕の回転を固定", "visual_settings.viafabricplus.change_body_rotation_interpolation": "ボディ回転補間を変更", diff --git a/src/main/resources/assets/viafabricplus/lang/ko_kr.json b/src/main/resources/assets/viafabricplus/lang/ko_kr.json index ba4b7acb..a77bb63b 100644 --- a/src/main/resources/assets/viafabricplus/lang/ko_kr.json +++ b/src/main/resources/assets/viafabricplus/lang/ko_kr.json @@ -73,6 +73,11 @@ "debug_settings.viafabricplus.dont_create_packet_error_crash_reports": "패킷 오류로 인한 충돌 보고서 생성하지 않기", "debug_settings.viafabricplus.ignore_fabric_sync_errors": "페브릭 동기화 오류 무시", "debug_settings.viafabricplus.legacy_tab_completions": "레거시 탭 자동 완성", + "debug_settings.viafabricplus.emulate_armor_hud": "갑옷 HUD 추가", + "debug_settings.viafabricplus.hide_modern_command_block_screen_features": "새로운 명령 블록 기능 숨기기", + "debug_settings.viafabricplus.disable_server_pinging": "서버 핑 비활성화", + "debug_settings.viafabricplus.hide_modern_jigsaw_screen_features": "최신 직소 화면 기능 숨기기", + "debug_settings.viafabricplus.filter_non_existing_glyphs": "존재하지 않는 글자 제거", "authentication_settings.viafabricplus.use_beta_craft_authentication": "BetaCraft 인증 사용", "authentication_settings.viafabricplus.verify_session_for_online_mode": "온라인 모드 서버에 대한 세션 검증", @@ -88,22 +93,17 @@ "visual_settings.viafabricplus.hide_download_terrain_screen_transition_effects": "지형 다운로드 화면 전환 효과 숨기기", "visual_settings.viafabricplus.replace_petrified_oak_slab": "규화한 참나무 반 블록 텍스처를 'unknown' 으로 바꾸기", "visual_settings.viafabricplus.always_render_crosshair": "조준점 항상 보이기", - "visual_settings.viafabricplus.emulate_armor_hud": "갑옷 HUD 추가", - "visual_settings.viafabricplus.hide_modern_command_block_screen_features": "새로운 명령 블록 기능 숨기기", "visual_settings.viafabricplus.replace_hurt_sound_with_oof_sound": "다칠 떄 나는 소리를 OOF 소리로 변경", "visual_settings.viafabricplus.hide_modern_hud_elements": "새로운 HUD 요소 숨기기", "visual_settings.viafabricplus.replace_creative_inventory_with_classic_inventory": "크리에이티브 인벤토리를 클래식으로 바꾸기", "visual_settings.viafabricplus.old_walking_animation": "예전 걷기 에니메이션", "visual_settings.viafabricplus.swing_hand_on_item_use": "블럭 치는 에니메이션 허용", - "visual_settings.viafabricplus.disable_server_pinging": "서버 핑 비활성화", "visual_settings.viafabricplus.sideways_backwards_walking": "옆과 뒤로 걷기", "visual_settings.viafabricplus.enable_legacy_tablist": "레거시 탭 리스트 허용", "visual_settings.viafabricplus.tilt_item_positions": "손에 든 아이템 기울이기", "visual_settings.viafabricplus.hide_furnace_recipe_book": "화로 제작법 책 숨기기", "visual_settings.viafabricplus.hide_crafting_recipe_book": "제작대 제작법 책 숨기기", - "visual_settings.viafabricplus.hide_modern_jigsaw_screen_features": "최신 직소 화면 기능 숨기기", "visual_settings.viafabricplus.force_unicode_font_for_non_ascii_languages": "ASCII가 아닌 언어에 유니코드 글꼴 강제 적용", - "visual_settings.viafabricplus.filter_non_existing_glyphs": "존재하지 않는 글자 제거", "visual_settings.viafabricplus.sneak_instantly": "즉시 웅크리기", "visual_settings.viafabricplus.lock_blocking_arm_rotation": "방어하는 동안 3인칭 팔 회전 막기", "visual_settings.viafabricplus.change_body_rotation_interpolation": "몸체 회전 보간 방법 바꾸기", diff --git a/src/main/resources/assets/viafabricplus/lang/lzh.json b/src/main/resources/assets/viafabricplus/lang/lzh.json index bf2f6612..7d2695cb 100644 --- a/src/main/resources/assets/viafabricplus/lang/lzh.json +++ b/src/main/resources/assets/viafabricplus/lang/lzh.json @@ -68,6 +68,11 @@ "debug_settings.viafabricplus.dont_create_packet_error_crash_reports": "勿立囊謬之隕報", "debug_settings.viafabricplus.ignore_fabric_sync_errors": "略Fabric協同之謬", "debug_settings.viafabricplus.legacy_tab_completions": "舊Tab自成", + "debug_settings.viafabricplus.emulate_armor_hud": "擬甲胄HUD", + "debug_settings.viafabricplus.hide_modern_command_block_screen_features": "隱命令塊幕之新要徵", + "debug_settings.viafabricplus.disable_server_pinging": "禁伺服器之測", + "debug_settings.viafabricplus.hide_modern_jigsaw_screen_features": "隱榫卯幕之新要徵", + "debug_settings.viafabricplus.filter_non_existing_glyphs": "濾无有之字形", "authentication_settings.viafabricplus.use_beta_craft_authentication": "以BetaCraft驗", "authentication_settings.viafabricplus.verify_session_for_online_mode": "證在綫之法伺服器會話", @@ -79,21 +84,16 @@ "visual_settings.viafabricplus.hide_signature_indicator": "隱署名刻漏", "visual_settings.viafabricplus.hide_download_terrain_screen_transition_effects": "隱下傳地勢之戶轉頁之效", "visual_settings.viafabricplus.replace_petrified_oak_slab": "替巖化柞版之紋以「未明」之紋", - "visual_settings.viafabricplus.emulate_armor_hud": "擬甲胄HUD", - "visual_settings.viafabricplus.hide_modern_command_block_screen_features": "隱命令塊幕之新要徵", "visual_settings.viafabricplus.replace_hurt_sound_with_oof_sound": "替傷之音以嗚呼聲", "visual_settings.viafabricplus.hide_modern_hud_elements": "隱新式HUD件", "visual_settings.viafabricplus.replace_creative_inventory_with_classic_inventory": "替創之行囊", "visual_settings.viafabricplus.old_walking_animation": "舊行進之畫效", "visual_settings.viafabricplus.swing_hand_on_item_use": "於使物之時揮手", - "visual_settings.viafabricplus.disable_server_pinging": "禁伺服器之測", "visual_settings.viafabricplus.sideways_backwards_walking": "側身卻行", "visual_settings.viafabricplus.enable_legacy_tablist": "啟舊Tab之列", "visual_settings.viafabricplus.hide_furnace_recipe_book": "隱爐之方集", "visual_settings.viafabricplus.hide_crafting_recipe_book": "隱製之方集", - "visual_settings.viafabricplus.hide_modern_jigsaw_screen_features": "隱榫卯幕之新要徵", "visual_settings.viafabricplus.force_unicode_font_for_non_ascii_languages": "非ASCII之文強用萬國碼字體", - "visual_settings.viafabricplus.filter_non_existing_glyphs": "濾无有之字形", "visual_settings.viafabricplus.sneak_instantly": "瞬伏", "force_version.viafabricplus.title": "請擇所欲通之伺服器版", diff --git a/src/main/resources/assets/viafabricplus/lang/pl_pl.json b/src/main/resources/assets/viafabricplus/lang/pl_pl.json index 771a81cc..d1182bdd 100644 --- a/src/main/resources/assets/viafabricplus/lang/pl_pl.json +++ b/src/main/resources/assets/viafabricplus/lang/pl_pl.json @@ -77,6 +77,7 @@ "debug_settings.viafabricplus.emulate_armor_hud": "Emuluj interfejs zbroi", "debug_settings.viafabricplus.hide_modern_command_block_screen_features": "Usuń nowsze funkcje z ekranu bloku komend", "debug_settings.viafabricplus.hide_modern_jigsaw_screen_features": "Ukrywaj nowe funkcje ekranu bloku konstrukcyjnego", + "debug_settings.viafabricplus.filter_non_existing_glyphs": "Filtruj nieistniejące znaki", "authentication_settings.viafabricplus.use_beta_craft_authentication": "Korzystaj z uwierzytelniania BetaCraft", "authentication_settings.viafabricplus.verify_session_for_online_mode": "Weryfikuj sesję dla serwerów w trybie online", @@ -103,7 +104,6 @@ "visual_settings.viafabricplus.hide_furnace_recipe_book": "Ukrywaj książkę przepisów w piecach", "visual_settings.viafabricplus.hide_crafting_recipe_book": "Ukrywaj książkę przepisów w stole rzemyślniczym", "visual_settings.viafabricplus.force_unicode_font_for_non_ascii_languages": "Wymuszaj czcionkę Unicode dla języków niewspieranych przez ASCII", - "visual_settings.viafabricplus.filter_non_existing_glyphs": "Filtruj nieistniejące znaki", "visual_settings.viafabricplus.change_body_rotation_interpolation": "Zmień interpolację rotacji ciała", "visual_settings.viafabricplus.lock_blocking_arm_rotation": "Zablokuj rotację ręki w trzeciej osobie podczas blokowania", "visual_settings.viafabricplus.sneak_instantly": "Kucaj natychmiastowo", diff --git a/src/main/resources/assets/viafabricplus/lang/ru_ru.json b/src/main/resources/assets/viafabricplus/lang/ru_ru.json index 2b3705f4..27d2ab9b 100644 --- a/src/main/resources/assets/viafabricplus/lang/ru_ru.json +++ b/src/main/resources/assets/viafabricplus/lang/ru_ru.json @@ -74,6 +74,11 @@ "debug_settings.viafabricplus.dont_create_packet_error_crash_reports": "Не создавать отчёты об ошибке пакетов", "debug_settings.viafabricplus.ignore_fabric_sync_errors": "Пропускать ошибки синхронизации регистра Fabric", "debug_settings.viafabricplus.legacy_tab_completions": "Автозаполнение в старых версиях", + "debug_settings.viafabricplus.emulate_armor_hud": "Эмулировать интерфейс брони", + "debug_settings.viafabricplus.hide_modern_command_block_screen_features": "Старый командный блок", + "debug_settings.viafabricplus.disable_server_pinging": "Не проверять соединение", + "debug_settings.viafabricplus.hide_modern_jigsaw_screen_features": "Блокировать новые функции интерфейса пазла", + "debug_settings.viafabricplus.filter_non_existing_glyphs": "Отключать неизвестные Unicode-символы", "authentication_settings.viafabricplus.use_beta_craft_authentication": "Использовать аутентификацию BetaCraft", "authentication_settings.viafabricplus.verify_session_for_online_mode": "Разрешить ViaLegacy вызов joinServer() для проверки сессии", @@ -85,21 +90,16 @@ "visual_settings.viafabricplus.hide_signature_indicator": "Скрывать индикатор цифровой подписи в чате", "visual_settings.viafabricplus.hide_download_terrain_screen_transition_effects": "Скрыть эффекты перехода между измерениями", "visual_settings.viafabricplus.replace_petrified_oak_slab": "Старая окаменевшая дубовая плита", - "visual_settings.viafabricplus.emulate_armor_hud": "Эмулировать интерфейс брони", - "visual_settings.viafabricplus.hide_modern_command_block_screen_features": "Старый командный блок", "visual_settings.viafabricplus.replace_hurt_sound_with_oof_sound": "Старый звук получения урона", "visual_settings.viafabricplus.hide_modern_hud_elements": "Старый интерфейс", "visual_settings.viafabricplus.replace_creative_inventory_with_classic_inventory": "Старый творческий инвентарь", "visual_settings.viafabricplus.old_walking_animation": "Старая анимация ходьбы", "visual_settings.viafabricplus.swing_hand_on_item_use": "Объединить анимацию использования и удара", - "visual_settings.viafabricplus.disable_server_pinging": "Не проверять соединение", "visual_settings.viafabricplus.sideways_backwards_walking": "Старая походка спиной", "visual_settings.viafabricplus.enable_legacy_tablist": "Старый список игроков", "visual_settings.viafabricplus.hide_furnace_recipe_book": "Старые печки без рецептов", "visual_settings.viafabricplus.hide_crafting_recipe_book": "Старые верстаки без рецептов", - "visual_settings.viafabricplus.hide_modern_jigsaw_screen_features": "Блокировать новые функции интерфейса пазла", "visual_settings.viafabricplus.force_unicode_font_for_non_ascii_languages": "Старый шрифт", - "visual_settings.viafabricplus.filter_non_existing_glyphs": "Отключать неизвестные Unicode-символы", "visual_settings.viafabricplus.sneak_instantly": "Моментальное приседание", "force_version.viafabricplus.title": "Укажите версию для проверки связи с сервером и подключения к нему.", diff --git a/src/main/resources/assets/viafabricplus/lang/zh_cn.json b/src/main/resources/assets/viafabricplus/lang/zh_cn.json index ef11b6c9..011b45fb 100644 --- a/src/main/resources/assets/viafabricplus/lang/zh_cn.json +++ b/src/main/resources/assets/viafabricplus/lang/zh_cn.json @@ -77,6 +77,7 @@ "debug_settings.viafabricplus.emulate_armor_hud": "模拟护甲HUD", "debug_settings.viafabricplus.hide_modern_command_block_screen_features": "隐藏新式命令方块屏幕功能", "debug_settings.viafabricplus.disable_server_pinging": "禁用服务器Ping", + "debug_settings.viafabricplus.filter_non_existing_glyphs": "过滤不存在的字形", "authentication_settings.viafabricplus.use_beta_craft_authentication": "使用BetaCraft认证", "authentication_settings.viafabricplus.verify_session_for_online_mode": "验证在线模式服务器的会话", @@ -103,7 +104,6 @@ "visual_settings.viafabricplus.hide_furnace_recipe_book": "隐藏熔炉配方书", "visual_settings.viafabricplus.hide_crafting_recipe_book": "隐藏合成配方书", "visual_settings.viafabricplus.force_unicode_font_for_non_ascii_languages": "强制为非ASCII语言使用Unicode字体", - "visual_settings.viafabricplus.filter_non_existing_glyphs": "过滤不存在的字形", "visual_settings.viafabricplus.sneak_instantly": "瞬间潜行", "visual_settings.viafabricplus.lock_blocking_arm_rotation": "格挡时锁定第三人称手臂旋转", "visual_settings.viafabricplus.change_body_rotation_interpolation": "更改身体旋转插值", diff --git a/src/main/resources/assets/viafabricplus/lang/zh_tw.json b/src/main/resources/assets/viafabricplus/lang/zh_tw.json index 94b15517..ded37b55 100644 --- a/src/main/resources/assets/viafabricplus/lang/zh_tw.json +++ b/src/main/resources/assets/viafabricplus/lang/zh_tw.json @@ -77,6 +77,7 @@ "debug_settings.viafabricplus.emulate_armor_hud": "模擬盔甲 HUD", "debug_settings.viafabricplus.hide_modern_command_block_screen_features": "隱藏新式指令方塊介面功能", "debug_settings.viafabricplus.disable_server_pinging": "停用伺服器 Ping", + "debug_settings.viafabricplus.filter_non_existing_glyphs": "過濾不存在的字元", "authentication_settings.viafabricplus.use_beta_craft_authentication": "使用 BetaCraft 驗證", "authentication_settings.viafabricplus.verify_session_for_online_mode": "允許 ViaLegacy 呼叫 joinServer() 來驗證 session", @@ -103,7 +104,6 @@ "visual_settings.viafabricplus.hide_furnace_recipe_book": "隱藏熔爐介面的配方手冊", "visual_settings.viafabricplus.hide_crafting_recipe_book": "隱藏合成介面的配方手冊", "visual_settings.viafabricplus.force_unicode_font_for_non_ascii_languages": "強制對非 ASCII 語言使用 Unicode 字型", - "visual_settings.viafabricplus.filter_non_existing_glyphs": "過濾不存在的字元", "visual_settings.viafabricplus.sneak_instantly": "立即潛行", "visual_settings.viafabricplus.lock_blocking_arm_rotation": "鎖定第三人稱格擋時的手臂旋轉", "visual_settings.viafabricplus.change_body_rotation_interpolation": "變更身體旋轉插值", diff --git a/src/main/resources/viafabricplus.accesswidener b/src/main/resources/viafabricplus.accesswidener index 7a42e88a..03919b13 100644 --- a/src/main/resources/viafabricplus.accesswidener +++ b/src/main/resources/viafabricplus.accesswidener @@ -12,6 +12,10 @@ accessible field net/minecraft/block/AbstractBlock velocityMultiplier F accessible field net/minecraft/client/gui/screen/option/ControlsListWidget$KeyBindingEntry RESET_TEXT Lnet/minecraft/text/Text; accessible field net/minecraft/client/font/FontStorage$GlyphPair MISSING Lnet/minecraft/client/font/FontStorage$GlyphPair; accessible field net/minecraft/client/gui/screen/world/WorldIcon UNKNOWN_SERVER_ID Lnet/minecraft/util/Identifier; +accessible field net/minecraft/client/MinecraftClient fontManager Lnet/minecraft/client/font/FontManager; +accessible field net/minecraft/client/font/FontManager fontStorages Ljava/util/Map; +accessible field net/minecraft/client/font/FontStorage bakedGlyphCache Lnet/minecraft/client/font/GlyphContainer; +accessible field net/minecraft/client/font/FontStorage glyphCache Lnet/minecraft/client/font/GlyphContainer; accessible method net/minecraft/screen/GenericContainerScreenHandler (Lnet/minecraft/screen/ScreenHandlerType;ILnet/minecraft/entity/player/PlayerInventory;I)V accessible method net/minecraft/entity/passive/CamelEntity getPassengerAttachmentY (ZFLnet/minecraft/entity/EntityDimensions;F)D diff --git a/src/main/resources/viafabricplus.mixins.json b/src/main/resources/viafabricplus.mixins.json index b6d80ce3..422f8fa4 100644 --- a/src/main/resources/viafabricplus.mixins.json +++ b/src/main/resources/viafabricplus.mixins.json @@ -251,7 +251,7 @@ "features.remove_newer_screen_features.MixinCommandBlockScreen", "features.remove_newer_screen_features.MixinJigsawBlockScreen", "features.remove_newer_screen_features.MixinStructureBlockScreen_1", - "features.replace_blank_glyph.MixinFontStorage", + "features.font.MixinFontStorage", "features.run_command_action.MixinScreen", "features.sign_editor_reach.MixinAbstractSignEditScreen", "features.skin_loading.MixinPlayerListEntry", diff --git a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/ViaFabricPlusVisuals.java b/visuals/src/main/java/com/viaversion/viafabricplus/visuals/ViaFabricPlusVisuals.java index fbdbb8d5..8199dbc7 100644 --- a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/ViaFabricPlusVisuals.java +++ b/visuals/src/main/java/com/viaversion/viafabricplus/visuals/ViaFabricPlusVisuals.java @@ -25,7 +25,7 @@ import com.viaversion.viafabricplus.api.entrypoint.ViaFabricPlusLoadEntrypoint; import com.viaversion.viafabricplus.api.events.LoadingCycleCallback; import com.viaversion.viafabricplus.visuals.features.classic.creative_menu.GridItemSelectionScreen; -import com.viaversion.viafabricplus.visuals.features.filter_non_existing_characters.UnicodeFontFix1_12_2; +import com.viaversion.viafabricplus.visuals.features.force_unicode_font.UnicodeFontFix1_12_2; import com.viaversion.viafabricplus.visuals.settings.VisualSettings; import net.minecraft.client.MinecraftClient; import net.raphimc.vialegacy.api.LegacyProtocolVersion; @@ -45,8 +45,6 @@ public void onPlatformLoad(ViaFabricPlusBase platform) { }); platform.registerOnChangeProtocolVersionCallback((oldVersion, newVersion) -> MinecraftClient.getInstance().execute(() -> { - VisualSettings.INSTANCE.filterNonExistingGlyphs.onValueChanged(); - if (newVersion.olderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { GridItemSelectionScreen.INSTANCE.itemGrid = null; } diff --git a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/filter_non_existing_characters/BuiltinEmptyGlyph1_12_2.java b/visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/filter_non_existing_characters/BuiltinEmptyGlyph1_12_2.java deleted file mode 100644 index e034044e..00000000 --- a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/filter_non_existing_characters/BuiltinEmptyGlyph1_12_2.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus - * Copyright (C) 2021-2025 the original authors - * - FlorianMichael/EnZaXD - * - RK_01/RaphiMC - * Copyright (C) 2023-2025 ViaVersion and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.viaversion.viafabricplus.visuals.features.filter_non_existing_characters; - -import net.minecraft.client.font.BakedGlyph; -import net.minecraft.client.font.Glyph; -import net.minecraft.client.font.RenderableGlyph; - -import java.util.function.Function; - -public enum BuiltinEmptyGlyph1_12_2 implements Glyph { - INSTANCE; - - private static final int WIDTH = 0; - private static final int HEIGHT = 8; - - @Override - public float getAdvance() { - return WIDTH; - } - - @Override - public BakedGlyph bake(Function glyphRendererGetter) { - return glyphRendererGetter.apply(new RenderableGlyph() { - - @Override - public int getWidth() { - return WIDTH; - } - - @Override - public int getHeight() { - return HEIGHT; - } - - @Override - public float getOversample() { - return 1F; - } - - @Override - public void upload(int x, int y) { - } - - @Override - public boolean hasColor() { - return true; - } - }); - } - -} diff --git a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/filter_non_existing_characters/LanguageUtil.java b/visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/force_unicode_font/LanguageUtil.java similarity index 94% rename from visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/filter_non_existing_characters/LanguageUtil.java rename to visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/force_unicode_font/LanguageUtil.java index a9ed6897..0e3bc4cd 100644 --- a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/filter_non_existing_characters/LanguageUtil.java +++ b/visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/force_unicode_font/LanguageUtil.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.visuals.features.filter_non_existing_characters; +package com.viaversion.viafabricplus.visuals.features.force_unicode_font; import java.util.Map; diff --git a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/filter_non_existing_characters/UnicodeFontFix1_12_2.java b/visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/force_unicode_font/UnicodeFontFix1_12_2.java similarity index 97% rename from visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/filter_non_existing_characters/UnicodeFontFix1_12_2.java rename to visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/force_unicode_font/UnicodeFontFix1_12_2.java index 0a813faa..6774738b 100644 --- a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/filter_non_existing_characters/UnicodeFontFix1_12_2.java +++ b/visuals/src/main/java/com/viaversion/viafabricplus/visuals/features/force_unicode_font/UnicodeFontFix1_12_2.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.visuals.features.filter_non_existing_characters; +package com.viaversion.viafabricplus.visuals.features.force_unicode_font; import com.viaversion.viafabricplus.ViaFabricPlus; import com.viaversion.viafabricplus.visuals.settings.VisualSettings; diff --git a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/injection/mixin/filter_non_existing_characters/MixinFontStorage.java b/visuals/src/main/java/com/viaversion/viafabricplus/visuals/injection/mixin/filter_non_existing_characters/MixinFontStorage.java deleted file mode 100644 index 61deb02f..00000000 --- a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/injection/mixin/filter_non_existing_characters/MixinFontStorage.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus - * Copyright (C) 2021-2025 the original authors - * - FlorianMichael/EnZaXD - * - RK_01/RaphiMC - * Copyright (C) 2023-2025 ViaVersion and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.viaversion.viafabricplus.visuals.injection.mixin.filter_non_existing_characters; - -import com.viaversion.viafabricplus.ViaFabricPlus; -import com.viaversion.viafabricplus.visuals.features.filter_non_existing_characters.BuiltinEmptyGlyph1_12_2; -import com.viaversion.viafabricplus.visuals.features.filter_non_existing_characters.RenderableGlyphDiff; -import com.viaversion.viafabricplus.visuals.settings.VisualSettings; -import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.BakedGlyph; -import net.minecraft.client.font.FontStorage; -import net.minecraft.client.font.RenderableGlyph; -import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(FontStorage.class) -public abstract class MixinFontStorage { - - @Shadow - @Final - private Identifier id; - - @Shadow - private BakedGlyph blankBakedGlyph; - - @Shadow - protected abstract BakedGlyph bake(RenderableGlyph c); - - @Unique - private BakedGlyph viaFabricPlusVisuals$blankBakedGlyph1_12_2; - - @Inject(method = "clear", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/BuiltinEmptyGlyph;bake(Ljava/util/function/Function;)Lnet/minecraft/client/font/BakedGlyph;", ordinal = 0)) - private void bakeBlankGlyph1_12_2(CallbackInfo ci) { - this.viaFabricPlusVisuals$blankBakedGlyph1_12_2 = BuiltinEmptyGlyph1_12_2.INSTANCE.bake(this::bake); - } - - @Inject(method = "findGlyph", at = @At("RETURN"), cancellable = true) - private void filterGlyphs(int codePoint, CallbackInfoReturnable cir) { - if (this.viaFabricPlusVisuals$shouldBeInvisible(codePoint)) { - cir.setReturnValue(this.viaFabricPlusVisuals$getBlankGlyphPair()); - } - } - - @Inject(method = "bake(I)Lnet/minecraft/client/font/BakedGlyph;", at = @At("RETURN"), cancellable = true) - private void filterBakedGlyph(int codePoint, CallbackInfoReturnable cir) { - if (this.viaFabricPlusVisuals$shouldBeInvisible(codePoint)) { - cir.setReturnValue(this.viaFabricPlusVisuals$getBlankBakedGlyph()); - } - } - - @Unique - private boolean viaFabricPlusVisuals$shouldBeInvisible(final int codePoint) { - if (VisualSettings.INSTANCE.filterNonExistingGlyphs.getValue()) { - return (this.id.equals(MinecraftClient.DEFAULT_FONT_ID) || this.id.equals(MinecraftClient.UNICODE_FONT_ID)) && !RenderableGlyphDiff.isGlyphRenderable(codePoint); - } else { - return false; - } - } - - @Unique - private FontStorage.GlyphPair viaFabricPlusVisuals$getBlankGlyphPair() { - if (ViaFabricPlus.getImpl().getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21_2)) { - return new FontStorage.GlyphPair(BuiltinEmptyGlyph1_12_2.INSTANCE, BuiltinEmptyGlyph1_12_2.INSTANCE); - } else { - return FontStorage.GlyphPair.MISSING; - } - } - - @Unique - private BakedGlyph viaFabricPlusVisuals$getBlankBakedGlyph() { - if (VisualSettings.INSTANCE.filterNonExistingGlyphs.getValue()) { - return this.viaFabricPlusVisuals$blankBakedGlyph1_12_2; - } else { - return this.blankBakedGlyph; - } - } - -} diff --git a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/injection/mixin/filter_non_existing_characters/MixinLanguageManager.java b/visuals/src/main/java/com/viaversion/viafabricplus/visuals/injection/mixin/force_unicode_font/MixinLanguageManager.java similarity index 89% rename from visuals/src/main/java/com/viaversion/viafabricplus/visuals/injection/mixin/filter_non_existing_characters/MixinLanguageManager.java rename to visuals/src/main/java/com/viaversion/viafabricplus/visuals/injection/mixin/force_unicode_font/MixinLanguageManager.java index d09dd49b..329f20c6 100644 --- a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/injection/mixin/filter_non_existing_characters/MixinLanguageManager.java +++ b/visuals/src/main/java/com/viaversion/viafabricplus/visuals/injection/mixin/force_unicode_font/MixinLanguageManager.java @@ -19,10 +19,10 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.visuals.injection.mixin.filter_non_existing_characters; +package com.viaversion.viafabricplus.visuals.injection.mixin.force_unicode_font; import com.viaversion.viafabricplus.ViaFabricPlus; -import com.viaversion.viafabricplus.visuals.features.filter_non_existing_characters.UnicodeFontFix1_12_2; +import com.viaversion.viafabricplus.visuals.features.force_unicode_font.UnicodeFontFix1_12_2; import net.minecraft.client.resource.language.LanguageManager; import net.minecraft.resource.ResourceManager; import org.spongepowered.asm.mixin.Mixin; diff --git a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/settings/VisualSettings.java b/visuals/src/main/java/com/viaversion/viafabricplus/visuals/settings/VisualSettings.java index a14c77aa..375217eb 100644 --- a/visuals/src/main/java/com/viaversion/viafabricplus/visuals/settings/VisualSettings.java +++ b/visuals/src/main/java/com/viaversion/viafabricplus/visuals/settings/VisualSettings.java @@ -41,18 +41,6 @@ public final class VisualSettings extends SettingGroup { Text.translatable("change_game_menu_screen_layout.viafabricplus.adjusted"), Text.translatable("base.viafabricplus.off") ); - public final BooleanSetting filterNonExistingGlyphs = new BooleanSetting(this, Text.translatable("visual_settings.viafabricplus.filter_non_existing_glyphs"), true) { - @Override - public void onValueChanged() { - final MinecraftClient client = MinecraftClient.getInstance(); - if (client != null) { - for (FontStorage storage : client.fontManager.fontStorages.values()) { - storage.bakedGlyphCache.clear(); - storage.glyphCache.clear(); - } - } - } - }; public final BooleanSetting removeBubblePopSound = new BooleanSetting(this, Text.translatable("visual_settings.viafabricplus.remove_bubble_pop_sound"), false); public final BooleanSetting hideEmptyBubbleIcons = new BooleanSetting(this, Text.translatable("visual_settings.viafabricplus.hide_empty_bubble_icons"), false); public final BooleanSetting hideVillagerProfession = new BooleanSetting(this, Text.translatable("visual_settings.viafabricplus.hide_villager_profession"), false); diff --git a/visuals/src/main/resources/viafabricplus-visuals.accesswidener b/visuals/src/main/resources/viafabricplus-visuals.accesswidener index 5102a81c..3ec4e7a0 100644 --- a/visuals/src/main/resources/viafabricplus-visuals.accesswidener +++ b/visuals/src/main/resources/viafabricplus-visuals.accesswidener @@ -1,9 +1,5 @@ accessWidener v1 named -accessible field net/minecraft/client/MinecraftClient fontManager Lnet/minecraft/client/font/FontManager; -accessible field net/minecraft/client/font/FontManager fontStorages Ljava/util/Map; -accessible field net/minecraft/client/font/FontStorage bakedGlyphCache Lnet/minecraft/client/font/GlyphContainer; -accessible field net/minecraft/client/font/FontStorage glyphCache Lnet/minecraft/client/font/GlyphContainer; accessible field net/minecraft/client/resource/language/TranslationStorage translations Ljava/util/Map; accessible field net/minecraft/client/gui/screen/multiplayer/SocialInteractionsScreen TITLE Lnet/minecraft/text/Text; accessible field net/minecraft/client/gui/widget/TexturedButtonWidget textures Lnet/minecraft/client/gui/screen/ButtonTextures; diff --git a/visuals/src/main/resources/viafabricplus-visuals.mixins.json b/visuals/src/main/resources/viafabricplus-visuals.mixins.json index fd59f040..46a6491d 100644 --- a/visuals/src/main/resources/viafabricplus-visuals.mixins.json +++ b/visuals/src/main/resources/viafabricplus-visuals.mixins.json @@ -9,8 +9,7 @@ "downloading_terrain_transitions.MixinDownloadingTerrainScreen", "filter_game_mode_selections.MixinGameModeSelectionScreen", "filter_game_mode_selections.MixinGameModeSelectionScreen_GameModeSelection", - "filter_non_existing_characters.MixinFontStorage", - "filter_non_existing_characters.MixinLanguageManager", + "force_unicode_font.MixinLanguageManager", "hud_element_changes.MixinChatHud", "hud_element_changes.MixinChatScreen", "hud_element_changes.MixinClientPlayerInteractionManager",