Skip to content

Commit

Permalink
Prevent visuals references in root project
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Jan 4, 2025
1 parent e3b923e commit 90ee03f
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

package com.viaversion.viafabricplus.features.emulation.armor_hud;

import com.viaversion.viafabricplus.ViaFabricPlus;
import com.viaversion.viafabricplus.visuals.ViaFabricPlusVisuals;
import com.viaversion.viafabricplus.visuals.settings.VisualSettings;
import com.viaversion.viafabricplus.ViaFabricPlusImpl;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Types;
Expand All @@ -45,17 +45,17 @@ public final class ArmorHudEmulation1_8 {

static {
ClientTickEvents.START_WORLD_TICK.register(world -> {
if (!VisualSettings.INSTANCE.emulateArmorHud.isEnabled()) {
if (!DebugSettings.INSTANCE.emulateArmorHud.isEnabled()) {
return;
}

if (MinecraftClient.getInstance().player != null) {
final UserConnection userConnection = ViaFabricPlus.getImpl().getPlayNetworkUserConnection();
final UserConnection userConnection = ProtocolTranslator.getPlayNetworkUserConnection();
if (userConnection != null) {
try {
sendArmorUpdate(userConnection);
} catch (Throwable t) {
ViaFabricPlusVisuals.INSTANCE.logger().error("Error sending armor update", t);
ViaFabricPlusImpl.INSTANCE.logger().error("Error sending armor update", t);
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import com.viaversion.viafabricplus.ViaFabricPlus;
import com.viaversion.viafabricplus.visuals.settings.VisualSettings;
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.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
Expand Down Expand Up @@ -65,10 +66,10 @@ public abstract class MixinMultiplayerServerListWidget_ServerEntry {
private boolean disableServerPinging(ThreadPoolExecutor instance, Runnable runnable) {
ProtocolVersion version = ViaFabricPlus.getImpl().getServerVersion(server);
if (version == null) {
version = ViaFabricPlus.getImpl().getTargetVersion();
version = ProtocolTranslator.getTargetVersion();
}

viaFabricPlus$disableServerPinging = VisualSettings.INSTANCE.disableServerPinging.isEnabled(version);
viaFabricPlus$disableServerPinging = DebugSettings.INSTANCE.disableServerPinging.isEnabled(version);
if (viaFabricPlus$disableServerPinging) {
this.server.version = Text.of(version.getName()); // Show target version
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

package com.viaversion.viafabricplus.injection.mixin.features.remove_newer_screen_features;

import com.viaversion.viafabricplus.visuals.settings.VisualSettings;
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
import net.minecraft.block.entity.CommandBlockBlockEntity;
import net.minecraft.client.gui.screen.ingame.CommandBlockScreen;
import net.minecraft.client.gui.widget.CyclingButtonWidget;
Expand All @@ -48,7 +48,7 @@ public abstract class MixinCommandBlockScreen {

@Inject(method = "init", at = @At("TAIL"))
private void removeWidgets(CallbackInfo ci) {
if (VisualSettings.INSTANCE.hideModernCommandBlockScreenFeatures.isEnabled()) {
if (DebugSettings.INSTANCE.hideModernCommandBlockScreenFeatures.isEnabled()) {
modeButton.visible = false;
conditionalModeButton.visible = false;
redstoneTriggerButton.visible = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

package com.viaversion.viafabricplus.injection.mixin.features.remove_newer_screen_features;

import com.viaversion.viafabricplus.ViaFabricPlus;
import com.viaversion.viafabricplus.visuals.settings.VisualSettings;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.minecraft.block.entity.JigsawBlockEntity;
import net.minecraft.client.gui.DrawContext;
Expand Down Expand Up @@ -62,14 +62,15 @@ public MixinJigsawBlockScreen(Text title) {

@Inject(method = "init", at = @At("RETURN"))
private void disableWidgets(CallbackInfo ci) {
if (!VisualSettings.INSTANCE.hideModernJigsawScreenFeatures.getValue()) {
if (!DebugSettings.INSTANCE.hideModernJigsawScreenFeatures.getValue()) {
return;
}
if (ViaFabricPlus.getImpl().getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) {

if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) {
selectionPriorityField.active = false;
placementPriorityField.active = false;
}
if (ViaFabricPlus.getImpl().getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
nameField.active = false;
jointRotationButton.active = false;
int index = children().indexOf(jointRotationButton);
Expand All @@ -81,7 +82,7 @@ private void disableWidgets(CallbackInfo ci) {

@Inject(method = "render", at = @At("HEAD"))
private void copyText(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
if (VisualSettings.INSTANCE.hideModernJigsawScreenFeatures.getValue() && ViaFabricPlus.getImpl().getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
if (DebugSettings.INSTANCE.hideModernJigsawScreenFeatures.getValue() && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
nameField.setText(targetField.getText());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.viaversion.vialoader.util.VersionRange;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.minecraft.text.Text;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;

public final class DebugSettings extends SettingGroup {

Expand All @@ -35,6 +36,7 @@ public final class DebugSettings extends SettingGroup {
public final BooleanSetting queueConfigPackets = new BooleanSetting(this, Text.translatable("debug_settings.viafabricplus.queue_config_packets"), true);
public final BooleanSetting printNetworkingErrorsToLogs = new BooleanSetting(this, Text.translatable("debug_settings.viafabricplus.print_networking_errors_to_logs"), true);
public final BooleanSetting ignoreFabricSyncErrors = new BooleanSetting(this, Text.translatable("debug_settings.viafabricplus.ignore_fabric_sync_errors"), false);
public final BooleanSetting hideModernJigsawScreenFeatures = new BooleanSetting(this, Text.translatable("debug_settings.viafabricplus.hide_modern_jigsaw_screen_features"), true);

// 1.20.5 -> 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));
Expand All @@ -49,6 +51,13 @@ public final class DebugSettings extends SettingGroup {
public final VersionedBooleanSetting executeInputsSynchronously = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.execute_inputs_synchronously"), VersionRange.andOlder(ProtocolVersion.v1_12_2));
public final VersionedBooleanSetting legacyTabCompletions = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.legacy_tab_completions"), VersionRange.andOlder(ProtocolVersion.v1_12_2));

// 1.9 -> 1.8.x
public final VersionedBooleanSetting emulateArmorHud = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.emulate_armor_hud"), VersionRange.andOlder(ProtocolVersion.v1_8));
public final VersionedBooleanSetting hideModernCommandBlockScreenFeatures = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.hide_modern_command_block_screen_features"), VersionRange.andOlder(ProtocolVersion.v1_8));

// b1.8/b1.8.1 -> b1_7/b1.7.3
public final VersionedBooleanSetting disableServerPinging = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.disable_server_pinging"), VersionRange.andOlder(LegacyProtocolVersion.b1_7tob1_7_3));

public DebugSettings() {
super(Text.translatable("setting_group_name.viafabricplus.debug"));
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/assets/viafabricplus/lang/de_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
"debug_settings.viafabricplus.dont_create_packet_error_crash_reports": "Keine Paketfehler-Absturzberichte erstellen",
"debug_settings.viafabricplus.ignore_fabric_sync_errors": "Fabric-Synchronisierungsfehler ignorieren",
"debug_settings.viafabricplus.legacy_tab_completions": "Legacy-Tab-Vervollständigungen",
"debug_settings.viafabricplus.emulate_armor_hud": "Rüstungs-HUD emulieren",
"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",

"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",
Expand All @@ -88,20 +92,16 @@
"visual_settings.viafabricplus.hide_download_terrain_screen_transition_effects": "Übergangseffekte des Download-Geländebildschirms ausblenden",
"visual_settings.viafabricplus.replace_petrified_oak_slab": "Versteinerte Eichenplattentextur durch die 'unbekannte' Textur ersetzen",
"visual_settings.viafabricplus.always_render_crosshair": "Fadenkreuz immer anzeigen",
"visual_settings.viafabricplus.emulate_armor_hud": "Rüstungs-HUD emulieren",
"visual_settings.viafabricplus.hide_modern_command_block_screen_features": "Moderne Befehlsblock-Bildschirmfunktionen ausblenden",
"visual_settings.viafabricplus.replace_hurt_sound_with_oof_sound": "Verletzungsgeräusch durch OOF-Geräusch ersetzen",
"visual_settings.viafabricplus.hide_modern_hud_elements": "Moderne HUD-Elemente ausblenden",
"visual_settings.viafabricplus.replace_creative_inventory_with_classic_inventory": "Kreatives Inventar ersetzen",
"visual_settings.viafabricplus.old_walking_animation": "Alte Laufanimation",
"visual_settings.viafabricplus.swing_hand_on_item_use": "Hand schwingen, wenn Gegenstand benutzt wird",
"visual_settings.viafabricplus.disable_server_pinging": "Server-Pinging deaktivieren",
"visual_settings.viafabricplus.sideways_backwards_walking": "Seitliches Rückwärtsgehen",
"visual_settings.viafabricplus.enable_legacy_tablist": "Legacy-Spielerliste aktivieren",
"visual_settings.viafabricplus.tilt_item_positions": "Item Neigungen ändern",
"visual_settings.viafabricplus.hide_furnace_recipe_book": "Ofenrezeptbuch ausblenden",
"visual_settings.viafabricplus.hide_crafting_recipe_book": "Handwerksrezeptbuch ausblenden",
"visual_settings.viafabricplus.hide_modern_jigsaw_screen_features": "Moderne Verbundblock-Bildschirmeigenschaften 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",
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/assets/viafabricplus/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
"debug_settings.viafabricplus.dont_create_packet_error_crash_reports": "Don't create packet error crash reports",
"debug_settings.viafabricplus.ignore_fabric_sync_errors": "Ignore Fabric sync errors",
"debug_settings.viafabricplus.legacy_tab_completions": "Legacy tab completions",
"debug_settings.viafabricplus.hide_modern_jigsaw_screen_features": "Hide modern Jigsaw screen features",
"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",

"authentication_settings.viafabricplus.use_beta_craft_authentication": "Use BetaCraft authentication",
"authentication_settings.viafabricplus.verify_session_for_online_mode": "Verify session for online mode servers",
Expand All @@ -88,20 +92,16 @@
"visual_settings.viafabricplus.hide_download_terrain_screen_transition_effects": "Hide download terrain screen transition effects",
"visual_settings.viafabricplus.replace_petrified_oak_slab": "Replace petrified oak slab texture with the 'unknown' texture",
"visual_settings.viafabricplus.always_render_crosshair": "Always render crosshair",
"visual_settings.viafabricplus.emulate_armor_hud": "Emulate armor HUD",
"visual_settings.viafabricplus.hide_modern_command_block_screen_features": "Hide modern command block screen features",
"visual_settings.viafabricplus.replace_hurt_sound_with_oof_sound": "Replace hurt sound with OOF sound",
"visual_settings.viafabricplus.hide_modern_hud_elements": "Hide modern HUD elements",
"visual_settings.viafabricplus.replace_creative_inventory_with_classic_inventory": "Replace creative inventory",
"visual_settings.viafabricplus.old_walking_animation": "Old walking animation",
"visual_settings.viafabricplus.swing_hand_on_item_use": "Swing hand on item use",
"visual_settings.viafabricplus.disable_server_pinging": "Disable server pinging",
"visual_settings.viafabricplus.sideways_backwards_walking": "Sideways backwards walking",
"visual_settings.viafabricplus.enable_legacy_tablist": "Enable legacy tablist",
"visual_settings.viafabricplus.tilt_item_positions": "Tilt item positions",
"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.hide_modern_jigsaw_screen_features": "Hide modern Jigsaw screen features",
"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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public void onValueChanged() {
}
}
};
public final BooleanSetting hideModernJigsawScreenFeatures = new BooleanSetting(this, Text.translatable("visual_settings.viafabricplus.hide_modern_jigsaw_screen_features"), true);
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);
Expand Down Expand Up @@ -85,8 +84,6 @@ public void onValueChanged() {

// 1.9 -> 1.8.x
public final VersionedBooleanSetting alwaysRenderCrosshair = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.always_render_crosshair"), VersionRange.andOlder(ProtocolVersion.v1_8));
public final VersionedBooleanSetting emulateArmorHud = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.emulate_armor_hud"), VersionRange.andOlder(ProtocolVersion.v1_8));
public final VersionedBooleanSetting hideModernCommandBlockScreenFeatures = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.hide_modern_command_block_screen_features"), VersionRange.andOlder(ProtocolVersion.v1_8));

// 1.8.x -> 1.7.6 - 1.7.10
public final VersionedBooleanSetting swingHandOnItemUse = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.swing_hand_on_item_use"), VersionRange.andOlder(ProtocolVersion.v1_7_6));
Expand All @@ -98,7 +95,6 @@ public void onValueChanged() {

// b1.8/b1.8.1 -> b1_7/b1.7.3
public final VersionedBooleanSetting hideModernHUDElements = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.hide_modern_hud_elements"), VersionRange.andOlder(LegacyProtocolVersion.b1_7tob1_7_3));
public final VersionedBooleanSetting disableServerPinging = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.disable_server_pinging"), VersionRange.andOlder(LegacyProtocolVersion.b1_7tob1_7_3));

// a1.0.15 -> c0_28/c0_30
public final VersionedBooleanSetting replaceCreativeInventory = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.replace_creative_inventory_with_classic_inventory"), VersionRange.andOlder(LegacyProtocolVersion.c0_28toc0_30));
Expand Down

0 comments on commit 90ee03f

Please sign in to comment.