From e31e76a492d7e84501ee2a556e7fefb48032fd5c Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Tue, 24 Dec 2024 07:16:30 +0100 Subject: [PATCH] global() -> INSTANCE --- .../viafabricplus/ViaFabricPlusImpl.java | 16 +++++++-------- .../base/bedrock/BedrockJoinGameTracker.java | 2 +- .../viafabricplus/base/screen/VFPList.java | 4 ++-- .../features/FeaturesLoading.java | 6 +++--- .../WorldHeightSupport.java | 2 +- .../features/cpe_extensions/CPEAdditions.java | 2 +- .../features/entity/EntityDimensionDiff.java | 2 +- .../EnchantmentAttributesEmulation1_20_6.java | 2 +- .../WolfHealthTracker1_14_4.java | 2 +- .../EntityRidingOffsetsPre1_20_2.java | 2 +- .../entity/v1_8_boat/BoatModel1_8.java | 2 +- .../entity/v1_8_boat/BoatRenderer1_8.java | 2 +- .../RenderableGlyphDiff.java | 2 +- .../UnicodeFontFix1_12_2.java | 6 +++--- .../FootStepParticle1_12_2.java | 2 +- .../ActionResultException1_12_2.java | 2 +- .../ClientPlayerInteractionManager1_18_2.java | 2 +- .../ItemRegistryDiff.java | 2 +- .../item/negative_items/NegativeItemUtil.java | 2 +- .../tooltip_changes/Enchantments1_14_4.java | 2 +- .../max_chat_length/MaxChatLength.java | 2 +- .../MouseSensitivity1_13_2.java | 2 +- .../ResourcePackHeaderDiff.java | 2 +- .../AddBannerPatternRecipe.java | 2 +- .../recipe_emulation/RecipeManager1_11_2.java | 2 +- .../recipe_emulation/Recipes1_11_2.java | 2 +- .../ShulkerBoxColoringRecipe.java | 2 +- .../ui/armor_hud/ArmorHudEmulation1_8.java | 7 +++---- .../GridItemSelectionScreen.java | 2 +- .../ui/v1_7_tab_list_style/LegacyTabList.java | 2 +- .../PendingUpdateManager1_18_2.java | 2 +- .../world/item_picking/ItemPick1_21_3.java | 2 +- .../injection/ViaFabricPlusMixinPlugin.java | 2 +- .../injection/mixin/base/MixinMain.java | 3 +-- .../base/connection/MixinMinecraftClient.java | 2 +- .../MixinMultiplayerServerListPinger.java | 2 +- .../integration/MixinClientConnection.java | 4 ++-- .../mixin/base/integration/MixinDebugHud.java | 4 ++-- .../MixinMultiplayerServerListPinger.java | 2 +- .../base/integration/MixinServerInfo.java | 2 +- .../mixin/base/ui/MixinAddServerScreen.java | 4 ++-- .../mixin/base/ui/MixinConnectScreen_1.java | 4 ++-- .../base/ui/MixinDirectConnectScreen.java | 4 ++-- .../ui/MixinDownloadingTerrainScreen.java | 4 ++-- .../mixin/base/ui/MixinMultiplayerScreen.java | 6 +++--- .../MixinClientRegistrySyncHandler.java | 4 ++-- .../execute_inputs_sync/MixinKeyboard.java | 4 ++-- .../MixinMinecraftClient.java | 4 ++-- .../execute_inputs_sync/MixinMouse.java | 4 ++-- .../MixinFontStorage.java | 10 +++++----- .../instant_sneaking/MixinCamera.java | 4 ++-- .../MixinClientPlayerInteractionManager.java | 4 ++-- .../cooldown/MixinItemCooldownManager.java | 4 ++-- .../MixinItemGroup_EntriesImpl.java | 4 ++-- .../filter_creative_tabs/MixinItemGroups.java | 6 +++--- .../item/missing_model/MixinItemRenderer.java | 4 ++-- .../item/v1_7_tilt/MixinHeldItemRenderer.java | 6 +++--- .../MixinChatInputSuggestor.java | 4 ++-- .../MixinChatScreen.java | 8 ++++---- .../MixinProtocol1_20To1_20_2.java | 4 ++-- .../legacy_chat_signatures/MixinChatHud.java | 4 ++-- .../MixinChatScreen.java | 4 ++-- .../MixinClientCommonNetworkHandler.java | 4 ++-- .../MixinClientPlayNetworkHandler.java | 4 ++-- .../MixinCreativeInventoryScreen.java | 4 ++-- ...ltiplayerServerListWidget_ServerEntry.java | 8 ++++---- .../MixinDownloadingTerrainScreen.java | 4 ++-- .../hud_element_changes/MixinInGameHud.java | 18 ++++++++--------- .../MixinCommandBlockScreen.java | 4 ++-- .../MixinGameMenuScreen.java | 12 +++++------ .../MixinJigsawBlockScreen.java | 6 +++--- .../MixinScreen.java | 6 +++--- .../MixinPlayerListHud.java | 4 ++-- .../always_tick_entities/MixinEntity.java | 4 ++-- .../disable_sequencing/MixinClientWorld.java | 4 ++-- .../vialegacy/MixinViaLegacyConfig.java | 4 ++-- .../old/minecraft/MixinMinecraftClient.java | 9 ++------- .../entity/MixinBipedEntityModel.java | 6 +++--- .../entity/MixinClientPlayerEntity.java | 4 ++-- .../minecraft/entity/MixinLivingEntity.java | 11 +++++----- .../minecraft/entity/MixinPlayerEntity.java | 4 ++-- .../MixinVillagerClothingFeatureRenderer.java | 4 ++-- .../ProtocolTranslator.java | 2 +- .../impl/ViaFabricPlusMappingDataLoader.java | 2 +- .../ViaFabricPlusVLCommandHandler.java | 2 +- .../ViaFabricPlusViaCommandSender.java | 2 +- .../classic/ListExtensionsCommand.java | 2 +- .../impl/command/classic/SetTimeCommand.java | 2 +- .../ViaFabricPlusViaLegacyPlatformImpl.java | 2 +- .../ViaFabricPlusViaVersionPlatformImpl.java | 2 +- .../ViaFabricPlusNettyPipelineProvider.java | 2 +- .../ViaFabricPlusAlphaInventoryProvider.java | 2 +- .../ViaFabricPlusClassicMPPassProvider.java | 6 +++--- ...aFabricPlusClassicWorldHeightProvider.java | 2 +- .../ViaFabricPlusEncryptionProvider.java | 2 +- .../ViaFabricPlusGameProfileFetcher.java | 2 +- .../ViaFabricPlusOldAuthProvider.java | 6 +++--- .../ViaFabricPlusAckSequenceProvider.java | 2 +- .../ViaFabricPlusBaseVersionProvider.java | 2 +- ...ViaFabricPlusCommandArgumentsProvider.java | 2 +- .../ViaFabricPlusHandItemProvider.java | 2 +- .../ViaFabricPlusPickItemProvider.java | 2 +- .../ViaFabricPlusPlayerAbilitiesProvider.java | 2 +- ...ViaFabricPlusPlayerLookTargetProvider.java | 2 +- .../viaversion/ViaFabricPlusVLInjector.java | 2 +- .../viaversion/ViaFabricPlusVLLoader.java | 6 +++--- .../viaversion/ViaFabricPlusVLViaConfig.java | 2 +- .../netty/NoReadFlowControlHandler.java | 2 +- .../netty/ViaFabricPlusVLLegacyPipeline.java | 2 +- .../netty/ViaFabricPlusViaDecoder.java | 6 +++--- .../protocol/ViaFabricPlusProtocol.java | 2 +- .../translator/BlockStateTranslator.java | 2 +- .../translator/ItemTranslator.java | 2 +- .../translator/TextComponentTranslator.java | 2 +- .../protocoltranslator/util/LanguageUtil.java | 2 +- .../util/NoPacketSendChannel.java | 2 +- .../util/ProtocolVersionDetector.java | 2 +- .../{base => }/save/AbstractSave.java | 2 +- .../{base => }/save/SaveManager.java | 10 +++++----- .../{base => }/save/impl/AccountsSave.java | 8 ++++---- .../{base => }/save/impl/SettingsSave.java | 16 +++++++-------- .../screen/PerServerVersionScreen.java | 8 ++++---- .../screen/ProtocolSelectionScreen.java | 2 +- .../screen/ReportIssuesScreen.java | 2 +- .../screen/ServerListScreen.java | 2 +- .../screen/classic4j/BetaCraftScreen.java | 2 +- .../classic4j/ClassiCubeLoginScreen.java | 4 ++-- .../screen/classic4j/ClassiCubeMFAScreen.java | 2 +- .../classic4j/ClassiCubeServerListScreen.java | 6 +++--- .../realms/AcceptInvitationCodeScreen.java | 2 +- .../screen/realms/BedrockRealmsScreen.java | 6 +++--- .../settings/BooleanSettingRenderer.java | 4 ++-- .../settings/ButtonSettingRenderer.java | 4 ++-- .../screen/settings/ModeSettingRenderer.java | 4 ++-- .../screen/settings/SettingsScreen.java | 6 +++--- .../screen/settings/TitleRenderer.java | 2 +- .../VersionedBooleanSettingRenderer.java | 4 ++-- .../{base => }/settings/SettingsManager.java | 18 ++++++++--------- .../settings/base/AbstractSetting.java | 2 +- .../settings/base/BooleanSetting.java | 2 +- .../settings/base/ButtonSetting.java | 2 +- .../{base => }/settings/base/ModeSetting.java | 2 +- .../settings/base/SettingGroup.java | 2 +- .../base/VersionedBooleanSetting.java | 2 +- .../settings/impl/AuthenticationSettings.java | 14 +++++-------- .../settings/impl/BedrockSettings.java | 20 ++++++++----------- .../settings/impl/DebugSettings.java | 16 ++++++--------- .../settings/impl/GeneralSettings.java | 16 ++++++--------- .../settings/impl/VisualSettings.java | 18 +++++++---------- .../viafabricplus/util/ChatUtil.java | 2 +- .../util/ClassLoaderPriorityUtil.java | 2 +- .../viafabricplus/util/ConnectionUtil.java | 2 +- .../viafabricplus/util/ItemUtil.java | 2 +- .../viafabricplus/util/MapUtil.java | 2 +- .../util/ModMenuScreenFactory.java | 2 +- 155 files changed, 311 insertions(+), 339 deletions(-) rename src/main/java/com/viaversion/viafabricplus/{base => }/save/AbstractSave.java (98%) rename src/main/java/com/viaversion/viafabricplus/{base => }/save/SaveManager.java (90%) rename src/main/java/com/viaversion/viafabricplus/{base => }/save/impl/AccountsSave.java (94%) rename src/main/java/com/viaversion/viafabricplus/{base => }/save/impl/SettingsSave.java (87%) rename src/main/java/com/viaversion/viafabricplus/{base => }/settings/SettingsManager.java (80%) rename src/main/java/com/viaversion/viafabricplus/{base => }/settings/base/AbstractSetting.java (98%) rename src/main/java/com/viaversion/viafabricplus/{base => }/settings/base/BooleanSetting.java (96%) rename src/main/java/com/viaversion/viafabricplus/{base => }/settings/base/ButtonSetting.java (96%) rename src/main/java/com/viaversion/viafabricplus/{base => }/settings/base/ModeSetting.java (97%) rename src/main/java/com/viaversion/viafabricplus/{base => }/settings/base/SettingGroup.java (96%) rename src/main/java/com/viaversion/viafabricplus/{base => }/settings/base/VersionedBooleanSetting.java (98%) rename src/main/java/com/viaversion/viafabricplus/{base => }/settings/impl/AuthenticationSettings.java (81%) rename src/main/java/com/viaversion/viafabricplus/{base => }/settings/impl/BedrockSettings.java (91%) rename src/main/java/com/viaversion/viafabricplus/{base => }/settings/impl/DebugSettings.java (89%) rename src/main/java/com/viaversion/viafabricplus/{base => }/settings/impl/GeneralSettings.java (91%) rename src/main/java/com/viaversion/viafabricplus/{base => }/settings/impl/VisualSettings.java (94%) diff --git a/src/main/java/com/viaversion/viafabricplus/ViaFabricPlusImpl.java b/src/main/java/com/viaversion/viafabricplus/ViaFabricPlusImpl.java index ba0f40ff..786d80e2 100644 --- a/src/main/java/com/viaversion/viafabricplus/ViaFabricPlusImpl.java +++ b/src/main/java/com/viaversion/viafabricplus/ViaFabricPlusImpl.java @@ -25,8 +25,8 @@ import com.viaversion.viafabricplus.api.ChangeProtocolVersionCallback; import com.viaversion.viafabricplus.api.LoadingCycleCallback; import com.viaversion.viafabricplus.api.ViaFabricPlusBase; import com.viaversion.viafabricplus.base.Events; -import com.viaversion.viafabricplus.base.save.SaveManager; -import com.viaversion.viafabricplus.base.settings.SettingsManager; +import com.viaversion.viafabricplus.save.SaveManager; +import com.viaversion.viafabricplus.settings.SettingsManager; import com.viaversion.viafabricplus.features.FeaturesLoading; import com.viaversion.viafabricplus.features.max_chat_length.MaxChatLength; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; @@ -81,12 +81,14 @@ public final class ViaFabricPlusImpl implements ViaFabricPlusBase { private final Logger logger = LogManager.getLogger("ViaFabricPlus"); private final Path path = FabricLoader.getInstance().getConfigDir().resolve("viafabricplus"); - private final SettingsManager settingsManager; - private final SaveManager saveManager; + private SettingsManager settingsManager; + private SaveManager saveManager; - private final CompletableFuture loadingFuture; + private CompletableFuture loadingFuture; + + public void init() { + ViaFabricPlus.init(this); - private ViaFabricPlusImpl() { // Create the directory if it doesn't exist if (!Files.exists(path)) { try { @@ -118,8 +120,6 @@ public final class ViaFabricPlusImpl implements ViaFabricPlusBase { }); } - // Proxy most important functions to the API to prevent users depending on mod internals - @Override public Logger logger() { return logger; diff --git a/src/main/java/com/viaversion/viafabricplus/base/bedrock/BedrockJoinGameTracker.java b/src/main/java/com/viaversion/viafabricplus/base/bedrock/BedrockJoinGameTracker.java index 585fb172..b5853bc8 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/bedrock/BedrockJoinGameTracker.java +++ b/src/main/java/com/viaversion/viafabricplus/base/bedrock/BedrockJoinGameTracker.java @@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.base.bedrock; import com.viaversion.viaversion.api.connection.StorableObject; -public class BedrockJoinGameTracker implements StorableObject { +public final class BedrockJoinGameTracker implements StorableObject { private long seed; private String levelId; diff --git a/src/main/java/com/viaversion/viafabricplus/base/screen/VFPList.java b/src/main/java/com/viaversion/viafabricplus/base/screen/VFPList.java index 877f5422..7e908fcd 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/screen/VFPList.java +++ b/src/main/java/com/viaversion/viafabricplus/base/screen/VFPList.java @@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.base.screen; import com.viaversion.viafabricplus.screen.PerServerVersionScreen; import com.viaversion.viafabricplus.screen.ProtocolSelectionScreen; -import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings; +import com.viaversion.viafabricplus.settings.impl.GeneralSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget; @@ -47,7 +47,7 @@ public class VFPList extends AlwaysSelectedEntryListWidget { public void initScrollY(final double scrollY) { // Needs calling last in init to have data loaded before setting scroll amount - if (GeneralSettings.global().saveScrollPositionInSlotScreens.getValue()) { + if (GeneralSettings.INSTANCE.saveScrollPositionInSlotScreens.getValue()) { this.setScrollY(scrollY); } } diff --git a/src/main/java/com/viaversion/viafabricplus/features/FeaturesLoading.java b/src/main/java/com/viaversion/viafabricplus/features/FeaturesLoading.java index 2d0d23d4..93b122cc 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/FeaturesLoading.java +++ b/src/main/java/com/viaversion/viafabricplus/features/FeaturesLoading.java @@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.features; import com.viaversion.viafabricplus.api.LoadingCycleCallback; import com.viaversion.viafabricplus.base.Events; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import com.viaversion.viafabricplus.features.block.CollisionShapes; import com.viaversion.viafabricplus.features.cpe_extensions.CPEAdditions; import com.viaversion.viafabricplus.features.footstep_particle.FootStepParticle1_12_2; @@ -40,7 +40,7 @@ import net.minecraft.client.MinecraftClient; import net.raphimc.viaaprilfools.api.AprilFoolsProtocolVersion; import net.raphimc.vialegacy.api.LegacyProtocolVersion; -public class FeaturesLoading { +public final class FeaturesLoading { static { ResourcePackHeaderDiff.init(); @@ -58,7 +58,7 @@ public class FeaturesLoading { }); Events.CHANGE_PROTOCOL_VERSION.register((oldVersion, newVersion) -> MinecraftClient.getInstance().execute(() -> { - VisualSettings.global().filterNonExistingGlyphs.onValueChanged(); + VisualSettings.INSTANCE.filterNonExistingGlyphs.onValueChanged(); CollisionShapes.reloadBlockShapes(); if (newVersion.olderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { diff --git a/src/main/java/com/viaversion/viafabricplus/features/classic_world_height/WorldHeightSupport.java b/src/main/java/com/viaversion/viafabricplus/features/classic_world_height/WorldHeightSupport.java index 10abbdd9..a5930aec 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/classic_world_height/WorldHeightSupport.java +++ b/src/main/java/com/viaversion/viafabricplus/features/classic_world_height/WorldHeightSupport.java @@ -40,7 +40,7 @@ import java.util.ArrayList; import java.util.BitSet; import java.util.List; -public class WorldHeightSupport { +public final class WorldHeightSupport { public static PacketHandler handleJoinGame(final PacketHandler parentHandler) { return wrapper -> { diff --git a/src/main/java/com/viaversion/viafabricplus/features/cpe_extensions/CPEAdditions.java b/src/main/java/com/viaversion/viafabricplus/features/cpe_extensions/CPEAdditions.java index cc558bb6..86f9b3ea 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/cpe_extensions/CPEAdditions.java +++ b/src/main/java/com/viaversion/viafabricplus/features/cpe_extensions/CPEAdditions.java @@ -35,7 +35,7 @@ import java.util.List; import java.util.Map; import java.util.function.BiConsumer; -public class CPEAdditions { +public final class CPEAdditions { public final static List ALLOWED_EXTENSIONS = new ArrayList<>(); public final static Map CUSTOM_PACKETS = new HashMap<>(); diff --git a/src/main/java/com/viaversion/viafabricplus/features/entity/EntityDimensionDiff.java b/src/main/java/com/viaversion/viafabricplus/features/entity/EntityDimensionDiff.java index a51866a8..68503ba5 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/entity/EntityDimensionDiff.java +++ b/src/main/java/com/viaversion/viafabricplus/features/entity/EntityDimensionDiff.java @@ -37,7 +37,7 @@ import static com.viaversion.viafabricplus.util.MapUtil.linkedHashMap; /** * Data dump for entity dimension changes between versions. */ -public class EntityDimensionDiff { +public final class EntityDimensionDiff { /** * A map of entity types to a map of versions to dimensions. diff --git a/src/main/java/com/viaversion/viafabricplus/features/entity/enchantment_attributes/EnchantmentAttributesEmulation1_20_6.java b/src/main/java/com/viaversion/viafabricplus/features/entity/enchantment_attributes/EnchantmentAttributesEmulation1_20_6.java index eb146602..4ebd2bbb 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/entity/enchantment_attributes/EnchantmentAttributesEmulation1_20_6.java +++ b/src/main/java/com/viaversion/viafabricplus/features/entity/enchantment_attributes/EnchantmentAttributesEmulation1_20_6.java @@ -38,7 +38,7 @@ import net.minecraft.registry.tag.BlockTags; import java.util.Optional; -public class EnchantmentAttributesEmulation1_20_6 { +public final class EnchantmentAttributesEmulation1_20_6 { static { ClientTickEvents.START_WORLD_TICK.register(world -> { diff --git a/src/main/java/com/viaversion/viafabricplus/features/entity/metadata_handling/WolfHealthTracker1_14_4.java b/src/main/java/com/viaversion/viafabricplus/features/entity/metadata_handling/WolfHealthTracker1_14_4.java index aa5d0963..d1306176 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/entity/metadata_handling/WolfHealthTracker1_14_4.java +++ b/src/main/java/com/viaversion/viafabricplus/features/entity/metadata_handling/WolfHealthTracker1_14_4.java @@ -25,7 +25,7 @@ import com.viaversion.viaversion.api.connection.StorableObject; import it.unimi.dsi.fastutil.ints.Int2FloatMap; import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap; -public class WolfHealthTracker1_14_4 implements StorableObject { +public final class WolfHealthTracker1_14_4 implements StorableObject { private final Int2FloatMap healthDataMap = new Int2FloatOpenHashMap(); diff --git a/src/main/java/com/viaversion/viafabricplus/features/entity/riding_offsets/EntityRidingOffsetsPre1_20_2.java b/src/main/java/com/viaversion/viafabricplus/features/entity/riding_offsets/EntityRidingOffsetsPre1_20_2.java index 2abab186..093b35a3 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/entity/riding_offsets/EntityRidingOffsetsPre1_20_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features/entity/riding_offsets/EntityRidingOffsetsPre1_20_2.java @@ -43,7 +43,7 @@ import net.minecraft.util.math.Vec3d; * Minecraft 1.20.2 changed the calculation of the mounted height offset for all entities, this class contains the old * values for all entities. This class is used for 1.20.1 and lower. */ -public class EntityRidingOffsetsPre1_20_2 { +public final class EntityRidingOffsetsPre1_20_2 { /** * Returns the mounted height offset for the given entity and passenger. This method is used for 1.20.1 and lower. diff --git a/src/main/java/com/viaversion/viafabricplus/features/entity/v1_8_boat/BoatModel1_8.java b/src/main/java/com/viaversion/viafabricplus/features/entity/v1_8_boat/BoatModel1_8.java index 33ea5ef6..4909e928 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/entity/v1_8_boat/BoatModel1_8.java +++ b/src/main/java/com/viaversion/viafabricplus/features/entity/v1_8_boat/BoatModel1_8.java @@ -30,7 +30,7 @@ import net.minecraft.util.Identifier; /** * Model for boats in 1.8 and lower. */ -public class BoatModel1_8 extends EntityModel { +public final class BoatModel1_8 extends EntityModel { public static final EntityModelLayer MODEL_LAYER = new EntityModelLayer(Identifier.of("viafabricplus", "boat1_8"), "main"); diff --git a/src/main/java/com/viaversion/viafabricplus/features/entity/v1_8_boat/BoatRenderer1_8.java b/src/main/java/com/viaversion/viafabricplus/features/entity/v1_8_boat/BoatRenderer1_8.java index 46995e90..d92da996 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/entity/v1_8_boat/BoatRenderer1_8.java +++ b/src/main/java/com/viaversion/viafabricplus/features/entity/v1_8_boat/BoatRenderer1_8.java @@ -37,7 +37,7 @@ import net.minecraft.util.math.RotationAxis; /** * Renderer for boats in 1.8 and lower. */ -public class BoatRenderer1_8 extends AbstractBoatEntityRenderer { +public final class BoatRenderer1_8 extends AbstractBoatEntityRenderer { private static final Identifier TEXTURE = Identifier.of("viafabricplus", "textures/boat1_8.png"); private final BoatModel1_8 model; diff --git a/src/main/java/com/viaversion/viafabricplus/features/filter_non_existing_characters/RenderableGlyphDiff.java b/src/main/java/com/viaversion/viafabricplus/features/filter_non_existing_characters/RenderableGlyphDiff.java index 7a72a138..8dbfe96e 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/filter_non_existing_characters/RenderableGlyphDiff.java +++ b/src/main/java/com/viaversion/viafabricplus/features/filter_non_existing_characters/RenderableGlyphDiff.java @@ -37,7 +37,7 @@ import static net.raphimc.vialegacy.api.LegacyProtocolVersion.c0_0_15a_1; * characters which the client doesn't know about and therefore can't render as placeholder for e.g. scoreboards, we have * to hide them because our client would render them as a different character. */ -public class RenderableGlyphDiff { +public final class RenderableGlyphDiff { private static final Int2ObjectMap RENDERABLE_GLYPH_DIFF_LEGACY = new Int2ObjectOpenHashMap<>(); private static final Int2ObjectMap RENDERABLE_GLYPH_DIFF = new Int2ObjectOpenHashMap<>(); diff --git a/src/main/java/com/viaversion/viafabricplus/features/filter_non_existing_characters/UnicodeFontFix1_12_2.java b/src/main/java/com/viaversion/viafabricplus/features/filter_non_existing_characters/UnicodeFontFix1_12_2.java index 384d6499..5db319c7 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/filter_non_existing_characters/UnicodeFontFix1_12_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features/filter_non_existing_characters/UnicodeFontFix1_12_2.java @@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.features.filter_non_existing_characters; import com.viaversion.viafabricplus.base.Events; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.util.LanguageUtil; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.minecraft.client.MinecraftClient; import net.minecraft.client.option.SimpleOption; @@ -35,7 +35,7 @@ import net.minecraft.util.Language; * Older versions only had unicode font support for some languages and therefore servers are expecting the client * to use a unicode font, not using it on older versions can cause issues with wrong dimensions in chat components. */ -public class UnicodeFontFix1_12_2 { +public final class UnicodeFontFix1_12_2 { private static boolean enabled = false; private static Runnable task = null; @@ -59,7 +59,7 @@ public class UnicodeFontFix1_12_2 { public static void updateUnicodeFontOverride(final ProtocolVersion version) { final SimpleOption option = MinecraftClient.getInstance().options.getForceUnicodeFont(); - if (VisualSettings.global().forceUnicodeFontForNonAsciiLanguages.isEnabled(version)) { + if (VisualSettings.INSTANCE.forceUnicodeFontForNonAsciiLanguages.isEnabled(version)) { if (Language.getInstance() instanceof TranslationStorage storage) { enabled = LanguageUtil.isUnicodeFont1_12_2(storage.translations); task = () -> option.setValue(enabled); diff --git a/src/main/java/com/viaversion/viafabricplus/features/footstep_particle/FootStepParticle1_12_2.java b/src/main/java/com/viaversion/viafabricplus/features/footstep_particle/FootStepParticle1_12_2.java index 6a0d389e..e747192d 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/footstep_particle/FootStepParticle1_12_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features/footstep_particle/FootStepParticle1_12_2.java @@ -37,7 +37,7 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import org.jetbrains.annotations.ApiStatus; -public class FootStepParticle1_12_2 extends SpriteBillboardParticle { +public final class FootStepParticle1_12_2 extends SpriteBillboardParticle { public static final Identifier ID = Identifier.of("viafabricplus", "footstep"); public static int RAW_ID; diff --git a/src/main/java/com/viaversion/viafabricplus/features/interaction/ActionResultException1_12_2.java b/src/main/java/com/viaversion/viafabricplus/features/interaction/ActionResultException1_12_2.java index 4f52769a..f429eeb9 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/interaction/ActionResultException1_12_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features/interaction/ActionResultException1_12_2.java @@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.features.interaction; import net.minecraft.util.ActionResult; -public class ActionResultException1_12_2 extends RuntimeException { +public final class ActionResultException1_12_2 extends RuntimeException { private final ActionResult actionResult; diff --git a/src/main/java/com/viaversion/viafabricplus/features/interaction/ClientPlayerInteractionManager1_18_2.java b/src/main/java/com/viaversion/viafabricplus/features/interaction/ClientPlayerInteractionManager1_18_2.java index 9bdc2746..b3768ada 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/interaction/ClientPlayerInteractionManager1_18_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features/interaction/ClientPlayerInteractionManager1_18_2.java @@ -36,7 +36,7 @@ import net.minecraft.util.math.Vec2f; import net.minecraft.util.math.Vec3d; import org.apache.commons.lang3.tuple.Pair; -public class ClientPlayerInteractionManager1_18_2 { +public final class ClientPlayerInteractionManager1_18_2 { private final Object2ObjectLinkedOpenHashMap, Pair> unAckedActions = new Object2ObjectLinkedOpenHashMap<>(); diff --git a/src/main/java/com/viaversion/viafabricplus/features/item/filter_creative_tabs/ItemRegistryDiff.java b/src/main/java/com/viaversion/viafabricplus/features/item/filter_creative_tabs/ItemRegistryDiff.java index 6f81e219..94540c84 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/item/filter_creative_tabs/ItemRegistryDiff.java +++ b/src/main/java/com/viaversion/viafabricplus/features/item/filter_creative_tabs/ItemRegistryDiff.java @@ -44,7 +44,7 @@ import static net.raphimc.vialoader.util.VersionRange.*; /** * Class file which contains the {@link VersionRange} for every item added in the game. */ -public class ItemRegistryDiff { +public final class ItemRegistryDiff { public static final Map ITEM_DIFF = new HashMap<>(); public static final List EXTENDED_CLASSIC_ITEMS = new ArrayList<>(); diff --git a/src/main/java/com/viaversion/viafabricplus/features/item/negative_items/NegativeItemUtil.java b/src/main/java/com/viaversion/viafabricplus/features/item/negative_items/NegativeItemUtil.java index 74468496..8025ce80 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/item/negative_items/NegativeItemUtil.java +++ b/src/main/java/com/viaversion/viafabricplus/features/item/negative_items/NegativeItemUtil.java @@ -26,7 +26,7 @@ import com.viaversion.viaversion.protocols.v1_10to1_11.Protocol1_10To1_11; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; -public class NegativeItemUtil { +public final class NegativeItemUtil { private static final String VV_IDENTIFIER = "VV|" + Protocol1_10To1_11.class.getSimpleName(); // ItemRewriter#nbtTagName diff --git a/src/main/java/com/viaversion/viafabricplus/features/item/tooltip_changes/Enchantments1_14_4.java b/src/main/java/com/viaversion/viafabricplus/features/item/tooltip_changes/Enchantments1_14_4.java index 0d770c53..5b609399 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/item/tooltip_changes/Enchantments1_14_4.java +++ b/src/main/java/com/viaversion/viafabricplus/features/item/tooltip_changes/Enchantments1_14_4.java @@ -30,7 +30,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Optional; -public class Enchantments1_14_4 { +public final class Enchantments1_14_4 { private static final Map> ENCHANTMENT_REGISTRY = new HashMap<>(); diff --git a/src/main/java/com/viaversion/viafabricplus/features/max_chat_length/MaxChatLength.java b/src/main/java/com/viaversion/viafabricplus/features/max_chat_length/MaxChatLength.java index 440936b8..3ad623f3 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/max_chat_length/MaxChatLength.java +++ b/src/main/java/com/viaversion/viafabricplus/features/max_chat_length/MaxChatLength.java @@ -31,7 +31,7 @@ import net.raphimc.vialegacy.api.LegacyProtocolVersion; import net.raphimc.vialegacy.protocol.classic.c0_30cpetoc0_28_30.data.ClassicProtocolExtension; import net.raphimc.vialegacy.protocol.classic.c0_30cpetoc0_28_30.storage.ExtensionProtocolMetadataStorage; -public class MaxChatLength { +public final class MaxChatLength { public static int getChatLength() { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { diff --git a/src/main/java/com/viaversion/viafabricplus/features/mouse_sensitivity/MouseSensitivity1_13_2.java b/src/main/java/com/viaversion/viafabricplus/features/mouse_sensitivity/MouseSensitivity1_13_2.java index 25a6c59e..eeae1560 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/mouse_sensitivity/MouseSensitivity1_13_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features/mouse_sensitivity/MouseSensitivity1_13_2.java @@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.features.mouse_sensitivity; import it.unimi.dsi.fastutil.floats.FloatIntPair; -public class MouseSensitivity1_13_2 { +public final class MouseSensitivity1_13_2 { public static FloatIntPair get1_13SliderValue(final float value1_14) { final int oldSliderWidth = 150 - 8; diff --git a/src/main/java/com/viaversion/viafabricplus/features/networking/resource_pack_header/ResourcePackHeaderDiff.java b/src/main/java/com/viaversion/viafabricplus/features/networking/resource_pack_header/ResourcePackHeaderDiff.java index 60798167..a48bec4d 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/networking/resource_pack_header/ResourcePackHeaderDiff.java +++ b/src/main/java/com/viaversion/viafabricplus/features/networking/resource_pack_header/ResourcePackHeaderDiff.java @@ -35,7 +35,7 @@ import java.util.Map; /** * This class file contains the {@link GameVersion} for each protocol version. */ -public class ResourcePackHeaderDiff { +public final class ResourcePackHeaderDiff { private final static Map GAME_VERSION_DIFF = new HashMap<>(); diff --git a/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/AddBannerPatternRecipe.java b/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/AddBannerPatternRecipe.java index 3647fe1b..c5100244 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/AddBannerPatternRecipe.java +++ b/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/AddBannerPatternRecipe.java @@ -40,7 +40,7 @@ import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.util.DyeColor; import net.minecraft.world.World; -public class AddBannerPatternRecipe extends SpecialCraftingRecipe { +public final class AddBannerPatternRecipe extends SpecialCraftingRecipe { public static final RecipeSerializer SERIALIZER = new SpecialRecipeSerializer<>(AddBannerPatternRecipe::new); diff --git a/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/RecipeManager1_11_2.java b/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/RecipeManager1_11_2.java index 12adc9fe..e10d4a01 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/RecipeManager1_11_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/RecipeManager1_11_2.java @@ -36,7 +36,7 @@ import java.util.Map; import java.util.Optional; import java.util.stream.Stream; -public class RecipeManager1_11_2 { +public final class RecipeManager1_11_2 { private final Multimap, RecipeEntry> recipesByType; private final Map>, RecipeEntry> recipesById; diff --git a/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/Recipes1_11_2.java b/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/Recipes1_11_2.java index 70c8537a..2a319220 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/Recipes1_11_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/Recipes1_11_2.java @@ -48,7 +48,7 @@ import java.util.List; /** * Recipe data dump for all versions below 1.12. */ -public class Recipes1_11_2 { +public final class Recipes1_11_2 { private static RecipeManager1_11_2 RECIPE_MANAGER; diff --git a/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/ShulkerBoxColoringRecipe.java b/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/ShulkerBoxColoringRecipe.java index 02dfcc5f..1b36b165 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/ShulkerBoxColoringRecipe.java +++ b/src/main/java/com/viaversion/viafabricplus/features/recipe_emulation/ShulkerBoxColoringRecipe.java @@ -34,7 +34,7 @@ import net.minecraft.recipe.input.CraftingRecipeInput; import net.minecraft.registry.RegistryWrapper; import net.minecraft.world.World; -public class ShulkerBoxColoringRecipe extends SpecialCraftingRecipe { +public final class ShulkerBoxColoringRecipe extends SpecialCraftingRecipe { public static final RecipeSerializer SERIALIZER = new SpecialRecipeSerializer<>(ShulkerBoxColoringRecipe::new); diff --git a/src/main/java/com/viaversion/viafabricplus/features/ui/armor_hud/ArmorHudEmulation1_8.java b/src/main/java/com/viaversion/viafabricplus/features/ui/armor_hud/ArmorHudEmulation1_8.java index dca60d96..df182e0d 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/ui/armor_hud/ArmorHudEmulation1_8.java +++ b/src/main/java/com/viaversion/viafabricplus/features/ui/armor_hud/ArmorHudEmulation1_8.java @@ -29,16 +29,15 @@ import com.viaversion.viaversion.protocols.v1_8to1_9.data.ArmorTypes1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_9; import com.viaversion.viafabricplus.ViaFabricPlusImpl; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.minecraft.client.MinecraftClient; import net.minecraft.item.ItemStack; import net.minecraft.registry.Registries; -import org.jetbrains.annotations.ApiStatus; import java.util.UUID; -public class ArmorHudEmulation1_8 { +public final class ArmorHudEmulation1_8 { private static final UUID ARMOR_POINTS_UUID = UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150"); @@ -46,7 +45,7 @@ public class ArmorHudEmulation1_8 { static { ClientTickEvents.START_WORLD_TICK.register(world -> { - if (!VisualSettings.global().emulateArmorHud.isEnabled()) { + if (!VisualSettings.INSTANCE.emulateArmorHud.isEnabled()) { return; } diff --git a/src/main/java/com/viaversion/viafabricplus/features/ui/classic_creative_menu/GridItemSelectionScreen.java b/src/main/java/com/viaversion/viafabricplus/features/ui/classic_creative_menu/GridItemSelectionScreen.java index 30a573c1..d878d513 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/ui/classic_creative_menu/GridItemSelectionScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/features/ui/classic_creative_menu/GridItemSelectionScreen.java @@ -35,7 +35,7 @@ import java.util.ArrayList; import java.util.List; @SuppressWarnings("DataFlowIssue") -public class GridItemSelectionScreen extends VFPScreen { +public final class GridItemSelectionScreen extends VFPScreen { public static final GridItemSelectionScreen INSTANCE = new GridItemSelectionScreen(); diff --git a/src/main/java/com/viaversion/viafabricplus/features/ui/v1_7_tab_list_style/LegacyTabList.java b/src/main/java/com/viaversion/viafabricplus/features/ui/v1_7_tab_list_style/LegacyTabList.java index 29c60d42..d75f99a8 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/ui/v1_7_tab_list_style/LegacyTabList.java +++ b/src/main/java/com/viaversion/viafabricplus/features/ui/v1_7_tab_list_style/LegacyTabList.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.features.ui.v1_7_tab_list_style; -public class LegacyTabList { +public final class LegacyTabList { /** * This is an incremental index used for tablist entries to implement FIFO behavior <= 1.7 diff --git a/src/main/java/com/viaversion/viafabricplus/features/world/disable_sequencing/PendingUpdateManager1_18_2.java b/src/main/java/com/viaversion/viafabricplus/features/world/disable_sequencing/PendingUpdateManager1_18_2.java index 387e52a5..b9a3ebbe 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/world/disable_sequencing/PendingUpdateManager1_18_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features/world/disable_sequencing/PendingUpdateManager1_18_2.java @@ -31,7 +31,7 @@ import net.minecraft.util.math.BlockPos; * No-op implementation of {@link PendingUpdateManager} for 1.18.2 and lower since those versions don't have the * {@link PendingUpdateManager} class. */ -public class PendingUpdateManager1_18_2 extends PendingUpdateManager { +public final class PendingUpdateManager1_18_2 extends PendingUpdateManager { @Override public void addPendingUpdate(BlockPos pos, BlockState state, ClientPlayerEntity player) { diff --git a/src/main/java/com/viaversion/viafabricplus/features/world/item_picking/ItemPick1_21_3.java b/src/main/java/com/viaversion/viafabricplus/features/world/item_picking/ItemPick1_21_3.java index 75bde443..ab619d2c 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/world/item_picking/ItemPick1_21_3.java +++ b/src/main/java/com/viaversion/viafabricplus/features/world/item_picking/ItemPick1_21_3.java @@ -43,7 +43,7 @@ import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; -public class ItemPick1_21_3 { +public final class ItemPick1_21_3 { private static void addPickBlock(final PlayerInventory inventory, final ItemStack stack) { final int index = inventory.getSlotWithStack(stack); diff --git a/src/main/java/com/viaversion/viafabricplus/injection/ViaFabricPlusMixinPlugin.java b/src/main/java/com/viaversion/viafabricplus/injection/ViaFabricPlusMixinPlugin.java index 1e5cc7ef..8c09706c 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/ViaFabricPlusMixinPlugin.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/ViaFabricPlusMixinPlugin.java @@ -31,7 +31,7 @@ import org.spongepowered.asm.mixin.extensibility.IMixinInfo; import java.util.List; import java.util.Set; -public class ViaFabricPlusMixinPlugin implements IMixinConfigPlugin { +public final class ViaFabricPlusMixinPlugin implements IMixinConfigPlugin { public static final String INJECTOR_PACKAGE = "com.viaversion.viafabricplus.injection.mixin."; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/MixinMain.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/MixinMain.java index e235d8c1..e61d0884 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/MixinMain.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/MixinMain.java @@ -21,7 +21,6 @@ package com.viaversion.viafabricplus.injection.mixin.base; -import com.viaversion.viafabricplus.ViaFabricPlus; import com.viaversion.viafabricplus.ViaFabricPlusImpl; import com.viaversion.viafabricplus.api.LoadingCycleCallback; import com.viaversion.viafabricplus.base.Events; @@ -37,7 +36,7 @@ public abstract class MixinMain { @Inject(method = "main", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Util;startTimerHack()V")) private static void bootstrap(CallbackInfo ci) { Events.LOADING_CYCLE.invoker().onLoadCycle(LoadingCycleCallback.LoadingCycle.INITIAL_LOAD); - ViaFabricPlus.init(ViaFabricPlusImpl.INSTANCE); + ViaFabricPlusImpl.INSTANCE.init(); Events.LOADING_CYCLE.invoker().onLoadCycle(LoadingCycleCallback.LoadingCycle.FINAL_LOAD); } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/connection/MixinMinecraftClient.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/connection/MixinMinecraftClient.java index 5a13e55d..3e63faa6 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/connection/MixinMinecraftClient.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/connection/MixinMinecraftClient.java @@ -34,7 +34,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(MinecraftClient.class) -public class MixinMinecraftClient { +public final class MixinMinecraftClient { @Inject(method = "startIntegratedServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;connect(Ljava/lang/String;ILnet/minecraft/network/listener/ClientLoginPacketListener;)V", shift = At.Shift.BEFORE)) private void disableProtocolTranslator(LevelStorage.Session session, ResourcePackManager dataPackManager, SaveLoader saveLoader, boolean newWorld, CallbackInfo ci, @Local ClientConnection clientConnection) { diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/connection/MixinMultiplayerServerListPinger.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/connection/MixinMultiplayerServerListPinger.java index b5c2b829..60dc4669 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/connection/MixinMultiplayerServerListPinger.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/connection/MixinMultiplayerServerListPinger.java @@ -36,7 +36,7 @@ import org.spongepowered.asm.mixin.injection.At; import java.net.InetSocketAddress; @Mixin(MultiplayerServerListPinger.class) -public class MixinMultiplayerServerListPinger { +public final class MixinMultiplayerServerListPinger { @WrapOperation(method = "add", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/util/profiler/MultiValueDebugSampleLogImpl;)Lnet/minecraft/network/ClientConnection;")) private ClientConnection setForcedVersion(InetSocketAddress address, boolean useEpoll, MultiValueDebugSampleLogImpl packetSizeLog, Operation original, @Local(argsOnly = true) ServerInfo serverInfo) { diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinClientConnection.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinClientConnection.java index 11936296..fe6fceb3 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinClientConnection.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinClientConnection.java @@ -22,7 +22,7 @@ package com.viaversion.viafabricplus.injection.mixin.base.integration; import com.viaversion.viafabricplus.ViaFabricPlusImpl; -import com.viaversion.viafabricplus.base.settings.impl.DebugSettings; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; import io.netty.channel.ChannelHandlerContext; import net.minecraft.network.ClientConnection; import org.spongepowered.asm.mixin.Mixin; @@ -38,7 +38,7 @@ public abstract class MixinClientConnection { @Inject(method = "exceptionCaught", at = @At("HEAD")) private void printNetworkingErrors(ChannelHandlerContext context, Throwable ex, CallbackInfo ci) { - if (DebugSettings.global().printNetworkingErrorsToLogs.getValue()) { + if (DebugSettings.INSTANCE.printNetworkingErrorsToLogs.getValue()) { if (ex instanceof SocketException || ex instanceof ConnectException) { // Thrown when server is not reachable return; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinDebugHud.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinDebugHud.java index 45fe50b5..aff44d5f 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinDebugHud.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinDebugHud.java @@ -28,7 +28,7 @@ import com.viaversion.viafabricplus.injection.ViaFabricPlusMixinPlugin; import com.viaversion.viafabricplus.injection.access.base.bedrock.IChunkTracker; import com.viaversion.viafabricplus.injection.access.base.bedrock.IRakSessionCodec; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings; +import com.viaversion.viafabricplus.settings.impl.GeneralSettings; import com.viaversion.viafabricplus.util.ChatUtil; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.hud.DebugHud; @@ -56,7 +56,7 @@ public abstract class MixinDebugHud { @Inject(method = "getLeftText", at = @At("RETURN")) public void addViaFabricPlusInformation(CallbackInfoReturnable> cir) { - if (!GeneralSettings.global().showExtraInformationInDebugHud.getValue()) { // Only show if enabled + if (!GeneralSettings.INSTANCE.showExtraInformationInDebugHud.getValue()) { // Only show if enabled return; } if (MinecraftClient.getInstance().isInSingleplayer() && MinecraftClient.getInstance().player != null) { // Don't show in singleplayer diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinMultiplayerServerListPinger.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinMultiplayerServerListPinger.java index 2ec0c528..30ea234a 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinMultiplayerServerListPinger.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinMultiplayerServerListPinger.java @@ -25,7 +25,7 @@ import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.llamalad7.mixinextras.sugar.Local; import com.viaversion.viafabricplus.injection.access.base.IServerInfo; -import com.viaversion.viafabricplus.base.settings.impl.BedrockSettings; +import com.viaversion.viafabricplus.settings.impl.BedrockSettings; import net.minecraft.client.network.MultiplayerServerListPinger; import net.minecraft.client.network.ServerAddress; import net.minecraft.client.network.ServerInfo; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinServerInfo.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinServerInfo.java index 50add109..3644c418 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinServerInfo.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinServerInfo.java @@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.injection.mixin.base.integration; import com.llamalad7.mixinextras.sugar.Local; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.injection.access.base.IServerInfo; -import com.viaversion.viafabricplus.base.save.impl.SettingsSave; +import com.viaversion.viafabricplus.save.impl.SettingsSave; import net.minecraft.client.network.ServerInfo; import net.minecraft.nbt.NbtCompound; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinAddServerScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinAddServerScreen.java index 51de8594..5a481da2 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinAddServerScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinAddServerScreen.java @@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.injection.mixin.base.ui; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.injection.access.base.IServerInfo; import com.viaversion.viafabricplus.screen.PerServerVersionScreen; -import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings; +import com.viaversion.viafabricplus.settings.impl.GeneralSettings; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.multiplayer.AddServerScreen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -64,7 +64,7 @@ public abstract class MixinAddServerScreen extends Screen { @Inject(method = "init", at = @At("RETURN")) private void addVersionSetterButton(CallbackInfo ci) { - final int buttonPosition = GeneralSettings.global().addServerScreenButtonOrientation.getIndex(); + final int buttonPosition = GeneralSettings.INSTANCE.addServerScreenButtonOrientation.getIndex(); if (buttonPosition == 0) { // Off return; } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinConnectScreen_1.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinConnectScreen_1.java index 21ce34c6..476fe3c1 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinConnectScreen_1.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinConnectScreen_1.java @@ -30,7 +30,7 @@ import com.viaversion.viafabricplus.injection.access.base.IServerInfo; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; import com.viaversion.viafabricplus.protocoltranslator.impl.provider.vialegacy.ViaFabricPlusClassicMPPassProvider; import com.viaversion.viafabricplus.protocoltranslator.util.ProtocolVersionDetector; -import com.viaversion.viafabricplus.base.settings.impl.AuthenticationSettings; +import com.viaversion.viafabricplus.settings.impl.AuthenticationSettings; import io.netty.channel.ChannelFuture; import net.minecraft.client.gui.screen.multiplayer.ConnectScreen; import net.minecraft.client.network.ServerInfo; @@ -75,7 +75,7 @@ public abstract class MixinConnectScreen_1 { } ProtocolTranslator.setTargetVersion(targetVersion, true); - this.viaFabricPlus$useClassiCubeAccount = AuthenticationSettings.global().setSessionNameToClassiCubeNameInServerList.getValue() && ViaFabricPlusClassicMPPassProvider.classicubeMPPass != null; + this.viaFabricPlus$useClassiCubeAccount = AuthenticationSettings.INSTANCE.setSessionNameToClassiCubeNameInServerList.getValue() && ViaFabricPlusClassicMPPassProvider.classicubeMPPass != null; final ChannelFuture future = original.call(address, useEpoll, connection); ProtocolTranslator.injectPreviousVersionReset(future.channel()); diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinDirectConnectScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinDirectConnectScreen.java index 6144f1ac..b04a214f 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinDirectConnectScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinDirectConnectScreen.java @@ -22,7 +22,7 @@ package com.viaversion.viafabricplus.injection.mixin.base.ui; import com.viaversion.viafabricplus.screen.ProtocolSelectionScreen; -import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings; +import com.viaversion.viafabricplus.settings.impl.GeneralSettings; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.multiplayer.DirectConnectScreen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -41,7 +41,7 @@ public abstract class MixinDirectConnectScreen extends Screen { @Inject(method = "init", at = @At("RETURN")) private void addProtocolSelectionButton(CallbackInfo ci) { - final int buttonPosition = GeneralSettings.global().directConnectScreenButtonOrientation.getIndex(); + final int buttonPosition = GeneralSettings.INSTANCE.directConnectScreenButtonOrientation.getIndex(); if (buttonPosition == 0) { // Off return; } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinDownloadingTerrainScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinDownloadingTerrainScreen.java index 966fab51..c87f6ecd 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinDownloadingTerrainScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinDownloadingTerrainScreen.java @@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.injection.mixin.base.ui; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings; +import com.viaversion.viafabricplus.settings.impl.GeneralSettings; import com.viaversion.viafabricplus.util.ChatUtil; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.DownloadingTerrainScreen; @@ -44,7 +44,7 @@ public abstract class MixinDownloadingTerrainScreen extends Screen { @Inject(method = "render", at = @At("RETURN")) private void renderClassicProgress(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { - if (GeneralSettings.global().showClassicLoadingProgressInConnectScreen.getValue()) { + if (GeneralSettings.INSTANCE.showClassicLoadingProgressInConnectScreen.getValue()) { // Check if ViaVersion is translating final UserConnection connection = ProtocolTranslator.getPlayNetworkUserConnection(); if (connection == null) { diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinMultiplayerScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinMultiplayerScreen.java index 27474ef2..983a2a25 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinMultiplayerScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinMultiplayerScreen.java @@ -24,12 +24,12 @@ package com.viaversion.viafabricplus.injection.mixin.base.ui; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.llamalad7.mixinextras.sugar.Local; -import com.viaversion.viafabricplus.base.settings.impl.BedrockSettings; +import com.viaversion.viafabricplus.settings.impl.BedrockSettings; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.injection.access.base.IServerInfo; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; import com.viaversion.viafabricplus.screen.ProtocolSelectionScreen; -import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings; +import com.viaversion.viafabricplus.settings.impl.GeneralSettings; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -50,7 +50,7 @@ public abstract class MixinMultiplayerScreen extends Screen { @Inject(method = "init", at = @At("RETURN")) private void addProtocolSelectionButton(CallbackInfo ci) { - final int buttonPosition = GeneralSettings.global().multiplayerScreenButtonOrientation.getIndex(); + final int buttonPosition = GeneralSettings.INSTANCE.multiplayerScreenButtonOrientation.getIndex(); if (buttonPosition == 0) { // Off return; } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/compat/fabricapi/MixinClientRegistrySyncHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/compat/fabricapi/MixinClientRegistrySyncHandler.java index 2bc041b0..d04eb0be 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/compat/fabricapi/MixinClientRegistrySyncHandler.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/compat/fabricapi/MixinClientRegistrySyncHandler.java @@ -22,7 +22,7 @@ package com.viaversion.viafabricplus.injection.mixin.compat.fabricapi; import com.viaversion.viafabricplus.ViaFabricPlusImpl; -import com.viaversion.viafabricplus.base.settings.impl.DebugSettings; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; import net.fabricmc.fabric.impl.client.registry.sync.ClientRegistrySyncHandler; import net.fabricmc.fabric.impl.registry.sync.packet.RegistryPacketHandler; import org.spongepowered.asm.mixin.Mixin; @@ -35,7 +35,7 @@ public abstract class MixinClientRegistrySyncHandler { @Inject(method = "checkRemoteRemap", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;)V", ordinal = 0), cancellable = true, remap = false) private static void ignoreFabricSyncErrors(RegistryPacketHandler.SyncedPacketData data, CallbackInfo ci) { - if (DebugSettings.global().ignoreFabricSyncErrors.getValue()) { + if (DebugSettings.INSTANCE.ignoreFabricSyncErrors.getValue()) { ViaFabricPlusImpl.INSTANCE.logger().warn("Ignoring missing registries from Fabric API"); ci.cancel(); } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/execute_inputs_sync/MixinKeyboard.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/execute_inputs_sync/MixinKeyboard.java index 360fea4e..7f84b740 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/execute_inputs_sync/MixinKeyboard.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/execute_inputs_sync/MixinKeyboard.java @@ -22,7 +22,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.execute_inputs_sync; import com.viaversion.viafabricplus.injection.access.execute_inputs_sync.IMouseKeyboard; -import com.viaversion.viafabricplus.base.settings.impl.DebugSettings; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; import net.minecraft.client.Keyboard; import net.minecraft.client.MinecraftClient; import org.spongepowered.asm.mixin.Final; @@ -47,7 +47,7 @@ public abstract class MixinKeyboard implements IMouseKeyboard { @Redirect(method = {"method_22676", "method_22675"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;execute(Ljava/lang/Runnable;)V")) private void storeEvent(MinecraftClient instance, Runnable runnable) { - if (this.client.getNetworkHandler() != null && this.client.currentScreen != null && DebugSettings.global().executeInputsSynchronously.isEnabled()) { + if (this.client.getNetworkHandler() != null && this.client.currentScreen != null && DebugSettings.INSTANCE.executeInputsSynchronously.isEnabled()) { this.viaFabricPlus$pendingScreenEvents.offer(runnable); } else { instance.execute(runnable); diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/execute_inputs_sync/MixinMinecraftClient.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/execute_inputs_sync/MixinMinecraftClient.java index 17b08a5d..4463517e 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/execute_inputs_sync/MixinMinecraftClient.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/execute_inputs_sync/MixinMinecraftClient.java @@ -22,7 +22,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.execute_inputs_sync; import com.viaversion.viafabricplus.injection.access.execute_inputs_sync.IMouseKeyboard; -import com.viaversion.viafabricplus.base.settings.impl.DebugSettings; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; import net.minecraft.client.Keyboard; import net.minecraft.client.MinecraftClient; import net.minecraft.client.Mouse; @@ -55,7 +55,7 @@ public abstract class MixinMinecraftClient { ) ) private void processInputQueues(CallbackInfo ci) { - if (DebugSettings.global().executeInputsSynchronously.isEnabled()) { + if (DebugSettings.INSTANCE.executeInputsSynchronously.isEnabled()) { Queue inputEvents = ((IMouseKeyboard) this.mouse).viaFabricPlus$getPendingScreenEvents(); while (!inputEvents.isEmpty()) inputEvents.poll().run(); diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/execute_inputs_sync/MixinMouse.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/execute_inputs_sync/MixinMouse.java index 88050a2c..35ff56e4 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/execute_inputs_sync/MixinMouse.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/execute_inputs_sync/MixinMouse.java @@ -22,7 +22,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.execute_inputs_sync; import com.viaversion.viafabricplus.injection.access.execute_inputs_sync.IMouseKeyboard; -import com.viaversion.viafabricplus.base.settings.impl.DebugSettings; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.Mouse; import org.spongepowered.asm.mixin.Final; @@ -47,7 +47,7 @@ public abstract class MixinMouse implements IMouseKeyboard { @Redirect(method = {"method_22684", "method_22685"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;execute(Ljava/lang/Runnable;)V")) private void storeEvent(MinecraftClient instance, Runnable runnable) { - if (this.client.getNetworkHandler() != null && this.client.currentScreen != null && DebugSettings.global().executeInputsSynchronously.isEnabled()) { + if (this.client.getNetworkHandler() != null && this.client.currentScreen != null && DebugSettings.INSTANCE.executeInputsSynchronously.isEnabled()) { this.viaFabricPlus$pendingScreenEvents.offer(runnable); } else { instance.execute(runnable); diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/filter_non_existing_characters/MixinFontStorage.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/filter_non_existing_characters/MixinFontStorage.java index 571076af..e8bf832e 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/filter_non_existing_characters/MixinFontStorage.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/filter_non_existing_characters/MixinFontStorage.java @@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.filter_non_existin import com.viaversion.viafabricplus.features.filter_non_existing_characters.RenderableGlyphDiff; import com.viaversion.viafabricplus.features.filter_non_existing_characters.BuiltinEmptyGlyph1_12_2; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.*; import net.minecraft.util.Identifier; @@ -72,7 +72,7 @@ public abstract class MixinFontStorage { @Inject(method = "findGlyph", at = @At("RETURN"), cancellable = true) private void fixBlankGlyph1_12_2(int codePoint, CallbackInfoReturnable cir) { - if (VisualSettings.global().changeFontRendererBehaviour.isEnabled()) { + if (VisualSettings.INSTANCE.changeFontRendererBehaviour.isEnabled()) { final FontStorage.GlyphPair glyphPair = cir.getReturnValue(); final Glyph glyph1 = glyphPair.glyph(); final Glyph glyph2 = glyphPair.advanceValidatedGlyph(); @@ -87,7 +87,7 @@ public abstract class MixinFontStorage { @Unique private boolean viaFabricPlus$shouldBeInvisible(final int codePoint) { - if (VisualSettings.global().filterNonExistingGlyphs.getValue()) { + 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; @@ -96,7 +96,7 @@ public abstract class MixinFontStorage { @Unique private FontStorage.GlyphPair viaFabricPlus$getBlankGlyphPair() { - if (VisualSettings.global().changeFontRendererBehaviour.isEnabled()) { + if (VisualSettings.INSTANCE.changeFontRendererBehaviour.isEnabled()) { return new FontStorage.GlyphPair(BuiltinEmptyGlyph1_12_2.INSTANCE, BuiltinEmptyGlyph1_12_2.INSTANCE); } else { return FontStorage.GlyphPair.MISSING; @@ -105,7 +105,7 @@ public abstract class MixinFontStorage { @Unique private BakedGlyph viaFabricPlus$getBlankBakedGlyph() { - if (VisualSettings.global().changeFontRendererBehaviour.isEnabled()) { + if (VisualSettings.INSTANCE.changeFontRendererBehaviour.isEnabled()) { return this.viaFabricPlus$blankBakedGlyph1_12_2; } else { return this.blankBakedGlyph; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/instant_sneaking/MixinCamera.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/instant_sneaking/MixinCamera.java index 27697742..8a1612de 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/instant_sneaking/MixinCamera.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/instant_sneaking/MixinCamera.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.instant_sneaking; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.render.Camera; import net.minecraft.entity.Entity; import org.spongepowered.asm.mixin.Mixin; @@ -44,7 +44,7 @@ public abstract class MixinCamera { @Inject(method = "updateEyeHeight", at = @At(value = "HEAD"), cancellable = true) private void sneakInstantly(CallbackInfo ci) { - if (this.focusedEntity != null && VisualSettings.global().sneakInstantly.isEnabled()) { + if (this.focusedEntity != null && VisualSettings.INSTANCE.sneakInstantly.isEnabled()) { ci.cancel(); cameraY = lastCameraY = focusedEntity.getStandingEyeHeight(); } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/interaction/MixinClientPlayerInteractionManager.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/interaction/MixinClientPlayerInteractionManager.java index 10381a48..c27d79c9 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/interaction/MixinClientPlayerInteractionManager.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/interaction/MixinClientPlayerInteractionManager.java @@ -36,7 +36,7 @@ import com.viaversion.viafabricplus.injection.access.IScreenHandler; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; import com.viaversion.viafabricplus.protocoltranslator.impl.provider.viaversion.ViaFabricPlusHandItemProvider; import com.viaversion.viafabricplus.protocoltranslator.translator.ItemTranslator; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.SnowBlock; @@ -328,7 +328,7 @@ public abstract class MixinClientPlayerInteractionManager implements IClientPlay @Inject(method = "hasExperienceBar", at = @At("HEAD"), cancellable = true) private void removeExperienceBar(CallbackInfoReturnable cir) { - if (VisualSettings.global().hideModernHUDElements.isEnabled()) { + if (VisualSettings.INSTANCE.hideModernHUDElements.isEnabled()) { cir.setReturnValue(false); } } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/cooldown/MixinItemCooldownManager.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/cooldown/MixinItemCooldownManager.java index c32075d7..027e3f11 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/cooldown/MixinItemCooldownManager.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/cooldown/MixinItemCooldownManager.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.item.cooldown; -import com.viaversion.viafabricplus.base.settings.impl.DebugSettings; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; import net.minecraft.entity.player.ItemCooldownManager; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -33,7 +33,7 @@ public abstract class MixinItemCooldownManager { @Inject(method = "set(Lnet/minecraft/util/Identifier;I)V", at = @At("HEAD"), cancellable = true) private void dontSetCooldown(CallbackInfo ci) { - if (DebugSettings.global().removeCooldowns.isEnabled()) { + if (DebugSettings.INSTANCE.removeCooldowns.isEnabled()) { ci.cancel(); } } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/filter_creative_tabs/MixinItemGroup_EntriesImpl.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/filter_creative_tabs/MixinItemGroup_EntriesImpl.java index b178f392..b680eddb 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/filter_creative_tabs/MixinItemGroup_EntriesImpl.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/filter_creative_tabs/MixinItemGroup_EntriesImpl.java @@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.item.filter_creati import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.viaversion.viafabricplus.features.item.filter_creative_tabs.ItemRegistryDiff; -import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings; +import com.viaversion.viafabricplus.settings.impl.GeneralSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; @@ -46,7 +46,7 @@ public abstract class MixinItemGroup_EntriesImpl { @WrapOperation(method = "add", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;isEnabled(Lnet/minecraft/resource/featuretoggle/FeatureSet;)Z")) private boolean removeUnknownItems(Item instance, FeatureSet featureSet, Operation original) { final boolean originalValue = original.call(instance, featureSet); - final int index = GeneralSettings.global().removeNotAvailableItemsFromCreativeTab.getIndex(); + final int index = GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getIndex(); if (index == 2 /* Off */ || MinecraftClient.getInstance().isInSingleplayer()) { return originalValue; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/filter_creative_tabs/MixinItemGroups.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/filter_creative_tabs/MixinItemGroups.java index bc504293..c12e27d9 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/filter_creative_tabs/MixinItemGroups.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/filter_creative_tabs/MixinItemGroups.java @@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.item.filter_creati import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings; +import com.viaversion.viafabricplus.settings.impl.GeneralSettings; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroups; import net.minecraft.registry.RegistryWrapper; @@ -55,9 +55,9 @@ public abstract class MixinItemGroups { @Inject(method = "updateDisplayContext", at = @At("HEAD"), cancellable = true) private static void trackLastVersion(FeatureSet enabledFeatures, boolean operatorEnabled, RegistryWrapper.WrapperLookup lookup, CallbackInfoReturnable cir) { - if (viaFabricPlus$version != ProtocolTranslator.getTargetVersion() || viaFabricPlus$state != GeneralSettings.global().removeNotAvailableItemsFromCreativeTab.getIndex()) { + if (viaFabricPlus$version != ProtocolTranslator.getTargetVersion() || viaFabricPlus$state != GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getIndex()) { viaFabricPlus$version = ProtocolTranslator.getTargetVersion(); - viaFabricPlus$state = GeneralSettings.global().removeNotAvailableItemsFromCreativeTab.getIndex(); + viaFabricPlus$state = GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getIndex(); displayContext = new ItemGroup.DisplayContext(enabledFeatures, operatorEnabled, lookup); updateEntries(displayContext); diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/missing_model/MixinItemRenderer.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/missing_model/MixinItemRenderer.java index a59cec9e..0b4f9ca8 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/missing_model/MixinItemRenderer.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/missing_model/MixinItemRenderer.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.item.missing_model; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.item.ItemModelManager; import net.minecraft.component.ComponentType; import net.minecraft.item.ItemStack; @@ -41,7 +41,7 @@ public abstract class MixinItemRenderer { @Redirect(method = "update(Lnet/minecraft/client/render/item/ItemRenderState;Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ModelTransformationMode;Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;get(Lnet/minecraft/component/ComponentType;)Ljava/lang/Object;")) private Object removeModel(ItemStack instance, ComponentType componentType) { - if (VisualSettings.global().replacePetrifiedOakSlab.isEnabled() && instance.isOf(Items.PETRIFIED_OAK_SLAB)) { + if (VisualSettings.INSTANCE.replacePetrifiedOakSlab.isEnabled() && instance.isOf(Items.PETRIFIED_OAK_SLAB)) { return viaFabricPlus$missingIdentifier; } else { return instance.get(componentType); diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/v1_7_tilt/MixinHeldItemRenderer.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/v1_7_tilt/MixinHeldItemRenderer.java index 46ad49cf..7381e799 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/v1_7_tilt/MixinHeldItemRenderer.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/v1_7_tilt/MixinHeldItemRenderer.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.item.v1_7_tilt; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.item.HeldItemRenderer; @@ -65,7 +65,7 @@ public abstract class MixinHeldItemRenderer { @Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", ordinal = 1)) private void slightlyTiltItemPosition(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack stack, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { - if (VisualSettings.global().tiltItemPositions.isEnabled() && !(stack.getItem() instanceof BlockItem)) { + if (VisualSettings.INSTANCE.tiltItemPositions.isEnabled() && !(stack.getItem() instanceof BlockItem)) { final Arm arm = hand == Hand.MAIN_HAND ? player.getMainArm() : player.getMainArm().getOpposite(); final int direction = arm == Arm.RIGHT ? 1 : -1; @@ -78,7 +78,7 @@ public abstract class MixinHeldItemRenderer { @Unique private void viaFabricPlus$applySwingOffset(AbstractClientPlayerEntity player, Hand hand, float swingProgress, MatrixStack matrices) { - if (VisualSettings.global().swingHandOnItemUse.isEnabled()) { + if (VisualSettings.INSTANCE.swingHandOnItemUse.isEnabled()) { final Arm arm = hand == Hand.MAIN_HAND ? player.getMainArm() : player.getMainArm().getOpposite(); applySwingOffset(matrices, arm, swingProgress); } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/legacy_tab_completions/MixinChatInputSuggestor.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/legacy_tab_completions/MixinChatInputSuggestor.java index 6236b89b..ab5acc60 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/legacy_tab_completions/MixinChatInputSuggestor.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/legacy_tab_completions/MixinChatInputSuggestor.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.legacy_tab_completions; -import com.viaversion.viafabricplus.base.settings.impl.DebugSettings; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ChatInputSuggestor; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -90,7 +90,7 @@ public abstract class MixinChatInputSuggestor { @Unique private boolean viaFabricPlus$cancelTabComplete() { - return DebugSettings.global().legacyTabCompletions.isEnabled() && this.textField.getText().startsWith("/"); + return DebugSettings.INSTANCE.legacyTabCompletions.isEnabled() && this.textField.getText().startsWith("/"); } } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/legacy_tab_completions/MixinChatScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/legacy_tab_completions/MixinChatScreen.java index d07655b3..ac329f46 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/legacy_tab_completions/MixinChatScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/legacy_tab_completions/MixinChatScreen.java @@ -22,7 +22,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.legacy_tab_completions; import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; -import com.viaversion.viafabricplus.base.settings.impl.DebugSettings; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; import net.minecraft.client.gui.screen.ChatInputSuggestor; import net.minecraft.client.gui.screen.ChatScreen; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -48,12 +48,12 @@ public abstract class MixinChatScreen { @WrapWithCondition(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/TextFieldWidget;setText(Ljava/lang/String;)V")) public boolean moveSetTextDown(TextFieldWidget instance, String text) { - return !DebugSettings.global().legacyTabCompletions.isEnabled(); + return !DebugSettings.INSTANCE.legacyTabCompletions.isEnabled(); } @Inject(method = "init", at = @At("RETURN")) private void moveSetTextDown(CallbackInfo ci) { - if (DebugSettings.global().legacyTabCompletions.isEnabled()) { + if (DebugSettings.INSTANCE.legacyTabCompletions.isEnabled()) { this.chatField.setText(this.originalChatText); this.chatInputSuggestor.refresh(); } @@ -75,7 +75,7 @@ public abstract class MixinChatScreen { @Unique private boolean viaFabricPlus$keepTabComplete() { - return !DebugSettings.global().legacyTabCompletions.isEnabled() || !this.chatField.getText().startsWith("/"); + return !DebugSettings.INSTANCE.legacyTabCompletions.isEnabled() || !this.chatField.getText().startsWith("/"); } } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/config_state_fixes/MixinProtocol1_20To1_20_2.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/config_state_fixes/MixinProtocol1_20To1_20_2.java index 394f9ccc..e2e3a445 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/config_state_fixes/MixinProtocol1_20To1_20_2.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/config_state_fixes/MixinProtocol1_20To1_20_2.java @@ -25,7 +25,7 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.protocols.v1_19_3to1_19_4.packet.ServerboundPackets1_19_4; import com.viaversion.viaversion.protocols.v1_20to1_20_2.Protocol1_20To1_20_2; import com.viaversion.viaversion.protocols.v1_20to1_20_2.packet.ServerboundPackets1_20_2; -import com.viaversion.viafabricplus.base.settings.impl.DebugSettings; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -36,7 +36,7 @@ public abstract class MixinProtocol1_20To1_20_2 { @Inject(method = "lambda$queueServerboundPacket$12", at = @At("HEAD"), cancellable = true) private static void dontQueueConfigPackets(ServerboundPackets1_20_2 packetType, PacketWrapper wrapper, CallbackInfo ci) { - if (!DebugSettings.global().queueConfigPackets.getValue()) { + if (!DebugSettings.INSTANCE.queueConfigPackets.getValue()) { ci.cancel(); switch (packetType) { case CUSTOM_PAYLOAD -> wrapper.setPacketType(ServerboundPackets1_19_4.CUSTOM_PAYLOAD); diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/legacy_chat_signatures/MixinChatHud.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/legacy_chat_signatures/MixinChatHud.java index 8f7feb0f..4c0a6aca 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/legacy_chat_signatures/MixinChatHud.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/legacy_chat_signatures/MixinChatHud.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.networking.legacy_chat_signatures; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.gui.hud.ChatHud; import net.minecraft.client.gui.hud.MessageIndicator; import org.spongepowered.asm.mixin.Mixin; @@ -33,7 +33,7 @@ public abstract class MixinChatHud { @ModifyVariable(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", at = @At("HEAD"), ordinal = 0, argsOnly = true) private MessageIndicator removeIndicator(MessageIndicator instance) { - return VisualSettings.global().hideSignatureIndicator.isEnabled() ? null : instance; + return VisualSettings.INSTANCE.hideSignatureIndicator.isEnabled() ? null : instance; } } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/legacy_chat_signatures/MixinChatScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/legacy_chat_signatures/MixinChatScreen.java index 0c7d51c6..439974e2 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/legacy_chat_signatures/MixinChatScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/legacy_chat_signatures/MixinChatScreen.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.networking.legacy_chat_signatures; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.gui.hud.ChatHud; import net.minecraft.client.gui.hud.MessageIndicator; import net.minecraft.client.gui.screen.ChatScreen; @@ -34,7 +34,7 @@ public abstract class MixinChatScreen { @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;getIndicatorAt(DD)Lnet/minecraft/client/gui/hud/MessageIndicator;")) private MessageIndicator removeIndicator(ChatHud instance, double mouseX, double mouseY) { - if (VisualSettings.global().hideSignatureIndicator.isEnabled()) { + if (VisualSettings.INSTANCE.hideSignatureIndicator.isEnabled()) { return null; } else { return instance.getIndicatorAt(mouseX, mouseY); diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/packet_handling_changes/MixinClientCommonNetworkHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/packet_handling_changes/MixinClientCommonNetworkHandler.java index a26c3310..1faf78e2 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/packet_handling_changes/MixinClientCommonNetworkHandler.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/packet_handling_changes/MixinClientCommonNetworkHandler.java @@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.networking.packet_ import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.base.settings.impl.DebugSettings; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientCommonNetworkHandler; import net.minecraft.network.ClientConnection; @@ -75,7 +75,7 @@ public abstract class MixinClientCommonNetworkHandler { @Inject(method = "savePacketErrorReport", at = @At("HEAD"), cancellable = true) private void dontCreatePacketErrorCrashReports(CallbackInfoReturnable> cir) { - if (DebugSettings.global().dontCreatePacketErrorCrashReports.isEnabled()) { + if (DebugSettings.INSTANCE.dontCreatePacketErrorCrashReports.isEnabled()) { cir.setReturnValue(Optional.empty()); } } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/packet_handling_changes/MixinClientPlayNetworkHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/packet_handling_changes/MixinClientPlayNetworkHandler.java index 1528a6e9..4a78bf1f 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/packet_handling_changes/MixinClientPlayNetworkHandler.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/packet_handling_changes/MixinClientPlayNetworkHandler.java @@ -25,7 +25,7 @@ import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; import com.llamalad7.mixinextras.sugar.Local; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.block.entity.SignBlockEntity; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.DownloadingTerrainScreen; @@ -216,7 +216,7 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH @Redirect(method = "onGameJoin", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;isSecureChatEnforced()Z")) private boolean removeSecureChatWarning(ClientPlayNetworkHandler instance) { - return isSecureChatEnforced() || VisualSettings.global().disableSecureChatWarning.isEnabled(); + return isSecureChatEnforced() || VisualSettings.INSTANCE.disableSecureChatWarning.isEnabled(); } @SuppressWarnings({"InvalidInjectorMethodSignature"}) diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/classic_creative_menu/MixinCreativeInventoryScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/classic_creative_menu/MixinCreativeInventoryScreen.java index 885d8fa0..a7193562 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/classic_creative_menu/MixinCreativeInventoryScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/classic_creative_menu/MixinCreativeInventoryScreen.java @@ -22,7 +22,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.ui.classic_creative_menu; import com.viaversion.viafabricplus.features.ui.classic_creative_menu.GridItemSelectionScreen; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import org.spongepowered.asm.mixin.Mixin; @@ -35,7 +35,7 @@ public abstract class MixinCreativeInventoryScreen { @Inject(method = "init", at = @At("RETURN")) private void replaceCreativeMenu(CallbackInfo ci) { - if (VisualSettings.global().replaceCreativeInventory.isEnabled()) { + if (VisualSettings.INSTANCE.replaceCreativeInventory.isEnabled()) { MinecraftClient.getInstance().setScreen(GridItemSelectionScreen.INSTANCE); } } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/disable_server_pinging/MixinMultiplayerServerListWidget_ServerEntry.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/disable_server_pinging/MixinMultiplayerServerListWidget_ServerEntry.java index d53874af..320db4af 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/disable_server_pinging/MixinMultiplayerServerListWidget_ServerEntry.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/disable_server_pinging/MixinMultiplayerServerListWidget_ServerEntry.java @@ -26,8 +26,8 @@ import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.injection.access.base.IServerInfo; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.GeneralSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; @@ -69,7 +69,7 @@ public abstract class MixinMultiplayerServerListWidget_ServerEntry { ProtocolVersion version = ((IServerInfo) server).viaFabricPlus$forcedVersion(); if (version == null) version = ProtocolTranslator.getTargetVersion(); - viaFabricPlus$disableServerPinging = VisualSettings.global().disableServerPinging.isEnabled(version); + viaFabricPlus$disableServerPinging = VisualSettings.INSTANCE.disableServerPinging.isEnabled(version); if (viaFabricPlus$disableServerPinging) { this.server.version = Text.of(version.getName()); // Show target version } @@ -128,7 +128,7 @@ public abstract class MixinMultiplayerServerListWidget_ServerEntry { } final List tooltips = new ArrayList<>(); tooltips.add(text); - if (GeneralSettings.global().showAdvertisedServerVersion.getValue()) { + if (GeneralSettings.INSTANCE.showAdvertisedServerVersion.getValue()) { final ProtocolVersion version = ((IServerInfo) server).viaFabricPlus$translatingVersion(); if (version != null) { tooltips.add(Text.translatable("base.viafabricplus.via_translates_to", version.getName() + " (" + version.getOriginalVersion() + ")")); diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/downloading_terrain_transitions/MixinDownloadingTerrainScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/downloading_terrain_transitions/MixinDownloadingTerrainScreen.java index 8502b90d..0d76a42c 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/downloading_terrain_transitions/MixinDownloadingTerrainScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/downloading_terrain_transitions/MixinDownloadingTerrainScreen.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.ui.downloading_terrain_transitions; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.gui.screen.DownloadingTerrainScreen; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -36,7 +36,7 @@ public abstract class MixinDownloadingTerrainScreen { @Redirect(method = "renderBackground", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen;worldEntryReason:Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen$WorldEntryReason;")) private DownloadingTerrainScreen.WorldEntryReason hideDownloadTerrainScreenTransitionEffects(DownloadingTerrainScreen downloadingTerrainScreen) { - if (VisualSettings.global().hideDownloadTerrainScreenTransitionEffects.isEnabled()) { + if (VisualSettings.INSTANCE.hideDownloadTerrainScreenTransitionEffects.isEnabled()) { return DownloadingTerrainScreen.WorldEntryReason.OTHER; } else { return this.worldEntryReason; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/hud_element_changes/MixinInGameHud.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/hud_element_changes/MixinInGameHud.java index d5724dea..ff0ce131 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/hud_element_changes/MixinInGameHud.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/hud_element_changes/MixinInGameHud.java @@ -26,7 +26,7 @@ import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.llamalad7.mixinextras.sugar.Local; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.InGameHud; @@ -55,19 +55,19 @@ public abstract class MixinInGameHud { @Inject(method = "playBurstSound", at = @At("HEAD"), cancellable = true) private void disableBubblePopSound(int bubble, PlayerEntity player, int burstBubbles, CallbackInfo ci) { - if (VisualSettings.global().removeBubblePopSound.getValue()) { + if (VisualSettings.INSTANCE.removeBubblePopSound.getValue()) { ci.cancel(); } } @WrapWithCondition(method = "renderAirBubbles", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIII)V", ordinal = 2)) private boolean disableEmptyBubbles(DrawContext instance, Function renderLayers, Identifier sprite, int x, int y, int width, int height) { - return !VisualSettings.global().hideEmptyBubbleIcons.getValue(); + return !VisualSettings.INSTANCE.hideEmptyBubbleIcons.getValue(); } @WrapOperation(method = "renderCrosshair", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/Perspective;isFirstPerson()Z")) private boolean alwaysRenderCrosshair(Perspective instance, Operation original) { - if (VisualSettings.global().alwaysRenderCrosshair.isEnabled()) { + if (VisualSettings.INSTANCE.alwaysRenderCrosshair.isEnabled()) { return true; } else { return original.call(instance); @@ -76,21 +76,21 @@ public abstract class MixinInGameHud { @Inject(method = {"renderMountJumpBar", "renderMountHealth"}, at = @At("HEAD"), cancellable = true) private void removeMountJumpBar(CallbackInfo ci) { - if (VisualSettings.global().hideModernHUDElements.isEnabled()) { + if (VisualSettings.INSTANCE.hideModernHUDElements.isEnabled()) { ci.cancel(); } } @Inject(method = "getHeartCount", at = @At("HEAD"), cancellable = true) private void removeHungerBar(LivingEntity entity, CallbackInfoReturnable cir) { - if (VisualSettings.global().hideModernHUDElements.isEnabled()) { + if (VisualSettings.INSTANCE.hideModernHUDElements.isEnabled()) { cir.setReturnValue(1); } } @ModifyExpressionValue(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;getScaledWindowHeight()I"), require = 0) private int moveHealthDown(int value) { - if (VisualSettings.global().hideModernHUDElements.isEnabled()) { + if (VisualSettings.INSTANCE.hideModernHUDElements.isEnabled()) { return value + 6; // Magical offset } else { return value; @@ -99,7 +99,7 @@ public abstract class MixinInGameHud { @ModifyArgs(method = "renderArmor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIII)V"), require = 0) private static void moveArmorPositions(Args args, @Local(ordinal = 3, argsOnly = true) int x, @Local(ordinal = 6) int n) { - if (!VisualSettings.global().hideModernHUDElements.isEnabled()) { + if (!VisualSettings.INSTANCE.hideModernHUDElements.isEnabled()) { return; } final MinecraftClient client = MinecraftClient.getInstance(); @@ -114,7 +114,7 @@ public abstract class MixinInGameHud { @ModifyArg(method = "renderAirBubbles", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIII)V"), index = 2, require = 0) private int moveAirBubbles(int value) { - if (VisualSettings.global().hideModernHUDElements.isEnabled()) { + if (VisualSettings.INSTANCE.hideModernHUDElements.isEnabled()) { final MinecraftClient client = MinecraftClient.getInstance(); return client.getWindow().getScaledWidth() - value - client.textRenderer.fontHeight; } else { diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinCommandBlockScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinCommandBlockScreen.java index 2a517b42..878a99e2 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinCommandBlockScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinCommandBlockScreen.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.ui.remove_newer_screen_features; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.block.entity.CommandBlockBlockEntity; import net.minecraft.client.gui.screen.ingame.CommandBlockScreen; import net.minecraft.client.gui.widget.CyclingButtonWidget; @@ -48,7 +48,7 @@ public abstract class MixinCommandBlockScreen { @Inject(method = "init", at = @At("TAIL")) private void removeWidgets(CallbackInfo ci) { - if (VisualSettings.global().hideModernCommandBlockScreenFeatures.isEnabled()) { + if (VisualSettings.INSTANCE.hideModernCommandBlockScreenFeatures.isEnabled()) { modeButton.visible = false; conditionalModeButton.visible = false; redstoneTriggerButton.visible = false; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinGameMenuScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinGameMenuScreen.java index 5813ecab..ff0b0a78 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinGameMenuScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinGameMenuScreen.java @@ -26,7 +26,7 @@ import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.gui.Element; import net.minecraft.client.gui.screen.GameMenuScreen; import net.minecraft.client.gui.screen.OpenToLanScreen; @@ -95,7 +95,7 @@ public abstract class MixinGameMenuScreen extends Screen { @WrapOperation(method = "initWidgets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/GameMenuScreen;createButton(Lnet/minecraft/text/Text;Ljava/util/function/Supplier;)Lnet/minecraft/client/gui/widget/ButtonWidget;"), require = 0) private ButtonWidget replaceButtons(GameMenuScreen instance, Text text, Supplier screenSupplier, Operation original) { - if (VisualSettings.global().changeGameMenuScreenLayout.getIndex() == 0) { + if (VisualSettings.INSTANCE.changeGameMenuScreenLayout.getIndex() == 0) { // Player reporting -> share to lan if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19) && text.equals(PLAYER_REPORTING_TEXT)) { final ButtonWidget button = ButtonWidget.builder(SHARE_TO_LAN_TEXT, buttonWidget -> new OpenToLanScreen(instance)).width(NORMAL_BUTTON_WIDTH).build(); @@ -106,7 +106,7 @@ public abstract class MixinGameMenuScreen extends Screen { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_4tob1_4_1) && text.equals(ADVANCEMENTS_TEXT)) { return ButtonWidget.builder(ScreenTexts.DISCONNECT, viaFabricPlus$disconnectSupplier).width(viaFabricPlus$disconnectButtonWidth).build(); } - } else if (VisualSettings.global().changeGameMenuScreenLayout.getIndex() == 1) { + } else if (VisualSettings.INSTANCE.changeGameMenuScreenLayout.getIndex() == 1) { // Player reporting -> Social interactions if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19) && text.equals(PLAYER_REPORTING_TEXT)) { return createButton(SocialInteractionsScreen.TITLE, () -> new SocialInteractionsScreen(instance)); @@ -117,12 +117,12 @@ public abstract class MixinGameMenuScreen extends Screen { @WrapWithCondition(method = "initWidgets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/GameMenuScreen;addFeedbackAndBugsButtons(Lnet/minecraft/client/gui/screen/Screen;Lnet/minecraft/client/gui/widget/GridWidget$Adder;)V"), require = 0) private boolean removeFeedbackAndBugsButtons(Screen parentScreen, GridWidget.Adder gridAdder) { - return VisualSettings.global().changeGameMenuScreenLayout.getIndex() != 0 || ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_13_2); + return VisualSettings.INSTANCE.changeGameMenuScreenLayout.getIndex() != 0 || ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_13_2); } @Inject(method = "initWidgets", at = @At("RETURN")) private void moveButtonPositions(CallbackInfo ci) { - if (VisualSettings.global().changeGameMenuScreenLayout.getIndex() != 0) { + if (VisualSettings.INSTANCE.changeGameMenuScreenLayout.getIndex() != 0) { return; } // Manually adjust positions in older versions since the grid system doesn't work for these layouts @@ -161,7 +161,7 @@ public abstract class MixinGameMenuScreen extends Screen { @WrapWithCondition(method = "initWidgets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/GridWidget$Adder;add(Lnet/minecraft/client/gui/widget/Widget;)Lnet/minecraft/client/gui/widget/Widget;"), require = 0) private boolean removeButtons(GridWidget.Adder instance, Widget widget) { - if (VisualSettings.global().changeGameMenuScreenLayout.getIndex() != 0) { + if (VisualSettings.INSTANCE.changeGameMenuScreenLayout.getIndex() != 0) { return true; } // Mods could add other widgets as well diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinJigsawBlockScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinJigsawBlockScreen.java index e3d1eb1e..9f752fb4 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinJigsawBlockScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinJigsawBlockScreen.java @@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.ui.remove_newer_sc import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.block.entity.JigsawBlockEntity; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; @@ -62,7 +62,7 @@ public abstract class MixinJigsawBlockScreen extends Screen { @Inject(method = "init", at = @At("RETURN")) private void disableWidgets(CallbackInfo ci) { - if (!VisualSettings.global().hideModernJigsawScreenFeatures.getValue()) { + if (!VisualSettings.INSTANCE.hideModernJigsawScreenFeatures.getValue()) { return; } if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) { @@ -81,7 +81,7 @@ public abstract class MixinJigsawBlockScreen extends Screen { @Inject(method = "render", at = @At("HEAD")) private void copyText(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { - if (VisualSettings.global().hideModernJigsawScreenFeatures.getValue() && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (VisualSettings.INSTANCE.hideModernJigsawScreenFeatures.getValue() && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { nameField.setText(targetField.getText()); } } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinScreen.java index fba74110..27af591e 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinScreen.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.ui.remove_newer_screen_features; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.Element; @@ -49,9 +49,9 @@ public abstract class MixinScreen { if (drawableElement instanceof TexturedButtonWidget button && button.textures == RecipeBookWidget.BUTTON_TEXTURES) { final boolean furnace = ((Screen) (Object) this) instanceof FurnaceScreen; - if (VisualSettings.global().hideFurnaceRecipeBook.isEnabled() && furnace) { + if (VisualSettings.INSTANCE.hideFurnaceRecipeBook.isEnabled() && furnace) { cir.setReturnValue(drawableElement); - } else if (VisualSettings.global().hideCraftingRecipeBook.isEnabled() && !furnace) { + } else if (VisualSettings.INSTANCE.hideCraftingRecipeBook.isEnabled() && !furnace) { cir.setReturnValue(drawableElement); } } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinPlayerListHud.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinPlayerListHud.java index 210437ce..c9c47cbb 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinPlayerListHud.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinPlayerListHud.java @@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.ui.v1_7_tab_list_s import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.viaversion.viafabricplus.injection.access.v1_7_tab_list_style.IPlayerListEntry; import com.viaversion.viafabricplus.injection.access.v1_7_tab_list_style.IPlayerListHud; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.hud.PlayerListHud; import net.minecraft.client.network.PlayerListEntry; @@ -59,7 +59,7 @@ public abstract class MixinPlayerListHud implements IPlayerListHud { @Inject(method = "collectPlayerEntries", at = @At("HEAD"), cancellable = true) private void collectPlayerEntries(CallbackInfoReturnable> result) { - if (VisualSettings.global().enableLegacyTablist.isEnabled()) { + if (VisualSettings.INSTANCE.enableLegacyTablist.isEnabled()) { result.setReturnValue(this.client.player.networkHandler.getListedPlayerListEntries().stream() .sorted(viaFabricPlus$FIFO_COMPARATOR) .limit(viaFabricPlus$maxSlots) diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/always_tick_entities/MixinEntity.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/always_tick_entities/MixinEntity.java index 04389e2c..158559a3 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/always_tick_entities/MixinEntity.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/always_tick_entities/MixinEntity.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.world.always_tick_entities; -import com.viaversion.viafabricplus.base.settings.impl.DebugSettings; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; import com.viaversion.viafabricplus.injection.access.world.always_tick_entities.IEntity; import net.minecraft.entity.Entity; import org.spongepowered.asm.mixin.Mixin; @@ -35,7 +35,7 @@ public abstract class MixinEntity implements IEntity { @Override public boolean viaFabricPlus$isInLoadedChunkAndShouldTick() { - return this.viaFabricPlus$isInLoadedChunkAndShouldTick || DebugSettings.global().alwaysTickClientPlayer.isEnabled(); + return this.viaFabricPlus$isInLoadedChunkAndShouldTick || DebugSettings.INSTANCE.alwaysTickClientPlayer.isEnabled(); } @Override diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/disable_sequencing/MixinClientWorld.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/disable_sequencing/MixinClientWorld.java index 04f63cb8..c1677aef 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/disable_sequencing/MixinClientWorld.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/disable_sequencing/MixinClientWorld.java @@ -22,7 +22,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.world.disable_sequencing; import com.viaversion.viafabricplus.features.world.disable_sequencing.PendingUpdateManager1_18_2; -import com.viaversion.viafabricplus.base.settings.impl.DebugSettings; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; import net.minecraft.client.network.PendingUpdateManager; import net.minecraft.client.world.ClientWorld; import org.spongepowered.asm.mixin.Final; @@ -43,7 +43,7 @@ public abstract class MixinClientWorld { @Inject(method = "", at = @At("RETURN")) private void removePendingUpdateManager(CallbackInfo ci) { - if (DebugSettings.global().disableSequencing.isEnabled()) { + if (DebugSettings.INSTANCE.disableSequencing.isEnabled()) { this.pendingUpdateManager = new PendingUpdateManager1_18_2(); } } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/integration/vialegacy/MixinViaLegacyConfig.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/integration/vialegacy/MixinViaLegacyConfig.java index 44b2235e..f3ac9499 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/integration/vialegacy/MixinViaLegacyConfig.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/integration/vialegacy/MixinViaLegacyConfig.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.integration.vialegacy; -import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings; +import com.viaversion.viafabricplus.settings.impl.GeneralSettings; import net.raphimc.vialegacy.ViaLegacyConfig; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -33,7 +33,7 @@ public abstract class MixinViaLegacyConfig { @Inject(method = { "isLegacySkullLoading", "isLegacySkinLoading" }, at = @At("HEAD"), cancellable = true) private void replaceWithVFPSetting(CallbackInfoReturnable cir) { - cir.setReturnValue(GeneralSettings.global().loadSkinsAndSkullsInLegacyVersions.getValue()); + cir.setReturnValue(GeneralSettings.INSTANCE.loadSkinsAndSkullsInLegacyVersions.getValue()); } } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/MixinMinecraftClient.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/MixinMinecraftClient.java index 96c28c69..e03d567f 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/MixinMinecraftClient.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/MixinMinecraftClient.java @@ -21,19 +21,15 @@ package com.viaversion.viafabricplus.injection.mixin.old.minecraft; -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.protocols.v1_11_1to1_12.Protocol1_11_1To1_12; import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ServerboundPackets1_9_3; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.base.settings.impl.DebugSettings; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -41,7 +37,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(MinecraftClient.class) public abstract class MixinMinecraftClient { @@ -55,7 +50,7 @@ public abstract class MixinMinecraftClient { @Inject(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/tutorial/TutorialManager;onInventoryOpened()V", shift = At.Shift.AFTER)) private void sendOpenInventoryPacket(CallbackInfo ci) { - if (DebugSettings.global().sendOpenInventoryPacket.isEnabled()) { + if (DebugSettings.INSTANCE.sendOpenInventoryPacket.isEnabled()) { final PacketWrapper clientCommand = PacketWrapper.create(ServerboundPackets1_9_3.CLIENT_COMMAND, ProtocolTranslator.getPlayNetworkUserConnection()); clientCommand.write(Types.VAR_INT, 2); // Open Inventory Achievement clientCommand.scheduleSendToServer(Protocol1_11_1To1_12.class); diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinBipedEntityModel.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinBipedEntityModel.java index 7e31ef0b..7689682b 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinBipedEntityModel.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinBipedEntityModel.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.client.render.entity.state.BipedEntityRenderState; @@ -47,7 +47,7 @@ public abstract class MixinBipedEntityModel { @Redirect(method = "positionBlockingArm", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(FFF)F")) private float preventArmFollowingThirdPersonRotation(float value, float min, float max) { - if (VisualSettings.global().lockBlockingArmRotation.isEnabled()) { + if (VisualSettings.INSTANCE.lockBlockingArmRotation.isEnabled()) { return 0.0F; } else { return MathHelper.clamp(value, min, max); @@ -56,7 +56,7 @@ public abstract class MixinBipedEntityModel { @Inject(method = "setAngles(Lnet/minecraft/client/render/entity/state/BipedEntityRenderState;)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/model/ModelPart;roll:F", ordinal = 1, shift = At.Shift.AFTER)) private void addOldWalkAnimation(T bipedEntityRenderState, CallbackInfo ci) { - if (VisualSettings.global().oldWalkingAnimation.isEnabled()) { + if (VisualSettings.INSTANCE.oldWalkingAnimation.isEnabled()) { final float limbFrequency = bipedEntityRenderState.limbFrequency; final float limbAmplitudeMultiplier = bipedEntityRenderState.limbAmplitudeMultiplier; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinClientPlayerEntity.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinClientPlayerEntity.java index 7480b4e8..74a47b29 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinClientPlayerEntity.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinClientPlayerEntity.java @@ -29,7 +29,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viafabricplus.injection.access.base.IClientConnection; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.base.settings.impl.DebugSettings; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.input.Input; import net.minecraft.client.network.AbstractClientPlayerEntity; @@ -264,7 +264,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity @Redirect(method = "sendMovementPackets", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;lastOnGround:Z", ordinal = 0)) private boolean sendIdlePacket(ClientPlayerEntity instance) { - if (DebugSettings.global().sendIdlePacket.isEnabled()) { + if (DebugSettings.INSTANCE.sendIdlePacket.isEnabled()) { return !isOnGround(); } else { return this.lastOnGround; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinLivingEntity.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinLivingEntity.java index f640b284..977ac9da 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinLivingEntity.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinLivingEntity.java @@ -23,11 +23,10 @@ package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import com.viaversion.viafabricplus.features.entity.enchantment_attributes.EnchantmentAttributesEmulation1_20_6; import com.viaversion.viafabricplus.features.entity.riding_offsets.EntityRidingOffsetsPre1_20_2; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.base.settings.impl.DebugSettings; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.DebugSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.block.BlockState; import net.minecraft.block.TrapdoorBlock; import net.minecraft.entity.*; @@ -101,7 +100,7 @@ public abstract class MixinLivingEntity extends Entity { @Redirect(method = "turnHead", at = @At(value = "INVOKE", target = "Ljava/lang/Math;abs(F)F")) private float changeBodyRotationInterpolation(float g) { - if (VisualSettings.global().changeBodyRotationInterpolation.isEnabled()) { + if (VisualSettings.INSTANCE.changeBodyRotationInterpolation.isEnabled()) { g = MathHelper.clamp(g, -75.0F, 75.0F); this.bodyYaw = this.getYaw() - g; if (Math.abs(g) > 50.0F) { @@ -115,7 +114,7 @@ public abstract class MixinLivingEntity extends Entity { @Inject(method = "tickCramming", at = @At("HEAD"), cancellable = true) private void preventEntityPush(CallbackInfo ci) { - if (DebugSettings.global().preventEntityCramming.isEnabled()) { + if (DebugSettings.INSTANCE.preventEntityCramming.isEnabled()) { ci.cancel(); } } @@ -221,7 +220,7 @@ public abstract class MixinLivingEntity extends Entity { @Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;abs(F)F")) private float alwaysRotateWhenWalkingBackwards(float value) { - if (VisualSettings.global().sidewaysBackwardsRunning.isEnabled()) { + if (VisualSettings.INSTANCE.sidewaysBackwardsRunning.isEnabled()) { return 0F; } else { return MathHelper.abs(value); diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinPlayerEntity.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinPlayerEntity.java index 3bd6a3ad..07a28f95 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinPlayerEntity.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinPlayerEntity.java @@ -26,7 +26,7 @@ import com.llamalad7.mixinextras.sugar.Local; import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.block.BlockState; import net.minecraft.entity.*; import net.minecraft.entity.attribute.EntityAttributes; @@ -239,7 +239,7 @@ public abstract class MixinPlayerEntity extends LivingEntity { @Inject(method = "getHurtSound", at = @At("HEAD"), cancellable = true) private void replaceSound(DamageSource source, CallbackInfoReturnable cir) { - if (VisualSettings.global().replaceHurtSoundWithOOFSound.isEnabled()) { + if (VisualSettings.INSTANCE.replaceHurtSoundWithOOFSound.isEnabled()) { cir.setReturnValue(viaFabricPlus$oof_hurt); } } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinVillagerClothingFeatureRenderer.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinVillagerClothingFeatureRenderer.java index fe3cd988..4845c184 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinVillagerClothingFeatureRenderer.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/entity/MixinVillagerClothingFeatureRenderer.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity; -import com.viaversion.viafabricplus.base.settings.impl.VisualSettings; +import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.render.entity.feature.VillagerClothingFeatureRenderer; import net.minecraft.village.VillagerData; import net.minecraft.village.VillagerProfession; @@ -34,7 +34,7 @@ public abstract class MixinVillagerClothingFeatureRenderer { @Redirect(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/state/LivingEntityRenderState;FF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/village/VillagerData;getProfession()Lnet/minecraft/village/VillagerProfession;")) private VillagerProfession revertVillagerVisual(VillagerData instance) { - if (VisualSettings.global().hideVillagerProfession.getValue()) { + if (VisualSettings.INSTANCE.hideVillagerProfession.getValue()) { return VillagerProfession.NONE; } else { return instance.getProfession(); diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/ProtocolTranslator.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/ProtocolTranslator.java index 6a777527..ba6e5546 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/ProtocolTranslator.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/ProtocolTranslator.java @@ -76,7 +76,7 @@ import java.util.concurrent.ThreadLocalRandom; /** * This class represents the whole Protocol Translator, here all important variables are stored */ -public class ProtocolTranslator { +public final class ProtocolTranslator { /** * These attribute keys are used to track the main connections of Minecraft and ViaVersion, so that they can be used later during the connection to send packets. diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/ViaFabricPlusMappingDataLoader.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/ViaFabricPlusMappingDataLoader.java index 58effc17..c63f96ca 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/ViaFabricPlusMappingDataLoader.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/ViaFabricPlusMappingDataLoader.java @@ -32,7 +32,7 @@ import net.minecraft.registry.Registries; import java.util.HashMap; import java.util.Map; -public class ViaFabricPlusMappingDataLoader extends MappingDataLoader { +public final class ViaFabricPlusMappingDataLoader extends MappingDataLoader { public static final Map MATERIALS = new HashMap<>(); public static final Map> BLOCK_MATERIALS = new HashMap<>(); diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusVLCommandHandler.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusVLCommandHandler.java index 78bd24fd..4710cf93 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusVLCommandHandler.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusVLCommandHandler.java @@ -32,7 +32,7 @@ import net.raphimc.vialoader.impl.viaversion.VLCommandHandler; import java.util.concurrent.CompletableFuture; -public class ViaFabricPlusVLCommandHandler extends VLCommandHandler { +public final class ViaFabricPlusVLCommandHandler extends VLCommandHandler { public ViaFabricPlusVLCommandHandler() { super(); diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusViaCommandSender.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusViaCommandSender.java index 98f77ac4..fcf0294a 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusViaCommandSender.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusViaCommandSender.java @@ -28,7 +28,7 @@ import net.minecraft.text.Text; import java.util.UUID; -public class ViaFabricPlusViaCommandSender implements ViaCommandSender { +public final class ViaFabricPlusViaCommandSender implements ViaCommandSender { private final CommandSource source; diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/classic/ListExtensionsCommand.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/classic/ListExtensionsCommand.java index 96f67ec2..611fdc2b 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/classic/ListExtensionsCommand.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/classic/ListExtensionsCommand.java @@ -28,7 +28,7 @@ import net.minecraft.util.Formatting; import net.raphimc.vialegacy.api.LegacyProtocolVersion; import net.raphimc.vialegacy.protocol.classic.c0_30cpetoc0_28_30.storage.ExtensionProtocolMetadataStorage; -public class ListExtensionsCommand implements VFPViaSubCommand { +public final class ListExtensionsCommand implements VFPViaSubCommand { @Override public String name() { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/classic/SetTimeCommand.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/classic/SetTimeCommand.java index 8d2963c8..b00137c6 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/classic/SetTimeCommand.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/classic/SetTimeCommand.java @@ -27,7 +27,7 @@ import net.minecraft.util.Formatting; import net.raphimc.vialegacy.api.LegacyProtocolVersion; import net.raphimc.vialegacy.protocol.alpha.a1_0_16_2toa1_0_17_1_0_17_4.storage.TimeLockStorage; -public class SetTimeCommand implements VFPViaSubCommand { +public final class SetTimeCommand implements VFPViaSubCommand { @Override public String name() { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/platform/ViaFabricPlusViaLegacyPlatformImpl.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/platform/ViaFabricPlusViaLegacyPlatformImpl.java index 4797befd..a2490bd4 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/platform/ViaFabricPlusViaLegacyPlatformImpl.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/platform/ViaFabricPlusViaLegacyPlatformImpl.java @@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.protocoltranslator.impl.platform; import net.raphimc.vialoader.impl.platform.ViaLegacyPlatformImpl; -public class ViaFabricPlusViaLegacyPlatformImpl extends ViaLegacyPlatformImpl { +public final class ViaFabricPlusViaLegacyPlatformImpl extends ViaLegacyPlatformImpl { @Override public String getCpeAppName() { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/platform/ViaFabricPlusViaVersionPlatformImpl.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/platform/ViaFabricPlusViaVersionPlatformImpl.java index 65896abb..a5cc018d 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/platform/ViaFabricPlusViaVersionPlatformImpl.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/platform/ViaFabricPlusViaVersionPlatformImpl.java @@ -33,7 +33,7 @@ import net.raphimc.vialoader.impl.platform.ViaVersionPlatformImpl; import java.io.File; -public class ViaFabricPlusViaVersionPlatformImpl extends ViaVersionPlatformImpl { +public final class ViaFabricPlusViaVersionPlatformImpl extends ViaVersionPlatformImpl { public ViaFabricPlusViaVersionPlatformImpl(File rootFolder) { // Only required to not throw an exception, not used super(rootFolder); diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viabedrock/ViaFabricPlusNettyPipelineProvider.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viabedrock/ViaFabricPlusNettyPipelineProvider.java index 111c3b54..50f32083 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viabedrock/ViaFabricPlusNettyPipelineProvider.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viabedrock/ViaFabricPlusNettyPipelineProvider.java @@ -32,7 +32,7 @@ import net.raphimc.vialoader.netty.VLPipeline; import javax.crypto.SecretKey; -public class ViaFabricPlusNettyPipelineProvider extends NettyPipelineProvider { +public final class ViaFabricPlusNettyPipelineProvider extends NettyPipelineProvider { @Override public void enableCompression(UserConnection user, ProtocolCompression protocolCompression) { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusAlphaInventoryProvider.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusAlphaInventoryProvider.java index c8c6d3d0..cbfb25ab 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusAlphaInventoryProvider.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusAlphaInventoryProvider.java @@ -34,7 +34,7 @@ import java.util.List; import static net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.copyItems; -public class ViaFabricPlusAlphaInventoryProvider extends AlphaInventoryProvider { +public final class ViaFabricPlusAlphaInventoryProvider extends AlphaInventoryProvider { @Override public boolean usesInventoryTracker() { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java index 9da87a84..8d3c0f18 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java @@ -25,11 +25,11 @@ import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.UserConnection; import de.florianmichael.classic4j.BetaCraftHandler; import com.viaversion.viafabricplus.ViaFabricPlusImpl; -import com.viaversion.viafabricplus.base.settings.impl.AuthenticationSettings; +import com.viaversion.viafabricplus.settings.impl.AuthenticationSettings; import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.provider.ClassicMPPassProvider; import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.provider.OldAuthProvider; -public class ViaFabricPlusClassicMPPassProvider extends ClassicMPPassProvider { +public final class ViaFabricPlusClassicMPPassProvider extends ClassicMPPassProvider { public static String classicubeMPPass; @@ -41,7 +41,7 @@ public class ViaFabricPlusClassicMPPassProvider extends ClassicMPPassProvider { return mpPass; } - if (AuthenticationSettings.global().useBetaCraftAuthentication.getValue()) { + if (AuthenticationSettings.INSTANCE.useBetaCraftAuthentication.getValue()) { // Doesn't use the MPPass system anymore, but still kept here for simplicity BetaCraftHandler.authenticate(serverId -> { try { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusClassicWorldHeightProvider.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusClassicWorldHeightProvider.java index f5492825..98182351 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusClassicWorldHeightProvider.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusClassicWorldHeightProvider.java @@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.protocoltranslator.impl.provider.vialegacy; import com.viaversion.viaversion.api.connection.UserConnection; import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.provider.ClassicWorldHeightProvider; -public class ViaFabricPlusClassicWorldHeightProvider extends ClassicWorldHeightProvider { +public final class ViaFabricPlusClassicWorldHeightProvider extends ClassicWorldHeightProvider { @Override public short getMaxChunkSectionCount(UserConnection user) { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusEncryptionProvider.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusEncryptionProvider.java index 4e9f4062..4ebf9204 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusEncryptionProvider.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusEncryptionProvider.java @@ -26,7 +26,7 @@ import com.viaversion.viafabricplus.injection.access.base.IClientConnection; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.provider.EncryptionProvider; -public class ViaFabricPlusEncryptionProvider extends EncryptionProvider { +public final class ViaFabricPlusEncryptionProvider extends EncryptionProvider { @Override public void enableDecryption(UserConnection user) { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusGameProfileFetcher.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusGameProfileFetcher.java index 16167201..fe39ebee 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusGameProfileFetcher.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusGameProfileFetcher.java @@ -37,7 +37,7 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.CompletableFuture; -public class ViaFabricPlusGameProfileFetcher extends GameProfileFetcher { +public final class ViaFabricPlusGameProfileFetcher extends GameProfileFetcher { private static final HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY); private static final MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusOldAuthProvider.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusOldAuthProvider.java index 0ed45179..0606be1a 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusOldAuthProvider.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusOldAuthProvider.java @@ -24,17 +24,17 @@ package com.viaversion.viafabricplus.protocoltranslator.impl.provider.vialegacy; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viafabricplus.ViaFabricPlusImpl; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.base.settings.impl.AuthenticationSettings; +import com.viaversion.viafabricplus.settings.impl.AuthenticationSettings; import com.viaversion.viafabricplus.util.ChatUtil; import net.minecraft.client.MinecraftClient; import net.minecraft.text.Text; import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.provider.OldAuthProvider; -public class ViaFabricPlusOldAuthProvider extends OldAuthProvider { +public final class ViaFabricPlusOldAuthProvider extends OldAuthProvider { @Override public void sendAuthRequest(UserConnection user, String serverId) { - if (!AuthenticationSettings.global().verifySessionForOnlineModeServers.getValue()) { + if (!AuthenticationSettings.INSTANCE.verifySessionForOnlineModeServers.getValue()) { return; } diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusAckSequenceProvider.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusAckSequenceProvider.java index 919d39e8..4e97b766 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusAckSequenceProvider.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusAckSequenceProvider.java @@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.protocoltranslator.impl.provider.viaversion import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.protocols.v1_18_2to1_19.provider.AckSequenceProvider; -public class ViaFabricPlusAckSequenceProvider extends AckSequenceProvider { +public final class ViaFabricPlusAckSequenceProvider extends AckSequenceProvider { @Override public void handleSequence(UserConnection connection, int sequence) { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusBaseVersionProvider.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusBaseVersionProvider.java index 65be3440..2ef48075 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusBaseVersionProvider.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusBaseVersionProvider.java @@ -26,7 +26,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.protocol.version.BaseVersionProvider; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -public class ViaFabricPlusBaseVersionProvider extends BaseVersionProvider { +public final class ViaFabricPlusBaseVersionProvider extends BaseVersionProvider { @Override public ProtocolVersion getClosestServerProtocol(UserConnection connection) throws Exception { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusCommandArgumentsProvider.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusCommandArgumentsProvider.java index a83c57b8..f0e4d251 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusCommandArgumentsProvider.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusCommandArgumentsProvider.java @@ -30,7 +30,7 @@ import net.minecraft.command.argument.SignedArgumentList; import java.util.Collections; import java.util.List; -public class ViaFabricPlusCommandArgumentsProvider extends SignableCommandArgumentsProvider { +public final class ViaFabricPlusCommandArgumentsProvider extends SignableCommandArgumentsProvider { @Override public List> getSignableArguments(String command) { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusHandItemProvider.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusHandItemProvider.java index 05b8e309..b5b7b892 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusHandItemProvider.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusHandItemProvider.java @@ -28,7 +28,7 @@ import com.viaversion.viaversion.protocols.v1_8to1_9.provider.HandItemProvider; import com.viaversion.viafabricplus.protocoltranslator.translator.ItemTranslator; import net.minecraft.item.ItemStack; -public class ViaFabricPlusHandItemProvider extends HandItemProvider { +public final class ViaFabricPlusHandItemProvider extends HandItemProvider { public static ItemStack lastUsedItem = null; diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPickItemProvider.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPickItemProvider.java index 17231b44..58a53063 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPickItemProvider.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPickItemProvider.java @@ -26,7 +26,7 @@ import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.BlockPosition; import com.viaversion.viaversion.protocols.v1_21_2to1_21_4.provider.PickItemProvider; -public class ViaFabricPlusPickItemProvider extends PickItemProvider { +public final class ViaFabricPlusPickItemProvider extends PickItemProvider { @Override public void pickItemFromBlock(UserConnection connection, BlockPosition blockPosition, boolean includeData) { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPlayerAbilitiesProvider.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPlayerAbilitiesProvider.java index c4f1f275..0d6c514a 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPlayerAbilitiesProvider.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPlayerAbilitiesProvider.java @@ -25,7 +25,7 @@ import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.protocols.v1_15_2to1_16.provider.PlayerAbilitiesProvider; import net.minecraft.client.MinecraftClient; -public class ViaFabricPlusPlayerAbilitiesProvider extends PlayerAbilitiesProvider { +public final class ViaFabricPlusPlayerAbilitiesProvider extends PlayerAbilitiesProvider { @Override public float getFlyingSpeed(UserConnection connection) { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPlayerLookTargetProvider.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPlayerLookTargetProvider.java index 30be7f91..8a038354 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPlayerLookTargetProvider.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPlayerLookTargetProvider.java @@ -28,7 +28,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; -public class ViaFabricPlusPlayerLookTargetProvider extends PlayerLookTargetProvider { +public final class ViaFabricPlusPlayerLookTargetProvider extends PlayerLookTargetProvider { @Override public BlockPosition getPlayerLookTarget(UserConnection info) { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLInjector.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLInjector.java index fa7467ab..2051722e 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLInjector.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLInjector.java @@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.protocoltranslator.impl.viaversion; import net.raphimc.vialoader.impl.viaversion.VLInjector; import net.raphimc.vialoader.netty.VLLegacyPipeline; -public class ViaFabricPlusVLInjector extends VLInjector { +public final class ViaFabricPlusVLInjector extends VLInjector { @Override public String getEncoderName() { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLLoader.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLLoader.java index 97a06aad..8d1f0ea1 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLLoader.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLLoader.java @@ -35,7 +35,7 @@ import com.viaversion.viaversion.protocols.v1_18_2to1_19.provider.AckSequencePro import com.viaversion.viaversion.protocols.v1_21_2to1_21_4.provider.PickItemProvider; import com.viaversion.viaversion.protocols.v1_8to1_9.provider.HandItemProvider; import com.viaversion.viafabricplus.protocoltranslator.impl.provider.viabedrock.ViaFabricPlusNettyPipelineProvider; -import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings; +import com.viaversion.viafabricplus.settings.impl.GeneralSettings; import net.raphimc.viabedrock.protocol.provider.NettyPipelineProvider; import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.provider.AlphaInventoryProvider; import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.provider.ClassicMPPassProvider; @@ -45,7 +45,7 @@ import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.provider.Encrypti import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.provider.GameProfileFetcher; import net.raphimc.vialoader.impl.viaversion.VLLoader; -public class ViaFabricPlusVLLoader extends VLLoader { +public final class ViaFabricPlusVLLoader extends VLLoader { @Override public void load() { @@ -67,7 +67,7 @@ public class ViaFabricPlusVLLoader extends VLLoader { providers.use(EncryptionProvider.class, new ViaFabricPlusEncryptionProvider()); providers.use(GameProfileFetcher.class, new ViaFabricPlusGameProfileFetcher()); providers.use(ClassicMPPassProvider.class, new ViaFabricPlusClassicMPPassProvider()); - if (GeneralSettings.global().emulateInventoryActionsInAlphaVersions.getValue()) { + if (GeneralSettings.INSTANCE.emulateInventoryActionsInAlphaVersions.getValue()) { providers.use(AlphaInventoryProvider.class, new ViaFabricPlusAlphaInventoryProvider()); } diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLViaConfig.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLViaConfig.java index 5beb4783..bbf6ce98 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLViaConfig.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLViaConfig.java @@ -26,7 +26,7 @@ import net.raphimc.vialoader.impl.viaversion.VLViaConfig; import java.io.File; import java.util.logging.Logger; -public class ViaFabricPlusVLViaConfig extends VLViaConfig { +public final class ViaFabricPlusVLViaConfig extends VLViaConfig { public ViaFabricPlusVLViaConfig(File configFile, Logger logger) { super(configFile, logger); diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/netty/NoReadFlowControlHandler.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/netty/NoReadFlowControlHandler.java index f5d1cdea..5d4ee784 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/netty/NoReadFlowControlHandler.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/netty/NoReadFlowControlHandler.java @@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.protocoltranslator.netty; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.flow.FlowControlHandler; -public class NoReadFlowControlHandler extends FlowControlHandler { +public final class NoReadFlowControlHandler extends FlowControlHandler { @Override public void read(ChannelHandlerContext ctx) throws Exception { diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/netty/ViaFabricPlusVLLegacyPipeline.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/netty/ViaFabricPlusVLLegacyPipeline.java index 6526e30a..075be012 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/netty/ViaFabricPlusVLLegacyPipeline.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/netty/ViaFabricPlusVLLegacyPipeline.java @@ -31,7 +31,7 @@ import net.minecraft.network.handler.HandlerNames; import net.raphimc.vialoader.netty.CompressionReorderEvent; import net.raphimc.vialoader.netty.VLLegacyPipeline; -public class ViaFabricPlusVLLegacyPipeline extends VLLegacyPipeline { +public final class ViaFabricPlusVLLegacyPipeline extends VLLegacyPipeline { public static final String VIA_FLOW_CONTROL = "via-flow-control"; diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/netty/ViaFabricPlusViaDecoder.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/netty/ViaFabricPlusViaDecoder.java index 34fee006..9f1c0ea6 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/netty/ViaFabricPlusViaDecoder.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/netty/ViaFabricPlusViaDecoder.java @@ -23,14 +23,14 @@ package com.viaversion.viafabricplus.protocoltranslator.netty; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viafabricplus.ViaFabricPlusImpl; -import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings; +import com.viaversion.viafabricplus.settings.impl.GeneralSettings; import com.viaversion.viafabricplus.util.ChatUtil; import io.netty.channel.ChannelHandlerContext; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.raphimc.vialoader.netty.ViaDecoder; -public class ViaFabricPlusViaDecoder extends ViaDecoder { +public final class ViaFabricPlusViaDecoder extends ViaDecoder { public ViaFabricPlusViaDecoder(UserConnection user) { super(user); @@ -38,7 +38,7 @@ public class ViaFabricPlusViaDecoder extends ViaDecoder { @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { - final int mode = GeneralSettings.global().ignorePacketTranslationErrors.getIndex(); + final int mode = GeneralSettings.INSTANCE.ignorePacketTranslationErrors.getIndex(); if (mode == 0) { // Mode 0: Just pass the exception to the next handler super.channelRead(ctx, msg); diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/protocol/ViaFabricPlusProtocol.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/protocol/ViaFabricPlusProtocol.java index 2ab95af6..769037a1 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/protocol/ViaFabricPlusProtocol.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/protocol/ViaFabricPlusProtocol.java @@ -48,7 +48,7 @@ import java.util.HashMap; import java.util.Map; // Protocol to handle error handling changes in older protocols, always last element of the pipeline -public class ViaFabricPlusProtocol extends AbstractSimpleProtocol { +public final class ViaFabricPlusProtocol extends AbstractSimpleProtocol { public static final ViaFabricPlusProtocol INSTANCE = new ViaFabricPlusProtocol(); diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/translator/BlockStateTranslator.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/translator/BlockStateTranslator.java index 0e102fcf..b896394a 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/translator/BlockStateTranslator.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/translator/BlockStateTranslator.java @@ -35,7 +35,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; -public class BlockStateTranslator { +public final class BlockStateTranslator { private static final UserConnection DUMMY_USER_CONNECTION = ProtocolTranslator.createDummyUserConnection(ProtocolTranslator.NATIVE_VERSION, ProtocolVersion.v1_18_2); diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/translator/ItemTranslator.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/translator/ItemTranslator.java index fe4c2996..2d63ed39 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/translator/ItemTranslator.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/translator/ItemTranslator.java @@ -45,7 +45,7 @@ import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.types.Types1_2_ import net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.types.Types1_4_2; import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6; -public class ItemTranslator { +public final class ItemTranslator { /** * Converts a Minecraft item stack to a ViaVersion item diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/translator/TextComponentTranslator.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/translator/TextComponentTranslator.java index 5808231d..e013c3ee 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/translator/TextComponentTranslator.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/translator/TextComponentTranslator.java @@ -33,7 +33,7 @@ import com.viaversion.viaversion.protocols.v1_13_2to1_14.packet.ClientboundPacke import com.viaversion.viafabricplus.ViaFabricPlusImpl; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -public class TextComponentTranslator { +public final class TextComponentTranslator { private static final UserConnection DUMMY_USER_CONNECTION = ProtocolTranslator.createDummyUserConnection(ProtocolTranslator.NATIVE_VERSION, ProtocolVersion.v1_14); diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/util/LanguageUtil.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/util/LanguageUtil.java index 996b1c93..de69ac47 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/util/LanguageUtil.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/util/LanguageUtil.java @@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.protocoltranslator.util; import java.util.Map; -public class LanguageUtil { +public final class LanguageUtil { private static final int NON_ASCII_THRESHOLD = 256; diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/util/NoPacketSendChannel.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/util/NoPacketSendChannel.java index be403415..6298c493 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/util/NoPacketSendChannel.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/util/NoPacketSendChannel.java @@ -28,7 +28,7 @@ import io.netty.channel.local.LocalChannel; * This class will prevent packets created by ViaVersion from being sent to the server. This is mainly used in the * translator system. See {@link com.viaversion.viafabricplus.protocoltranslator.translator} for more information. */ -public class NoPacketSendChannel extends LocalChannel { +public final class NoPacketSendChannel extends LocalChannel { public static final NoPacketSendChannel INSTANCE = new NoPacketSendChannel(); diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/util/ProtocolVersionDetector.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/util/ProtocolVersionDetector.java index 0500b597..84039df1 100644 --- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/util/ProtocolVersionDetector.java +++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/util/ProtocolVersionDetector.java @@ -31,7 +31,7 @@ import java.net.InetSocketAddress; /** * This class can be used to detect the protocol version of a server without connecting to it. */ -public class ProtocolVersionDetector { +public final class ProtocolVersionDetector { private static final int TIMEOUT = 3000; diff --git a/src/main/java/com/viaversion/viafabricplus/base/save/AbstractSave.java b/src/main/java/com/viaversion/viafabricplus/save/AbstractSave.java similarity index 98% rename from src/main/java/com/viaversion/viafabricplus/base/save/AbstractSave.java rename to src/main/java/com/viaversion/viafabricplus/save/AbstractSave.java index 060a598d..42968532 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/save/AbstractSave.java +++ b/src/main/java/com/viaversion/viafabricplus/save/AbstractSave.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.save; +package com.viaversion.viafabricplus.save; import com.google.gson.Gson; import com.google.gson.GsonBuilder; diff --git a/src/main/java/com/viaversion/viafabricplus/base/save/SaveManager.java b/src/main/java/com/viaversion/viafabricplus/save/SaveManager.java similarity index 90% rename from src/main/java/com/viaversion/viafabricplus/base/save/SaveManager.java rename to src/main/java/com/viaversion/viafabricplus/save/SaveManager.java index 36c7b15c..9cf01e71 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/save/SaveManager.java +++ b/src/main/java/com/viaversion/viafabricplus/save/SaveManager.java @@ -19,19 +19,19 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.save; +package com.viaversion.viafabricplus.save; import com.viaversion.viafabricplus.api.LoadingCycleCallback; import com.viaversion.viafabricplus.base.Events; -import com.viaversion.viafabricplus.base.save.impl.AccountsSave; -import com.viaversion.viafabricplus.base.save.impl.SettingsSave; -import com.viaversion.viafabricplus.base.settings.SettingsManager; +import com.viaversion.viafabricplus.save.impl.AccountsSave; +import com.viaversion.viafabricplus.save.impl.SettingsSave; +import com.viaversion.viafabricplus.settings.SettingsManager; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class SaveManager { +public final class SaveManager { private final List saves = new ArrayList<>(); diff --git a/src/main/java/com/viaversion/viafabricplus/base/save/impl/AccountsSave.java b/src/main/java/com/viaversion/viafabricplus/save/impl/AccountsSave.java similarity index 94% rename from src/main/java/com/viaversion/viafabricplus/base/save/impl/AccountsSave.java rename to src/main/java/com/viaversion/viafabricplus/save/impl/AccountsSave.java index 127a4a3d..5a2887d0 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/save/impl/AccountsSave.java +++ b/src/main/java/com/viaversion/viafabricplus/save/impl/AccountsSave.java @@ -19,19 +19,19 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.save.impl; +package com.viaversion.viafabricplus.save.impl; import com.google.gson.JsonObject; import de.florianmichael.classic4j.model.classicube.account.CCAccount; import com.viaversion.viafabricplus.ViaFabricPlusImpl; -import com.viaversion.viafabricplus.base.save.AbstractSave; -import com.viaversion.viafabricplus.base.settings.impl.BedrockSettings; +import com.viaversion.viafabricplus.save.AbstractSave; +import com.viaversion.viafabricplus.settings.impl.BedrockSettings; import net.raphimc.minecraftauth.MinecraftAuth; import net.raphimc.minecraftauth.step.bedrock.session.StepFullBedrockSession; import net.raphimc.minecraftauth.step.msa.StepMsaToken; import net.raphimc.minecraftauth.step.xbl.session.StepInitialXblSession; -public class AccountsSave extends AbstractSave { +public final class AccountsSave extends AbstractSave { private StepFullBedrockSession.FullBedrockSession bedrockAccount; private CCAccount classicubeAccount; diff --git a/src/main/java/com/viaversion/viafabricplus/base/save/impl/SettingsSave.java b/src/main/java/com/viaversion/viafabricplus/save/impl/SettingsSave.java similarity index 87% rename from src/main/java/com/viaversion/viafabricplus/base/save/impl/SettingsSave.java rename to src/main/java/com/viaversion/viafabricplus/save/impl/SettingsSave.java index c5ba3f30..7f753e26 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/save/impl/SettingsSave.java +++ b/src/main/java/com/viaversion/viafabricplus/save/impl/SettingsSave.java @@ -19,20 +19,20 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.save.impl; +package com.viaversion.viafabricplus.save.impl; import com.google.gson.JsonObject; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.base.save.AbstractSave; -import com.viaversion.viafabricplus.base.settings.SettingsManager; -import com.viaversion.viafabricplus.base.settings.base.AbstractSetting; -import com.viaversion.viafabricplus.base.settings.base.SettingGroup; -import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings; +import com.viaversion.viafabricplus.save.AbstractSave; +import com.viaversion.viafabricplus.settings.SettingsManager; +import com.viaversion.viafabricplus.settings.base.AbstractSetting; +import com.viaversion.viafabricplus.settings.base.SettingGroup; +import com.viaversion.viafabricplus.settings.impl.GeneralSettings; import com.viaversion.viafabricplus.util.ChatUtil; import net.raphimc.viabedrock.api.BedrockProtocolVersion; -public class SettingsSave extends AbstractSave { +public final class SettingsSave extends AbstractSave { private final SettingsManager settingsManager; private String selectedProtocolVersion; @@ -81,7 +81,7 @@ public class SettingsSave extends AbstractSave { return; } // Set target version AFTER protocol loading, so we can reach all versions - if (GeneralSettings.global().saveSelectedProtocolVersion.getValue()) { + if (GeneralSettings.INSTANCE.saveSelectedProtocolVersion.getValue()) { final ProtocolVersion protocolVersion = protocolVersionByName(selectedProtocolVersion); if (protocolVersion != null) { ProtocolTranslator.setTargetVersion(protocolVersion); diff --git a/src/main/java/com/viaversion/viafabricplus/screen/PerServerVersionScreen.java b/src/main/java/com/viaversion/viafabricplus/screen/PerServerVersionScreen.java index e7fe2e33..827a7181 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/PerServerVersionScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/PerServerVersionScreen.java @@ -36,7 +36,7 @@ import net.raphimc.vialoader.util.ProtocolVersionList; import java.util.function.Consumer; -public class PerServerVersionScreen extends VFPScreen { +public final class PerServerVersionScreen extends VFPScreen { private final Consumer selectionConsumer; @@ -56,7 +56,7 @@ public class PerServerVersionScreen extends VFPScreen { this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, -5, textRenderer.fontHeight + 4)); } - public class SlotList extends VFPList { + public final class SlotList extends VFPList { public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) { super(minecraftClient, width, height, top, bottom, entryHeight); @@ -74,7 +74,7 @@ public class PerServerVersionScreen extends VFPScreen { } } - public class ResetSlot extends SharedSlot { + public final class ResetSlot extends SharedSlot { @Override public Text getNarration() { @@ -95,7 +95,7 @@ public class PerServerVersionScreen extends VFPScreen { } } - public class ProtocolSlot extends SharedSlot { + public final class ProtocolSlot extends SharedSlot { private final ProtocolVersion protocolVersion; diff --git a/src/main/java/com/viaversion/viafabricplus/screen/ProtocolSelectionScreen.java b/src/main/java/com/viaversion/viafabricplus/screen/ProtocolSelectionScreen.java index 413462de..681a9304 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/ProtocolSelectionScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/ProtocolSelectionScreen.java @@ -37,7 +37,7 @@ import net.raphimc.vialoader.util.ProtocolVersionList; import java.awt.*; -public class ProtocolSelectionScreen extends VFPScreen { +public final class ProtocolSelectionScreen extends VFPScreen { public static final ProtocolSelectionScreen INSTANCE = new ProtocolSelectionScreen(); diff --git a/src/main/java/com/viaversion/viafabricplus/screen/ReportIssuesScreen.java b/src/main/java/com/viaversion/viafabricplus/screen/ReportIssuesScreen.java index bd9abd53..3247ef17 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/ReportIssuesScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/ReportIssuesScreen.java @@ -34,7 +34,7 @@ import java.net.URI; import java.util.LinkedHashMap; import java.util.Map; -public class ReportIssuesScreen extends VFPScreen { +public final class ReportIssuesScreen extends VFPScreen { public static final ReportIssuesScreen INSTANCE = new ReportIssuesScreen(); diff --git a/src/main/java/com/viaversion/viafabricplus/screen/ServerListScreen.java b/src/main/java/com/viaversion/viafabricplus/screen/ServerListScreen.java index 7c949163..66aebad4 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/ServerListScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/ServerListScreen.java @@ -31,7 +31,7 @@ import net.minecraft.client.gui.tooltip.Tooltip; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.Text; -public class ServerListScreen extends VFPScreen { +public final class ServerListScreen extends VFPScreen { public static final ServerListScreen INSTANCE = new ServerListScreen(); diff --git a/src/main/java/com/viaversion/viafabricplus/screen/classic4j/BetaCraftScreen.java b/src/main/java/com/viaversion/viafabricplus/screen/classic4j/BetaCraftScreen.java index cc506f02..fdcac43b 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/classic4j/BetaCraftScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/classic4j/BetaCraftScreen.java @@ -39,7 +39,7 @@ import net.minecraft.util.Formatting; import java.util.List; -public class BetaCraftScreen extends VFPScreen { +public final class BetaCraftScreen extends VFPScreen { public static final BetaCraftScreen INSTANCE = new BetaCraftScreen(); diff --git a/src/main/java/com/viaversion/viafabricplus/screen/classic4j/ClassiCubeLoginScreen.java b/src/main/java/com/viaversion/viafabricplus/screen/classic4j/ClassiCubeLoginScreen.java index da606756..0d4b7801 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/classic4j/ClassiCubeLoginScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/classic4j/ClassiCubeLoginScreen.java @@ -26,7 +26,7 @@ import de.florianmichael.classic4j.api.LoginProcessHandler; import de.florianmichael.classic4j.model.classicube.account.CCAccount; import com.viaversion.viafabricplus.ViaFabricPlusImpl; import com.viaversion.viafabricplus.injection.access.base.ITextFieldWidget; -import com.viaversion.viafabricplus.base.save.impl.AccountsSave; +import com.viaversion.viafabricplus.save.impl.AccountsSave; import com.viaversion.viafabricplus.base.screen.VFPScreen; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ConfirmLinkScreen; @@ -34,7 +34,7 @@ import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.text.Text; -public class ClassiCubeLoginScreen extends VFPScreen { +public final class ClassiCubeLoginScreen extends VFPScreen { public static final ClassiCubeLoginScreen INSTANCE = new ClassiCubeLoginScreen(); diff --git a/src/main/java/com/viaversion/viafabricplus/screen/classic4j/ClassiCubeMFAScreen.java b/src/main/java/com/viaversion/viafabricplus/screen/classic4j/ClassiCubeMFAScreen.java index bbf05444..25f47452 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/classic4j/ClassiCubeMFAScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/classic4j/ClassiCubeMFAScreen.java @@ -32,7 +32,7 @@ import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.text.Text; -public class ClassiCubeMFAScreen extends VFPScreen { +public final class ClassiCubeMFAScreen extends VFPScreen { public static final ClassiCubeMFAScreen INSTANCE = new ClassiCubeMFAScreen(); diff --git a/src/main/java/com/viaversion/viafabricplus/screen/classic4j/ClassiCubeServerListScreen.java b/src/main/java/com/viaversion/viafabricplus/screen/classic4j/ClassiCubeServerListScreen.java index ddd102ea..26bbb15a 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/classic4j/ClassiCubeServerListScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/classic4j/ClassiCubeServerListScreen.java @@ -30,7 +30,7 @@ import com.viaversion.viafabricplus.protocoltranslator.impl.provider.vialegacy.V import com.viaversion.viafabricplus.base.screen.VFPList; import com.viaversion.viafabricplus.base.screen.VFPListEntry; import com.viaversion.viafabricplus.base.screen.VFPScreen; -import com.viaversion.viafabricplus.base.settings.impl.AuthenticationSettings; +import com.viaversion.viafabricplus.settings.impl.AuthenticationSettings; import com.viaversion.viafabricplus.util.ConnectionUtil; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; @@ -44,7 +44,7 @@ import net.raphimc.vialegacy.api.LegacyProtocolVersion; import java.util.ArrayList; import java.util.List; -public class ClassiCubeServerListScreen extends VFPScreen { +public final class ClassiCubeServerListScreen extends VFPScreen { public static final ClassiCubeServerListScreen INSTANCE = new ClassiCubeServerListScreen(); @@ -128,7 +128,7 @@ public class ClassiCubeServerListScreen extends VFPScreen { @Override public void mappedMouseClicked(double mouseX, double mouseY, int button) { - final boolean selectCPE = AuthenticationSettings.global().automaticallySelectCPEInClassiCubeServerList.getValue(); + final boolean selectCPE = AuthenticationSettings.INSTANCE.automaticallySelectCPEInClassiCubeServerList.getValue(); ViaFabricPlusClassicMPPassProvider.classicubeMPPass = classiCubeServerInfo.mpPass(); ConnectionUtil.connect(classiCubeServerInfo.name(), classiCubeServerInfo.ip() + ":" + classiCubeServerInfo.port(), selectCPE ? LegacyProtocolVersion.c0_30cpe : null); diff --git a/src/main/java/com/viaversion/viafabricplus/screen/realms/AcceptInvitationCodeScreen.java b/src/main/java/com/viaversion/viafabricplus/screen/realms/AcceptInvitationCodeScreen.java index 56398772..f223a1cb 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/realms/AcceptInvitationCodeScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/realms/AcceptInvitationCodeScreen.java @@ -28,7 +28,7 @@ import net.minecraft.text.Text; import java.util.function.Consumer; -public class AcceptInvitationCodeScreen extends VFPScreen { +public final class AcceptInvitationCodeScreen extends VFPScreen { private final Consumer serviceHandler; diff --git a/src/main/java/com/viaversion/viafabricplus/screen/realms/BedrockRealmsScreen.java b/src/main/java/com/viaversion/viafabricplus/screen/realms/BedrockRealmsScreen.java index 8ac4de69..753edf1d 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/realms/BedrockRealmsScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/realms/BedrockRealmsScreen.java @@ -43,7 +43,7 @@ import java.awt.*; import java.util.List; import java.util.concurrent.CompletableFuture; -public class BedrockRealmsScreen extends VFPScreen { +public final class BedrockRealmsScreen extends VFPScreen { public static final BedrockRealmsScreen INSTANCE = new BedrockRealmsScreen(); @@ -159,7 +159,7 @@ public class BedrockRealmsScreen extends VFPScreen { return slotList == null; } - public class SlotList extends VFPList { + public final class SlotList extends VFPList { private static double scrollAmount; public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) { @@ -183,7 +183,7 @@ public class BedrockRealmsScreen extends VFPScreen { } - public class SlotEntry extends VFPListEntry { + public final class SlotEntry extends VFPListEntry { private final SlotList slotList; private final RealmsWorld realmsWorld; diff --git a/src/main/java/com/viaversion/viafabricplus/screen/settings/BooleanSettingRenderer.java b/src/main/java/com/viaversion/viafabricplus/screen/settings/BooleanSettingRenderer.java index 2744a7bd..2c2be141 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/settings/BooleanSettingRenderer.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/settings/BooleanSettingRenderer.java @@ -22,7 +22,7 @@ package com.viaversion.viafabricplus.screen.settings; import com.viaversion.viafabricplus.base.screen.VFPListEntry; -import com.viaversion.viafabricplus.base.settings.base.BooleanSetting; +import com.viaversion.viafabricplus.settings.base.BooleanSetting; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; @@ -31,7 +31,7 @@ import net.minecraft.util.Formatting; import java.awt.*; -public class BooleanSettingRenderer extends VFPListEntry { +public final class BooleanSettingRenderer extends VFPListEntry { private final BooleanSetting value; public BooleanSettingRenderer(BooleanSetting value) { diff --git a/src/main/java/com/viaversion/viafabricplus/screen/settings/ButtonSettingRenderer.java b/src/main/java/com/viaversion/viafabricplus/screen/settings/ButtonSettingRenderer.java index 37069773..fdd17047 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/settings/ButtonSettingRenderer.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/settings/ButtonSettingRenderer.java @@ -22,13 +22,13 @@ package com.viaversion.viafabricplus.screen.settings; import com.viaversion.viafabricplus.base.screen.VFPListEntry; -import com.viaversion.viafabricplus.base.settings.base.ButtonSetting; +import com.viaversion.viafabricplus.settings.base.ButtonSetting; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; import net.minecraft.text.Text; -public class ButtonSettingRenderer extends VFPListEntry { +public final class ButtonSettingRenderer extends VFPListEntry { private final ButtonSetting value; diff --git a/src/main/java/com/viaversion/viafabricplus/screen/settings/ModeSettingRenderer.java b/src/main/java/com/viaversion/viafabricplus/screen/settings/ModeSettingRenderer.java index 49d907f2..d20b4caf 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/settings/ModeSettingRenderer.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/settings/ModeSettingRenderer.java @@ -22,7 +22,7 @@ package com.viaversion.viafabricplus.screen.settings; import com.viaversion.viafabricplus.base.screen.VFPListEntry; -import com.viaversion.viafabricplus.base.settings.base.ModeSetting; +import com.viaversion.viafabricplus.settings.base.ModeSetting; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; @@ -31,7 +31,7 @@ import net.minecraft.util.Formatting; import java.util.Arrays; -public class ModeSettingRenderer extends VFPListEntry { +public final class ModeSettingRenderer extends VFPListEntry { private final ModeSetting value; public ModeSettingRenderer(ModeSetting value) { diff --git a/src/main/java/com/viaversion/viafabricplus/screen/settings/SettingsScreen.java b/src/main/java/com/viaversion/viafabricplus/screen/settings/SettingsScreen.java index 9346f2c0..0ef677df 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/settings/SettingsScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/settings/SettingsScreen.java @@ -24,12 +24,12 @@ package com.viaversion.viafabricplus.screen.settings; import com.viaversion.viafabricplus.ViaFabricPlusImpl; import com.viaversion.viafabricplus.base.screen.VFPList; import com.viaversion.viafabricplus.base.screen.VFPScreen; -import com.viaversion.viafabricplus.base.settings.base.AbstractSetting; -import com.viaversion.viafabricplus.base.settings.base.SettingGroup; +import com.viaversion.viafabricplus.settings.base.AbstractSetting; +import com.viaversion.viafabricplus.settings.base.SettingGroup; import net.minecraft.client.MinecraftClient; import net.minecraft.text.Text; -public class SettingsScreen extends VFPScreen { +public final class SettingsScreen extends VFPScreen { public static final SettingsScreen INSTANCE = new SettingsScreen(); diff --git a/src/main/java/com/viaversion/viafabricplus/screen/settings/TitleRenderer.java b/src/main/java/com/viaversion/viafabricplus/screen/settings/TitleRenderer.java index e4ba7e03..97e038b4 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/settings/TitleRenderer.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/settings/TitleRenderer.java @@ -29,7 +29,7 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import net.minecraft.util.Formatting; -public class TitleRenderer extends VFPListEntry { +public final class TitleRenderer extends VFPListEntry { private final Text name; diff --git a/src/main/java/com/viaversion/viafabricplus/screen/settings/VersionedBooleanSettingRenderer.java b/src/main/java/com/viaversion/viafabricplus/screen/settings/VersionedBooleanSettingRenderer.java index 4c6c43a0..befa930e 100644 --- a/src/main/java/com/viaversion/viafabricplus/screen/settings/VersionedBooleanSettingRenderer.java +++ b/src/main/java/com/viaversion/viafabricplus/screen/settings/VersionedBooleanSettingRenderer.java @@ -22,7 +22,7 @@ package com.viaversion.viafabricplus.screen.settings; import com.viaversion.viafabricplus.base.screen.VFPListEntry; -import com.viaversion.viafabricplus.base.settings.base.VersionedBooleanSetting; +import com.viaversion.viafabricplus.settings.base.VersionedBooleanSetting; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; @@ -31,7 +31,7 @@ import net.minecraft.util.Formatting; import java.awt.*; -public class VersionedBooleanSettingRenderer extends VFPListEntry { +public final class VersionedBooleanSettingRenderer extends VFPListEntry { private final VersionedBooleanSetting value; public VersionedBooleanSettingRenderer(VersionedBooleanSetting value) { diff --git a/src/main/java/com/viaversion/viafabricplus/base/settings/SettingsManager.java b/src/main/java/com/viaversion/viafabricplus/settings/SettingsManager.java similarity index 80% rename from src/main/java/com/viaversion/viafabricplus/base/settings/SettingsManager.java rename to src/main/java/com/viaversion/viafabricplus/settings/SettingsManager.java index 48d8f860..7ecb2a73 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/settings/SettingsManager.java +++ b/src/main/java/com/viaversion/viafabricplus/settings/SettingsManager.java @@ -19,18 +19,18 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.settings; +package com.viaversion.viafabricplus.settings; import com.viaversion.viafabricplus.api.LoadingCycleCallback; import com.viaversion.viafabricplus.base.Events; -import com.viaversion.viafabricplus.base.settings.impl.*; -import com.viaversion.viafabricplus.base.settings.base.SettingGroup; +import com.viaversion.viafabricplus.settings.base.SettingGroup; +import com.viaversion.viafabricplus.settings.impl.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class SettingsManager { +public final class SettingsManager { private final List groups = new ArrayList<>(); @@ -38,11 +38,11 @@ public class SettingsManager { Events.LOADING_CYCLE.invoker().onLoadCycle(LoadingCycleCallback.LoadingCycle.PRE_SETTINGS_LOAD); addGroup( - GeneralSettings.global(), - BedrockSettings.global(), - AuthenticationSettings.global(), - VisualSettings.global(), - DebugSettings.global() + GeneralSettings.INSTANCE, + BedrockSettings.INSTANCE, + AuthenticationSettings.INSTANCE, + VisualSettings.INSTANCE, + DebugSettings.INSTANCE ); Events.LOADING_CYCLE.invoker().onLoadCycle(LoadingCycleCallback.LoadingCycle.POST_SETTINGS_LOAD); diff --git a/src/main/java/com/viaversion/viafabricplus/base/settings/base/AbstractSetting.java b/src/main/java/com/viaversion/viafabricplus/settings/base/AbstractSetting.java similarity index 98% rename from src/main/java/com/viaversion/viafabricplus/base/settings/base/AbstractSetting.java rename to src/main/java/com/viaversion/viafabricplus/settings/base/AbstractSetting.java index 9ca57b8e..16856737 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/settings/base/AbstractSetting.java +++ b/src/main/java/com/viaversion/viafabricplus/settings/base/AbstractSetting.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.settings.base; +package com.viaversion.viafabricplus.settings.base; import com.google.gson.JsonObject; import com.viaversion.viafabricplus.base.screen.VFPListEntry; diff --git a/src/main/java/com/viaversion/viafabricplus/base/settings/base/BooleanSetting.java b/src/main/java/com/viaversion/viafabricplus/settings/base/BooleanSetting.java similarity index 96% rename from src/main/java/com/viaversion/viafabricplus/base/settings/base/BooleanSetting.java rename to src/main/java/com/viaversion/viafabricplus/settings/base/BooleanSetting.java index cc281474..ca0af174 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/settings/base/BooleanSetting.java +++ b/src/main/java/com/viaversion/viafabricplus/settings/base/BooleanSetting.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.settings.base; +package com.viaversion.viafabricplus.settings.base; import com.google.gson.JsonObject; import com.viaversion.viafabricplus.base.screen.VFPListEntry; diff --git a/src/main/java/com/viaversion/viafabricplus/base/settings/base/ButtonSetting.java b/src/main/java/com/viaversion/viafabricplus/settings/base/ButtonSetting.java similarity index 96% rename from src/main/java/com/viaversion/viafabricplus/base/settings/base/ButtonSetting.java rename to src/main/java/com/viaversion/viafabricplus/settings/base/ButtonSetting.java index 3429bc3a..24c0d4d8 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/settings/base/ButtonSetting.java +++ b/src/main/java/com/viaversion/viafabricplus/settings/base/ButtonSetting.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.settings.base; +package com.viaversion.viafabricplus.settings.base; import com.google.gson.JsonObject; import com.viaversion.viafabricplus.base.screen.VFPListEntry; diff --git a/src/main/java/com/viaversion/viafabricplus/base/settings/base/ModeSetting.java b/src/main/java/com/viaversion/viafabricplus/settings/base/ModeSetting.java similarity index 97% rename from src/main/java/com/viaversion/viafabricplus/base/settings/base/ModeSetting.java rename to src/main/java/com/viaversion/viafabricplus/settings/base/ModeSetting.java index 75be4ac3..aa92e56b 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/settings/base/ModeSetting.java +++ b/src/main/java/com/viaversion/viafabricplus/settings/base/ModeSetting.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.settings.base; +package com.viaversion.viafabricplus.settings.base; import com.google.gson.JsonObject; import com.viaversion.viafabricplus.base.screen.VFPListEntry; diff --git a/src/main/java/com/viaversion/viafabricplus/base/settings/base/SettingGroup.java b/src/main/java/com/viaversion/viafabricplus/settings/base/SettingGroup.java similarity index 96% rename from src/main/java/com/viaversion/viafabricplus/base/settings/base/SettingGroup.java rename to src/main/java/com/viaversion/viafabricplus/settings/base/SettingGroup.java index 4b31661c..7999795d 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/settings/base/SettingGroup.java +++ b/src/main/java/com/viaversion/viafabricplus/settings/base/SettingGroup.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.settings.base; +package com.viaversion.viafabricplus.settings.base; import net.minecraft.text.Text; diff --git a/src/main/java/com/viaversion/viafabricplus/base/settings/base/VersionedBooleanSetting.java b/src/main/java/com/viaversion/viafabricplus/settings/base/VersionedBooleanSetting.java similarity index 98% rename from src/main/java/com/viaversion/viafabricplus/base/settings/base/VersionedBooleanSetting.java rename to src/main/java/com/viaversion/viafabricplus/settings/base/VersionedBooleanSetting.java index 1bb14e28..4b3186c9 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/settings/base/VersionedBooleanSetting.java +++ b/src/main/java/com/viaversion/viafabricplus/settings/base/VersionedBooleanSetting.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.settings.base; +package com.viaversion.viafabricplus.settings.base; import com.google.gson.JsonObject; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; diff --git a/src/main/java/com/viaversion/viafabricplus/base/settings/impl/AuthenticationSettings.java b/src/main/java/com/viaversion/viafabricplus/settings/impl/AuthenticationSettings.java similarity index 81% rename from src/main/java/com/viaversion/viafabricplus/base/settings/impl/AuthenticationSettings.java rename to src/main/java/com/viaversion/viafabricplus/settings/impl/AuthenticationSettings.java index 3dd0ac57..76fc7871 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/settings/impl/AuthenticationSettings.java +++ b/src/main/java/com/viaversion/viafabricplus/settings/impl/AuthenticationSettings.java @@ -19,15 +19,15 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.settings.impl; +package com.viaversion.viafabricplus.settings.impl; -import com.viaversion.viafabricplus.base.settings.base.BooleanSetting; -import com.viaversion.viafabricplus.base.settings.base.SettingGroup; +import com.viaversion.viafabricplus.settings.base.BooleanSetting; +import com.viaversion.viafabricplus.settings.base.SettingGroup; import net.minecraft.text.Text; -public class AuthenticationSettings extends SettingGroup { +public final class AuthenticationSettings extends SettingGroup { - private static final AuthenticationSettings INSTANCE = new AuthenticationSettings(); + public static final AuthenticationSettings INSTANCE = new AuthenticationSettings(); public final BooleanSetting useBetaCraftAuthentication = new BooleanSetting(this, Text.translatable("authentication_settings.viafabricplus.use_beta_craft_authentication"), true); public final BooleanSetting verifySessionForOnlineModeServers = new BooleanSetting(this, Text.translatable("authentication_settings.viafabricplus.verify_session_for_online_mode"), true); @@ -38,8 +38,4 @@ public class AuthenticationSettings extends SettingGroup { super(Text.translatable("setting_group_name.viafabricplus.authentication")); } - public static AuthenticationSettings global() { - return INSTANCE; - } - } diff --git a/src/main/java/com/viaversion/viafabricplus/base/settings/impl/BedrockSettings.java b/src/main/java/com/viaversion/viafabricplus/settings/impl/BedrockSettings.java similarity index 91% rename from src/main/java/com/viaversion/viafabricplus/base/settings/impl/BedrockSettings.java rename to src/main/java/com/viaversion/viafabricplus/settings/impl/BedrockSettings.java index 2dd2f68e..b166b7d1 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/settings/impl/BedrockSettings.java +++ b/src/main/java/com/viaversion/viafabricplus/settings/impl/BedrockSettings.java @@ -19,15 +19,15 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.settings.impl; +package com.viaversion.viafabricplus.settings.impl; import com.viaversion.viafabricplus.ViaFabricPlusImpl; import com.viaversion.viafabricplus.injection.access.base.bedrock.IConfirmScreen; -import com.viaversion.viafabricplus.base.save.impl.AccountsSave; +import com.viaversion.viafabricplus.save.impl.AccountsSave; import com.viaversion.viafabricplus.base.screen.VFPScreen; -import com.viaversion.viafabricplus.base.settings.base.BooleanSetting; -import com.viaversion.viafabricplus.base.settings.base.ButtonSetting; -import com.viaversion.viafabricplus.base.settings.base.SettingGroup; +import com.viaversion.viafabricplus.settings.base.BooleanSetting; +import com.viaversion.viafabricplus.settings.base.ButtonSetting; +import com.viaversion.viafabricplus.settings.base.SettingGroup; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ConfirmScreen; @@ -49,11 +49,11 @@ import net.raphimc.viabedrock.protocol.data.ProtocolConstants; import java.util.Locale; import java.util.Objects; -public class BedrockSettings extends SettingGroup { +public final class BedrockSettings extends SettingGroup { private static final Text TITLE = Text.of("Microsoft Bedrock login"); - private static final BedrockSettings INSTANCE = new BedrockSettings(); + public static final BedrockSettings INSTANCE = new BedrockSettings(); public static final AbstractStep BEDROCK_DEVICE_CODE_LOGIN = MinecraftAuth.builder() .withClientId(MicrosoftConstants.BEDROCK_ANDROID_TITLE_ID).withScope(MicrosoftConstants.SCOPE_TITLE_AUTH) @@ -137,15 +137,11 @@ public class BedrockSettings extends SettingGroup { public static String replaceDefaultPort(final String address, final ProtocolVersion version) { // If the default port for this entry should be replaced, check if the address already contains a port // We can't just replace vanilla's default port because a bedrock server might be running on the same port - if (BedrockSettings.global().replaceDefaultPort.getValue() && Objects.equals(version, BedrockProtocolVersion.bedrockLatest) && !address.contains(":")) { + if (BedrockSettings.INSTANCE.replaceDefaultPort.getValue() && Objects.equals(version, BedrockProtocolVersion.bedrockLatest) && !address.contains(":")) { return address + ":" + ProtocolConstants.BEDROCK_DEFAULT_PORT; } else { return address; } } - public static BedrockSettings global() { - return INSTANCE; - } - } diff --git a/src/main/java/com/viaversion/viafabricplus/base/settings/impl/DebugSettings.java b/src/main/java/com/viaversion/viafabricplus/settings/impl/DebugSettings.java similarity index 89% rename from src/main/java/com/viaversion/viafabricplus/base/settings/impl/DebugSettings.java rename to src/main/java/com/viaversion/viafabricplus/settings/impl/DebugSettings.java index 0f8fe34c..951cdd4e 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/settings/impl/DebugSettings.java +++ b/src/main/java/com/viaversion/viafabricplus/settings/impl/DebugSettings.java @@ -19,19 +19,19 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.settings.impl; +package com.viaversion.viafabricplus.settings.impl; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import com.viaversion.viafabricplus.base.settings.base.BooleanSetting; -import com.viaversion.viafabricplus.base.settings.base.SettingGroup; -import com.viaversion.viafabricplus.base.settings.base.VersionedBooleanSetting; +import com.viaversion.viafabricplus.settings.base.BooleanSetting; +import com.viaversion.viafabricplus.settings.base.SettingGroup; +import com.viaversion.viafabricplus.settings.base.VersionedBooleanSetting; import net.minecraft.text.Text; import net.raphimc.vialegacy.api.LegacyProtocolVersion; import net.raphimc.vialoader.util.VersionRange; -public class DebugSettings extends SettingGroup { +public final class DebugSettings extends SettingGroup { - private static final DebugSettings INSTANCE = new DebugSettings(); + public static final DebugSettings INSTANCE = new DebugSettings(); 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); @@ -66,8 +66,4 @@ public class DebugSettings extends SettingGroup { super(Text.translatable("setting_group_name.viafabricplus.debug")); } - public static DebugSettings global() { - return INSTANCE; - } - } diff --git a/src/main/java/com/viaversion/viafabricplus/base/settings/impl/GeneralSettings.java b/src/main/java/com/viaversion/viafabricplus/settings/impl/GeneralSettings.java similarity index 91% rename from src/main/java/com/viaversion/viafabricplus/base/settings/impl/GeneralSettings.java rename to src/main/java/com/viaversion/viafabricplus/settings/impl/GeneralSettings.java index 61d79d86..f9a7d5bd 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/settings/impl/GeneralSettings.java +++ b/src/main/java/com/viaversion/viafabricplus/settings/impl/GeneralSettings.java @@ -19,18 +19,18 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.settings.impl; +package com.viaversion.viafabricplus.settings.impl; -import com.viaversion.viafabricplus.base.settings.base.BooleanSetting; -import com.viaversion.viafabricplus.base.settings.base.ModeSetting; -import com.viaversion.viafabricplus.base.settings.base.SettingGroup; +import com.viaversion.viafabricplus.settings.base.BooleanSetting; +import com.viaversion.viafabricplus.settings.base.ModeSetting; +import com.viaversion.viafabricplus.settings.base.SettingGroup; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.MutableText; import net.minecraft.text.Text; -public class GeneralSettings extends SettingGroup { +public final class GeneralSettings extends SettingGroup { - private static final GeneralSettings INSTANCE = new GeneralSettings(); + public static final GeneralSettings INSTANCE = new GeneralSettings(); private final MutableText[] ORIENTATION_OPTIONS = new MutableText[] { Text.translatable("base.viafabricplus.none"), @@ -76,8 +76,4 @@ public class GeneralSettings extends SettingGroup { }; } - public static GeneralSettings global() { - return INSTANCE; - } - } diff --git a/src/main/java/com/viaversion/viafabricplus/base/settings/impl/VisualSettings.java b/src/main/java/com/viaversion/viafabricplus/settings/impl/VisualSettings.java similarity index 94% rename from src/main/java/com/viaversion/viafabricplus/base/settings/impl/VisualSettings.java rename to src/main/java/com/viaversion/viafabricplus/settings/impl/VisualSettings.java index e4f2298b..4f6f4fd8 100644 --- a/src/main/java/com/viaversion/viafabricplus/base/settings/impl/VisualSettings.java +++ b/src/main/java/com/viaversion/viafabricplus/settings/impl/VisualSettings.java @@ -19,22 +19,22 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.base.settings.impl; +package com.viaversion.viafabricplus.settings.impl; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import com.viaversion.viafabricplus.base.settings.base.BooleanSetting; -import com.viaversion.viafabricplus.base.settings.base.ModeSetting; -import com.viaversion.viafabricplus.base.settings.base.SettingGroup; -import com.viaversion.viafabricplus.base.settings.base.VersionedBooleanSetting; +import com.viaversion.viafabricplus.settings.base.BooleanSetting; +import com.viaversion.viafabricplus.settings.base.ModeSetting; +import com.viaversion.viafabricplus.settings.base.SettingGroup; +import com.viaversion.viafabricplus.settings.base.VersionedBooleanSetting; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.FontStorage; import net.minecraft.text.Text; import net.raphimc.vialegacy.api.LegacyProtocolVersion; import net.raphimc.vialoader.util.VersionRange; -public class VisualSettings extends SettingGroup { +public final class VisualSettings extends SettingGroup { - private static final VisualSettings INSTANCE = new VisualSettings(); + public static final VisualSettings INSTANCE = new VisualSettings(); public final ModeSetting changeGameMenuScreenLayout = new ModeSetting(this, Text.translatable("visual_settings.viafabricplus.change_game_menu_screen_layout"), Text.translatable("change_game_menu_screen_layout.viafabricplus.authentic"), @@ -118,8 +118,4 @@ public class VisualSettings extends SettingGroup { forceUnicodeFontForNonAsciiLanguages.setValue(VersionedBooleanSetting.DISABLED_INDEX); } - public static VisualSettings global() { - return INSTANCE; - } - } diff --git a/src/main/java/com/viaversion/viafabricplus/util/ChatUtil.java b/src/main/java/com/viaversion/viafabricplus/util/ChatUtil.java index e626a0fa..73748137 100644 --- a/src/main/java/com/viaversion/viafabricplus/util/ChatUtil.java +++ b/src/main/java/com/viaversion/viafabricplus/util/ChatUtil.java @@ -29,7 +29,7 @@ import net.minecraft.util.Formatting; /** * This class contains methods to send messages to the player with the ViaFabricPlus prefix */ -public class ChatUtil { +public final class ChatUtil { public static final String PREFIX = Formatting.WHITE + "[" + Formatting.GOLD + "ViaFabricPlus" + Formatting.WHITE + "]"; public static final Text PREFIX_TEXT = Text.literal("[").formatted(Formatting.WHITE).append(Text.literal("ViaFabricPlus").formatted(Formatting.GOLD)).append("]"); diff --git a/src/main/java/com/viaversion/viafabricplus/util/ClassLoaderPriorityUtil.java b/src/main/java/com/viaversion/viafabricplus/util/ClassLoaderPriorityUtil.java index 948c66f1..a132b0af 100644 --- a/src/main/java/com/viaversion/viafabricplus/util/ClassLoaderPriorityUtil.java +++ b/src/main/java/com/viaversion/viafabricplus/util/ClassLoaderPriorityUtil.java @@ -33,7 +33,7 @@ import java.nio.file.Path; /** * Allows the user to override the Via* jar files with custom ones using the "jars" folder in the run directory */ -public class ClassLoaderPriorityUtil { +public final class ClassLoaderPriorityUtil { /** * Loads all overriding jars diff --git a/src/main/java/com/viaversion/viafabricplus/util/ConnectionUtil.java b/src/main/java/com/viaversion/viafabricplus/util/ConnectionUtil.java index f768da42..a0892515 100644 --- a/src/main/java/com/viaversion/viafabricplus/util/ConnectionUtil.java +++ b/src/main/java/com/viaversion/viafabricplus/util/ConnectionUtil.java @@ -28,7 +28,7 @@ import net.minecraft.client.gui.screen.multiplayer.ConnectScreen; import net.minecraft.client.network.ServerAddress; import net.minecraft.client.network.ServerInfo; -public class ConnectionUtil { +public final class ConnectionUtil { public static void connect(final String address, final ProtocolVersion version) { connect(address, address, version); diff --git a/src/main/java/com/viaversion/viafabricplus/util/ItemUtil.java b/src/main/java/com/viaversion/viafabricplus/util/ItemUtil.java index 76714bb8..54d1502c 100644 --- a/src/main/java/com/viaversion/viafabricplus/util/ItemUtil.java +++ b/src/main/java/com/viaversion/viafabricplus/util/ItemUtil.java @@ -26,7 +26,7 @@ import net.minecraft.component.type.NbtComponent; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; -public class ItemUtil { +public final class ItemUtil { // ViaVersion's 1.20.5 -> 1.20.3 protocol will save the original item nbt inside custom data to later restore // it for creative clients, we can use this to get nbt stored in older protocols as well diff --git a/src/main/java/com/viaversion/viafabricplus/util/MapUtil.java b/src/main/java/com/viaversion/viafabricplus/util/MapUtil.java index 3cfd0e9a..8816f432 100644 --- a/src/main/java/com/viaversion/viafabricplus/util/MapUtil.java +++ b/src/main/java/com/viaversion/viafabricplus/util/MapUtil.java @@ -27,7 +27,7 @@ import java.util.Map; /** * Utility class for maps. */ -public class MapUtil { +public final class MapUtil { /** * Creates a new linked hash map with the given objects as key-value pairs. diff --git a/src/main/java/com/viaversion/viafabricplus/util/ModMenuScreenFactory.java b/src/main/java/com/viaversion/viafabricplus/util/ModMenuScreenFactory.java index fea08812..443ef064 100644 --- a/src/main/java/com/viaversion/viafabricplus/util/ModMenuScreenFactory.java +++ b/src/main/java/com/viaversion/viafabricplus/util/ModMenuScreenFactory.java @@ -28,7 +28,7 @@ import com.viaversion.viafabricplus.screen.settings.SettingsScreen; /** * Implementation of the ModMenu integration allowing users to open the settings screen from the mod menu. */ -public class ModMenuScreenFactory implements ModMenuApi { +public final class ModMenuScreenFactory implements ModMenuApi { @Override public ConfigScreenFactory getModConfigScreenFactory() {