From 184d8ea69404582c93347d53dbbf5fc789661c9b Mon Sep 17 00:00:00 2001
From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com>
Date: Sun, 7 May 2023 20:08:33 +0200
Subject: [PATCH] refactor project
---
.github/DEVELOPER_API.md | 26 ------
gradle.properties | 2 +-
.../viafabricplus/ViaFabricPlus.java | 14 ++--
.../{util => base}/FileSaver.java | 2 +-
.../event/ChangeProtocolVersionCallback.java | 2 +-
.../event/DisconnectConnectionCallback.java | 2 +-
.../event/FinishMinecraftLoadCallback.java | 2 +-
.../FinishViaLoadingBaseStartupCallback.java | 2 +-
.../event/InitializeSettingsCallback.java | 2 +-
.../LoadClassicProtocolExtensionCallback.java | 2 +-
.../{ => base}/event/PreLoadCallback.java | 2 +-
.../event/SkipIdlePacketCallback.java | 2 +-
.../event/ViaLoadingBaseBuilderCallback.java | 2 +-
.../information/AbstractInformationGroup.java | 19 ++++-
.../information/InformationSystem.java | 4 +-
.../information/impl/BedrockInformation.java | 7 +-
.../information/impl/C0_30CPEInformation.java | 4 +-
.../information/impl/GeneralInformation.java | 4 +-
.../information/impl/V1_1Information.java | 4 +-
.../information/impl/V1_2_4_5Information.java | 4 +-
.../information/impl/V1_5_2Information.java | 4 +-
.../information/impl/V1_7_10Information.java | 4 +-
.../base => base/screen}/MappedSlotEntry.java | 15 +++-
.../viafabricplus/base/screen/VFPScreen.java | 83 +++++++++++++++++++
.../impl}/ClassicItemSelectionScreen.java | 24 +++---
.../screen/impl/base}/ForceVersionScreen.java | 37 +++------
.../impl/base}/ProtocolSelectionScreen.java | 81 +++++++++---------
.../screen/impl}/settings/SettingsScreen.java | 45 +++-------
.../BooleanSettingRenderer.java | 13 ++-
.../ButtonSettingRenderer.java | 13 ++-
.../settingrenderer/ModeSettingRenderer.java | 13 ++-
.../ProtocolSyncBooleanSettingRenderer.java | 15 ++--
.../settingrenderer/meta/TitleRenderer.java | 8 +-
.../impl/thirdparty}/BetaCraftScreen.java | 47 ++++-------
.../classicube/ClassiCubeLoginScreen.java | 25 +++---
.../classicube/ClassiCubeMFAScreen.java | 24 +++---
.../ClassiCubeServerListScreen.java | 61 ++++++--------
.../{ => base}/settings/SettingsSystem.java | 12 +--
.../settings/base/AbstractSetting.java | 7 +-
.../settings/base/SettingGroup.java | 2 +-
.../groups/AuthenticationSettings.java | 16 ++--
.../settings/groups/DebugSettings.java | 6 +-
.../settings/groups/ExperimentalSettings.java | 6 +-
.../settings/groups/GeneralSettings.java | 8 +-
.../settings/groups/VisualSettings.java | 6 +-
.../settings/type_impl/BooleanSetting.java | 10 +--
.../settings/type_impl/ButtonSetting.java | 10 +--
.../settings/type_impl/ModeSetting.java | 10 +--
.../type_impl/ProtocolSyncBooleanSetting.java | 10 +--
.../definition/ChatLengthCalculation.java | 4 +-
.../bedrock/BedrockAccountHandler.java | 6 +-
.../c0_30/ClassiCubeAccountHandler.java | 8 +-
.../CustomClassicProtocolExtensions.java | 4 +-
.../definition/v1_12_2/FontCacheFix.java | 5 +-
.../v1_8/ArmorPointCalculation.java} | 6 +-
.../mixin/base/MixinAddServerScreen.java | 2 +-
.../mixin/base/MixinClientConnection.java | 4 +-
.../mixin/base/MixinConnectScreen.java | 2 +-
.../mixin/base/MixinConnectScreen_1.java | 2 +-
.../injection/mixin/base/MixinDebugHud.java | 8 +-
.../base/MixinDownloadingTerrainScreen.java | 2 +-
.../mixin/base/MixinMinecraftClient.java | 2 +-
.../mixin/base/MixinMultiplayerScreen.java | 6 +-
.../mixin/base/MixinOptionsScreen.java | 2 +-
.../mixin/base/MixinSharedConstants.java | 2 +-
.../minecraft/MixinBipedEntityModel.java | 2 +-
.../mixin/fixes/minecraft/MixinCamera.java | 2 +-
.../MixinClientPlayNetworkHandler.java | 2 +-
.../mixin/fixes/minecraft/MixinInGameHud.java | 2 +-
.../fixes/minecraft/MixinItemRenderer.java | 2 +-
.../fixes/minecraft/MixinMinecraftClient.java | 2 +-
.../minecraft/MixinPendingUpdateManager.java | 2 +-
.../minecraft/block/MixinAbstractBlock.java | 2 +-
.../entity/MixinClientPlayerEntity.java | 10 +--
.../minecraft/entity/MixinLivingEntity.java | 2 +-
.../minecraft/entity/MixinPlayerEntity.java | 2 +-
.../fixes/minecraft/input/MixinKeyboard.java | 2 +-
.../fixes/minecraft/input/MixinMouse.java | 2 +-
.../item/MixinItemCooldownManager.java | 2 +-
.../item/MixinItemGroup_EntriesImpl.java | 2 +-
.../fixes/minecraft/item/MixinItemGroups.java | 2 +-
.../fixes/minecraft/item/MixinItemStack.java | 2 +-
.../fixes/minecraft/screen/MixinChatHud.java | 2 +-
.../minecraft/screen/MixinChatScreen.java | 2 +-
.../screen/MixinCommandBlockScreen.java | 2 +-
.../screen/MixinConnectScreen_1.java | 2 +-
.../screen/MixinCreativeInventoryScreen.java | 4 +-
.../screen/MixinJigsawBlockScreen.java | 2 +-
.../screen/merchant/MixinMerchantScreen.java | 2 +-
.../mixin/fixes/sodium/MixinChunkTracker.java | 2 +-
...MixinExtensionProtocolMetadataStorage.java | 2 +-
.../fixes/vialegacy/MixinViaLegacyConfig.java | 2 +-
.../vialoadingbase/MixinVLBViaConfig.java | 2 +-
.../integration/ModMenuImpl.java | 8 +-
.../mappings/ItemReleaseVersionMappings.java | 2 +-
.../protocolhack/ProtocolHack.java | 6 +-
.../ViaFabricPlusClassicMPPassProvider.java | 4 +-
.../ViaFabricPlusOldAuthProvider.java | 7 +-
.../ViaFabricPlusVLBBaseVersionProvider.java | 2 +-
.../settings/ConfigRemapper.java | 34 --------
.../viafabricplus/util/ScreenUtil.java | 60 --------------
.../assets/viafabricplus/lang/en_us.json | 5 +-
102 files changed, 442 insertions(+), 540 deletions(-)
rename src/main/java/de/florianmichael/viafabricplus/{util => base}/FileSaver.java (98%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/event/ChangeProtocolVersionCallback.java (96%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/event/DisconnectConnectionCallback.java (95%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/event/FinishMinecraftLoadCallback.java (96%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/event/FinishViaLoadingBaseStartupCallback.java (96%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/event/InitializeSettingsCallback.java (96%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/event/LoadClassicProtocolExtensionCallback.java (96%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/event/PreLoadCallback.java (95%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/event/SkipIdlePacketCallback.java (95%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/event/ViaLoadingBaseBuilderCallback.java (96%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/information/AbstractInformationGroup.java (65%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/information/InformationSystem.java (92%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/information/impl/BedrockInformation.java (94%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/information/impl/C0_30CPEInformation.java (91%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/information/impl/GeneralInformation.java (92%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/information/impl/V1_1Information.java (91%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/information/impl/V1_2_4_5Information.java (91%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/information/impl/V1_5_2Information.java (91%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/information/impl/V1_7_10Information.java (91%)
rename src/main/java/de/florianmichael/viafabricplus/{screen/base => base/screen}/MappedSlotEntry.java (70%)
create mode 100644 src/main/java/de/florianmichael/viafabricplus/base/screen/VFPScreen.java
rename src/main/java/de/florianmichael/viafabricplus/{screen => base/screen/impl}/ClassicItemSelectionScreen.java (87%)
rename src/main/java/de/florianmichael/viafabricplus/{screen => base/screen/impl/base}/ForceVersionScreen.java (77%)
rename src/main/java/de/florianmichael/viafabricplus/{screen => base/screen/impl/base}/ProtocolSelectionScreen.java (66%)
rename src/main/java/de/florianmichael/viafabricplus/{screen => base/screen/impl}/settings/SettingsScreen.java (62%)
rename src/main/java/de/florianmichael/viafabricplus/{screen => base/screen/impl}/settings/settingrenderer/BooleanSettingRenderer.java (76%)
rename src/main/java/de/florianmichael/viafabricplus/{screen => base/screen/impl}/settings/settingrenderer/ButtonSettingRenderer.java (73%)
rename src/main/java/de/florianmichael/viafabricplus/{screen => base/screen/impl}/settings/settingrenderer/ModeSettingRenderer.java (76%)
rename src/main/java/de/florianmichael/viafabricplus/{screen => base/screen/impl}/settings/settingrenderer/ProtocolSyncBooleanSettingRenderer.java (77%)
rename src/main/java/de/florianmichael/viafabricplus/{screen => base/screen/impl}/settings/settingrenderer/meta/TitleRenderer.java (80%)
rename src/main/java/de/florianmichael/viafabricplus/{screen => base/screen/impl/thirdparty}/BetaCraftScreen.java (74%)
rename src/main/java/de/florianmichael/viafabricplus/{screen => base/screen/impl/thirdparty}/classicube/ClassiCubeLoginScreen.java (83%)
rename src/main/java/de/florianmichael/viafabricplus/{screen => base/screen/impl/thirdparty}/classicube/ClassiCubeMFAScreen.java (83%)
rename src/main/java/de/florianmichael/viafabricplus/{screen => base/screen/impl/thirdparty}/classicube/ClassiCubeServerListScreen.java (69%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/settings/SettingsSystem.java (86%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/settings/base/AbstractSetting.java (86%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/settings/base/SettingGroup.java (95%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/settings/groups/AuthenticationSettings.java (88%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/settings/groups/DebugSettings.java (94%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/settings/groups/ExperimentalSettings.java (87%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/settings/groups/GeneralSettings.java (89%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/settings/groups/VisualSettings.java (94%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/settings/type_impl/BooleanSetting.java (80%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/settings/type_impl/ButtonSetting.java (78%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/settings/type_impl/ModeSetting.java (83%)
rename src/main/java/de/florianmichael/viafabricplus/{ => base}/settings/type_impl/ProtocolSyncBooleanSetting.java (84%)
rename src/main/java/de/florianmichael/viafabricplus/{mappings/ArmorPointsMappings.java => definition/v1_8/ArmorPointCalculation.java} (93%)
delete mode 100644 src/main/java/de/florianmichael/viafabricplus/settings/ConfigRemapper.java
delete mode 100644 src/main/java/de/florianmichael/viafabricplus/util/ScreenUtil.java
diff --git a/.github/DEVELOPER_API.md b/.github/DEVELOPER_API.md
index 00ea5c60..2e854891 100644
--- a/.github/DEVELOPER_API.md
+++ b/.github/DEVELOPER_API.md
@@ -52,32 +52,6 @@ PreLoadCallback.EVENT.register(() -> {
});
```
-#### Implementing classic protocol commands:
-```java
-public class ExampleCommand implements ICommand {
-
- @Override
- public String name() {
- return "example";
- }
-
- @Override
- public String description() {
- return null;
- }
-
- @Override
- public void execute(String[] args) {
- }
-}
-```
-and then you register the command in your onLoad method:
-```java
-PreLoadCallback.EVENT.register(() -> {
- ClassicProtocolCommands.commands.add(new ExampleCommand());
-});
-```
-
#### Implementing custom classic protocol extensions:
```java
public class ExampleExtensionSupport implements ClientModInitializer {
diff --git a/gradle.properties b/gradle.properties
index 128d6d7a..e109d747 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -27,7 +27,7 @@ snake_yml_version=2.0
vialegacy_version=2.2.16
viaaprilfools_version=2.0.7-SNAPSHOT
viabedrock_version=0.0.1-SNAPSHOT
-minecraftauth_version=2.1.1-SNAPSHOT
+minecraftauth_version=2.1.1
# lenni0451 libs
mcstructs_text_version=2.2.5
diff --git a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java
index 0c2294f8..8c70396f 100644
--- a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java
+++ b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java
@@ -24,15 +24,15 @@ import de.florianmichael.viafabricplus.definition.v1_12_2.FontCacheFix;
import de.florianmichael.viafabricplus.mappings.ItemReleaseVersionMappings;
import de.florianmichael.viafabricplus.mappings.PackFormatsMappings;
import de.florianmichael.viafabricplus.definition.bedrock.BedrockAccountHandler;
-import de.florianmichael.viafabricplus.screen.ClassicItemSelectionScreen;
+import de.florianmichael.viafabricplus.base.screen.impl.ClassicItemSelectionScreen;
import de.florianmichael.viafabricplus.definition.c0_30.ClassiCubeAccountHandler;
import de.florianmichael.viafabricplus.definition.c0_30.protocol.CustomClassicProtocolExtensions;
-import de.florianmichael.viafabricplus.mappings.ArmorPointsMappings;
-import de.florianmichael.viafabricplus.event.FinishMinecraftLoadCallback;
-import de.florianmichael.viafabricplus.event.PreLoadCallback;
-import de.florianmichael.viafabricplus.information.InformationSystem;
+import de.florianmichael.viafabricplus.definition.v1_8.ArmorPointCalculation;
+import de.florianmichael.viafabricplus.base.event.FinishMinecraftLoadCallback;
+import de.florianmichael.viafabricplus.base.event.PreLoadCallback;
+import de.florianmichael.viafabricplus.base.information.InformationSystem;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
-import de.florianmichael.viafabricplus.settings.SettingsSystem;
+import de.florianmichael.viafabricplus.base.settings.SettingsSystem;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -85,7 +85,7 @@ public class ViaFabricPlus {
// Version related mappings
PackFormatsMappings.load();
ItemReleaseVersionMappings.create();
- ArmorPointsMappings.load();
+ ArmorPointCalculation.load();
});
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/util/FileSaver.java b/src/main/java/de/florianmichael/viafabricplus/base/FileSaver.java
similarity index 98%
rename from src/main/java/de/florianmichael/viafabricplus/util/FileSaver.java
rename to src/main/java/de/florianmichael/viafabricplus/base/FileSaver.java
index 3468f936..df9504b2 100644
--- a/src/main/java/de/florianmichael/viafabricplus/util/FileSaver.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/FileSaver.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.util;
+package de.florianmichael.viafabricplus.base;
import com.google.gson.JsonObject;
import de.florianmichael.viafabricplus.ViaFabricPlus;
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/ChangeProtocolVersionCallback.java b/src/main/java/de/florianmichael/viafabricplus/base/event/ChangeProtocolVersionCallback.java
similarity index 96%
rename from src/main/java/de/florianmichael/viafabricplus/event/ChangeProtocolVersionCallback.java
rename to src/main/java/de/florianmichael/viafabricplus/base/event/ChangeProtocolVersionCallback.java
index fba5c81d..eb230833 100644
--- a/src/main/java/de/florianmichael/viafabricplus/event/ChangeProtocolVersionCallback.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/event/ChangeProtocolVersionCallback.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.event;
+package de.florianmichael.viafabricplus.base.event;
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
import net.fabricmc.fabric.api.event.Event;
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/DisconnectConnectionCallback.java b/src/main/java/de/florianmichael/viafabricplus/base/event/DisconnectConnectionCallback.java
similarity index 95%
rename from src/main/java/de/florianmichael/viafabricplus/event/DisconnectConnectionCallback.java
rename to src/main/java/de/florianmichael/viafabricplus/base/event/DisconnectConnectionCallback.java
index c406d578..607b06a6 100644
--- a/src/main/java/de/florianmichael/viafabricplus/event/DisconnectConnectionCallback.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/event/DisconnectConnectionCallback.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.event;
+package de.florianmichael.viafabricplus.base.event;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/FinishMinecraftLoadCallback.java b/src/main/java/de/florianmichael/viafabricplus/base/event/FinishMinecraftLoadCallback.java
similarity index 96%
rename from src/main/java/de/florianmichael/viafabricplus/event/FinishMinecraftLoadCallback.java
rename to src/main/java/de/florianmichael/viafabricplus/base/event/FinishMinecraftLoadCallback.java
index e4b2ba97..e43fe164 100644
--- a/src/main/java/de/florianmichael/viafabricplus/event/FinishMinecraftLoadCallback.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/event/FinishMinecraftLoadCallback.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.event;
+package de.florianmichael.viafabricplus.base.event;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/FinishViaLoadingBaseStartupCallback.java b/src/main/java/de/florianmichael/viafabricplus/base/event/FinishViaLoadingBaseStartupCallback.java
similarity index 96%
rename from src/main/java/de/florianmichael/viafabricplus/event/FinishViaLoadingBaseStartupCallback.java
rename to src/main/java/de/florianmichael/viafabricplus/base/event/FinishViaLoadingBaseStartupCallback.java
index 6c5a8374..533fa7dc 100644
--- a/src/main/java/de/florianmichael/viafabricplus/event/FinishViaLoadingBaseStartupCallback.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/event/FinishViaLoadingBaseStartupCallback.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.event;
+package de.florianmichael.viafabricplus.base.event;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/InitializeSettingsCallback.java b/src/main/java/de/florianmichael/viafabricplus/base/event/InitializeSettingsCallback.java
similarity index 96%
rename from src/main/java/de/florianmichael/viafabricplus/event/InitializeSettingsCallback.java
rename to src/main/java/de/florianmichael/viafabricplus/base/event/InitializeSettingsCallback.java
index 1b0bdeb0..18368a60 100644
--- a/src/main/java/de/florianmichael/viafabricplus/event/InitializeSettingsCallback.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/event/InitializeSettingsCallback.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.event;
+package de.florianmichael.viafabricplus.base.event;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/LoadClassicProtocolExtensionCallback.java b/src/main/java/de/florianmichael/viafabricplus/base/event/LoadClassicProtocolExtensionCallback.java
similarity index 96%
rename from src/main/java/de/florianmichael/viafabricplus/event/LoadClassicProtocolExtensionCallback.java
rename to src/main/java/de/florianmichael/viafabricplus/base/event/LoadClassicProtocolExtensionCallback.java
index 3533bf94..f31d2c26 100644
--- a/src/main/java/de/florianmichael/viafabricplus/event/LoadClassicProtocolExtensionCallback.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/event/LoadClassicProtocolExtensionCallback.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.event;
+package de.florianmichael.viafabricplus.base.event;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/PreLoadCallback.java b/src/main/java/de/florianmichael/viafabricplus/base/event/PreLoadCallback.java
similarity index 95%
rename from src/main/java/de/florianmichael/viafabricplus/event/PreLoadCallback.java
rename to src/main/java/de/florianmichael/viafabricplus/base/event/PreLoadCallback.java
index 11ef51b3..1b0d8c03 100644
--- a/src/main/java/de/florianmichael/viafabricplus/event/PreLoadCallback.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/event/PreLoadCallback.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.event;
+package de.florianmichael.viafabricplus.base.event;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/SkipIdlePacketCallback.java b/src/main/java/de/florianmichael/viafabricplus/base/event/SkipIdlePacketCallback.java
similarity index 95%
rename from src/main/java/de/florianmichael/viafabricplus/event/SkipIdlePacketCallback.java
rename to src/main/java/de/florianmichael/viafabricplus/base/event/SkipIdlePacketCallback.java
index 6677207d..2d247c6d 100644
--- a/src/main/java/de/florianmichael/viafabricplus/event/SkipIdlePacketCallback.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/event/SkipIdlePacketCallback.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.event;
+package de.florianmichael.viafabricplus.base.event;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/ViaLoadingBaseBuilderCallback.java b/src/main/java/de/florianmichael/viafabricplus/base/event/ViaLoadingBaseBuilderCallback.java
similarity index 96%
rename from src/main/java/de/florianmichael/viafabricplus/event/ViaLoadingBaseBuilderCallback.java
rename to src/main/java/de/florianmichael/viafabricplus/base/event/ViaLoadingBaseBuilderCallback.java
index 4a5c7254..2ea0f3df 100644
--- a/src/main/java/de/florianmichael/viafabricplus/event/ViaLoadingBaseBuilderCallback.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/event/ViaLoadingBaseBuilderCallback.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.event;
+package de.florianmichael.viafabricplus.base.event;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import net.fabricmc.fabric.api.event.Event;
diff --git a/src/main/java/de/florianmichael/viafabricplus/information/AbstractInformationGroup.java b/src/main/java/de/florianmichael/viafabricplus/base/information/AbstractInformationGroup.java
similarity index 65%
rename from src/main/java/de/florianmichael/viafabricplus/information/AbstractInformationGroup.java
rename to src/main/java/de/florianmichael/viafabricplus/base/information/AbstractInformationGroup.java
index e20ae95a..d6b2763c 100644
--- a/src/main/java/de/florianmichael/viafabricplus/information/AbstractInformationGroup.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/information/AbstractInformationGroup.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.information;
+package de.florianmichael.viafabricplus.base.information;
import com.viaversion.viaversion.api.connection.UserConnection;
import de.florianmichael.vialoadingbase.model.ProtocolRange;
@@ -31,6 +31,23 @@ public abstract class AbstractInformationGroup {
public abstract void applyInformation(final UserConnection userConnection, final List output);
+ public String format(double a) {
+ return String.format("%.2f", a);
+ }
+
+ public String formatBytes(long value) {
+ if (value < 1024L)
+ return value + " B";
+ else if (value < 1024L * 1024L)
+ return format(((double) value / 1024.0)) + " Kb";
+ else if (value < 1024L * 1024L * 1024L)
+ return format(((double) value / 1024.0 / 1024.0)) + " Mb";
+ else if (value < 1024L * 1024L * 1024L * 1024L)
+ return format(((double) value / 1024.0 / 1024.0 / 1024.0)) + " Gb";
+ else
+ return format(((double) value / 1024.0 / 1024.0 / 1024.0 / 1024.0)) + " Tb";
+ }
+
public ProtocolRange getProtocolRange() {
return protocolRange;
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/information/InformationSystem.java b/src/main/java/de/florianmichael/viafabricplus/base/information/InformationSystem.java
similarity index 92%
rename from src/main/java/de/florianmichael/viafabricplus/information/InformationSystem.java
rename to src/main/java/de/florianmichael/viafabricplus/base/information/InformationSystem.java
index 3c92899f..0240461d 100644
--- a/src/main/java/de/florianmichael/viafabricplus/information/InformationSystem.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/information/InformationSystem.java
@@ -15,9 +15,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.information;
+package de.florianmichael.viafabricplus.base.information;
-import de.florianmichael.viafabricplus.information.impl.*;
+import de.florianmichael.viafabricplus.base.information.impl.*;
import java.util.ArrayList;
import java.util.Collections;
diff --git a/src/main/java/de/florianmichael/viafabricplus/information/impl/BedrockInformation.java b/src/main/java/de/florianmichael/viafabricplus/base/information/impl/BedrockInformation.java
similarity index 94%
rename from src/main/java/de/florianmichael/viafabricplus/information/impl/BedrockInformation.java
rename to src/main/java/de/florianmichael/viafabricplus/base/information/impl/BedrockInformation.java
index 75fe6cef..32ba89dd 100644
--- a/src/main/java/de/florianmichael/viafabricplus/information/impl/BedrockInformation.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/information/impl/BedrockInformation.java
@@ -15,15 +15,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.information.impl;
+package de.florianmichael.viafabricplus.base.information.impl;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import de.florianmichael.viafabricplus.definition.bedrock.storage.JoinGameStorage;
import de.florianmichael.viafabricplus.definition.bedrock.ModelFormats;
-import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
+import de.florianmichael.viafabricplus.base.information.AbstractInformationGroup;
import de.florianmichael.viafabricplus.protocolhack.provider.viabedrock.ViaFabricPlusBlobCacheProvider;
-import de.florianmichael.viafabricplus.util.ScreenUtil;
import de.florianmichael.vialoadingbase.model.ProtocolRange;
import net.lenni0451.reflect.stream.RStream;
import net.lenni0451.reflect.stream.field.FieldStream;
@@ -58,7 +57,7 @@ public class BedrockInformation extends AbstractInformationGroup {
output.add("Blob Cache:");
}
- if (totalSize != 0) output.add("Total size: " + ScreenUtil.formatBytes(totalSize));
+ if (totalSize != 0) output.add("Total size: " + formatBytes(totalSize));
if (blobCount != 0) output.add("Blob count: " + blobCount);
if (pendingCount != 0) output.add("Pending count: " + pendingCount);
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/information/impl/C0_30CPEInformation.java b/src/main/java/de/florianmichael/viafabricplus/base/information/impl/C0_30CPEInformation.java
similarity index 91%
rename from src/main/java/de/florianmichael/viafabricplus/information/impl/C0_30CPEInformation.java
rename to src/main/java/de/florianmichael/viafabricplus/base/information/impl/C0_30CPEInformation.java
index 78618834..93549564 100644
--- a/src/main/java/de/florianmichael/viafabricplus/information/impl/C0_30CPEInformation.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/information/impl/C0_30CPEInformation.java
@@ -15,10 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.information.impl;
+package de.florianmichael.viafabricplus.base.information.impl;
import com.viaversion.viaversion.api.connection.UserConnection;
-import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
+import de.florianmichael.viafabricplus.base.information.AbstractInformationGroup;
import de.florianmichael.vialoadingbase.model.ProtocolRange;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.storage.ExtensionProtocolMetadataStorage;
diff --git a/src/main/java/de/florianmichael/viafabricplus/information/impl/GeneralInformation.java b/src/main/java/de/florianmichael/viafabricplus/base/information/impl/GeneralInformation.java
similarity index 92%
rename from src/main/java/de/florianmichael/viafabricplus/information/impl/GeneralInformation.java
rename to src/main/java/de/florianmichael/viafabricplus/base/information/impl/GeneralInformation.java
index 466092e9..33cbfb4f 100644
--- a/src/main/java/de/florianmichael/viafabricplus/information/impl/GeneralInformation.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/information/impl/GeneralInformation.java
@@ -15,10 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.information.impl;
+package de.florianmichael.viafabricplus.base.information.impl;
import com.viaversion.viaversion.api.connection.UserConnection;
-import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
+import de.florianmichael.viafabricplus.base.information.AbstractInformationGroup;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
diff --git a/src/main/java/de/florianmichael/viafabricplus/information/impl/V1_1Information.java b/src/main/java/de/florianmichael/viafabricplus/base/information/impl/V1_1Information.java
similarity index 91%
rename from src/main/java/de/florianmichael/viafabricplus/information/impl/V1_1Information.java
rename to src/main/java/de/florianmichael/viafabricplus/base/information/impl/V1_1Information.java
index 85bdbaf7..387048e2 100644
--- a/src/main/java/de/florianmichael/viafabricplus/information/impl/V1_1Information.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/information/impl/V1_1Information.java
@@ -15,10 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.information.impl;
+package de.florianmichael.viafabricplus.base.information.impl;
import com.viaversion.viaversion.api.connection.UserConnection;
-import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
+import de.florianmichael.viafabricplus.base.information.AbstractInformationGroup;
import de.florianmichael.vialoadingbase.model.ProtocolRange;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.storage.SeedStorage;
diff --git a/src/main/java/de/florianmichael/viafabricplus/information/impl/V1_2_4_5Information.java b/src/main/java/de/florianmichael/viafabricplus/base/information/impl/V1_2_4_5Information.java
similarity index 91%
rename from src/main/java/de/florianmichael/viafabricplus/information/impl/V1_2_4_5Information.java
rename to src/main/java/de/florianmichael/viafabricplus/base/information/impl/V1_2_4_5Information.java
index 55b326d1..a0bb91fd 100644
--- a/src/main/java/de/florianmichael/viafabricplus/information/impl/V1_2_4_5Information.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/information/impl/V1_2_4_5Information.java
@@ -15,10 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.information.impl;
+package de.florianmichael.viafabricplus.base.information.impl;
import com.viaversion.viaversion.api.connection.UserConnection;
-import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
+import de.florianmichael.viafabricplus.base.information.AbstractInformationGroup;
import de.florianmichael.vialoadingbase.model.ProtocolRange;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.storage.EntityTracker;
diff --git a/src/main/java/de/florianmichael/viafabricplus/information/impl/V1_5_2Information.java b/src/main/java/de/florianmichael/viafabricplus/base/information/impl/V1_5_2Information.java
similarity index 91%
rename from src/main/java/de/florianmichael/viafabricplus/information/impl/V1_5_2Information.java
rename to src/main/java/de/florianmichael/viafabricplus/base/information/impl/V1_5_2Information.java
index 3b825197..fc598e12 100644
--- a/src/main/java/de/florianmichael/viafabricplus/information/impl/V1_5_2Information.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/information/impl/V1_5_2Information.java
@@ -15,10 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.information.impl;
+package de.florianmichael.viafabricplus.base.information.impl;
import com.viaversion.viaversion.api.connection.UserConnection;
-import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
+import de.florianmichael.viafabricplus.base.information.AbstractInformationGroup;
import de.florianmichael.vialoadingbase.model.ProtocolRange;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.storage.EntityTracker;
diff --git a/src/main/java/de/florianmichael/viafabricplus/information/impl/V1_7_10Information.java b/src/main/java/de/florianmichael/viafabricplus/base/information/impl/V1_7_10Information.java
similarity index 91%
rename from src/main/java/de/florianmichael/viafabricplus/information/impl/V1_7_10Information.java
rename to src/main/java/de/florianmichael/viafabricplus/base/information/impl/V1_7_10Information.java
index 8699f147..b7588d02 100644
--- a/src/main/java/de/florianmichael/viafabricplus/information/impl/V1_7_10Information.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/information/impl/V1_7_10Information.java
@@ -15,11 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.information.impl;
+package de.florianmichael.viafabricplus.base.information.impl;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
+import de.florianmichael.viafabricplus.base.information.AbstractInformationGroup;
import de.florianmichael.vialoadingbase.model.ProtocolRange;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.storage.EntityTracker;
diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/base/MappedSlotEntry.java b/src/main/java/de/florianmichael/viafabricplus/base/screen/MappedSlotEntry.java
similarity index 70%
rename from src/main/java/de/florianmichael/viafabricplus/screen/base/MappedSlotEntry.java
rename to src/main/java/de/florianmichael/viafabricplus/base/screen/MappedSlotEntry.java
index 251643a0..11253695 100644
--- a/src/main/java/de/florianmichael/viafabricplus/screen/base/MappedSlotEntry.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/screen/MappedSlotEntry.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.screen.base;
+package de.florianmichael.viafabricplus.base.screen;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
@@ -23,14 +23,23 @@ import net.minecraft.client.util.math.MatrixStack;
public abstract class MappedSlotEntry extends AlwaysSelectedEntryListWidget.Entry {
- public abstract void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta);
+ public abstract void mappedRender(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta);
+ public void mappedMouseClicked(double mouseX, double mouseY, int button) {
+ }
+
+ @Override
+ public boolean mouseClicked(double mouseX, double mouseY, int button) {
+ mappedMouseClicked(mouseX, mouseY, button);
+ VFPScreen.playClickSound();
+ return super.mouseClicked(mouseX, mouseY, button);
+ }
@Override
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
matrices.push();
matrices.translate(x, y, 0);
DrawableHelper.fill(matrices, 0, 0, entryWidth - 4 /* int i = this.left + (this.width - entryWidth) / 2; int j = this.left + (this.width + entryWidth) / 2; */, entryHeight, Integer.MIN_VALUE);
- mappedRenderer(matrices, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta);
+ mappedRender(matrices, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta);
matrices.pop();
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/base/screen/VFPScreen.java b/src/main/java/de/florianmichael/viafabricplus/base/screen/VFPScreen.java
new file mode 100644
index 00000000..0080aef1
--- /dev/null
+++ b/src/main/java/de/florianmichael/viafabricplus/base/screen/VFPScreen.java
@@ -0,0 +1,83 @@
+/*
+ * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
+ * Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.florianmichael.viafabricplus.base.screen;
+
+import com.mojang.blaze3d.systems.RenderSystem;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.screen.NoticeScreen;
+import net.minecraft.client.gui.screen.Screen;
+import net.minecraft.client.gui.widget.ButtonWidget;
+import net.minecraft.client.sound.PositionedSoundInstance;
+import net.minecraft.client.util.math.MatrixStack;
+import net.minecraft.sound.SoundEvents;
+import net.minecraft.text.Text;
+
+import java.awt.*;
+
+public class VFPScreen extends Screen {
+
+ private final boolean backButton;
+ public Screen prevScreen;
+
+ public VFPScreen(String title, boolean backButton) {
+ super(Text.of(title));
+ this.backButton = backButton;
+ }
+
+ public void open(final Screen prevScreen) {
+ this.prevScreen = prevScreen;
+
+ RenderSystem.recordRenderCall(() -> MinecraftClient.getInstance().setScreen(this));
+ }
+
+ @Override
+ protected void init() {
+ if (backButton) {
+ this.addDrawableChild(ButtonWidget.builder(Text.literal("<-"), button -> this.close()).position(5, 5).size(20, 20).build());
+ }
+ }
+
+ @Override
+ public void close() {
+ MinecraftClient.getInstance().setScreen(prevScreen);
+ }
+
+ public void renderTitle(final MatrixStack matrices) {
+ renderTitle(matrices, Text.of("https://github.com/FlorianMichael/ViaFabricPlus"));
+ }
+
+ public void renderTitle(final MatrixStack matrices, final Text subTitle) {
+ matrices.push();
+ matrices.scale(2F, 2F, 2F);
+ drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
+ matrices.pop();
+
+ drawCenteredTextWithShadow(matrices, textRenderer, subTitle, width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
+ }
+
+ public static void playClickSound() {
+ MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F));
+ }
+
+ public void showErrorScreen(final String title, final Throwable throwable) {
+ MinecraftClient.getInstance().execute(() -> MinecraftClient.getInstance().setScreen(new NoticeScreen(() ->
+ RenderSystem.recordRenderCall(() -> MinecraftClient.getInstance().setScreen(this)), Text.of(title),
+ Text.translatable("words.viafabricplus.error").append("\n" + throwable.getMessage()),
+ Text.translatable("words.viafabricplus.cancel"), false)));
+ }
+}
diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/ClassicItemSelectionScreen.java b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/ClassicItemSelectionScreen.java
similarity index 87%
rename from src/main/java/de/florianmichael/viafabricplus/screen/ClassicItemSelectionScreen.java
rename to src/main/java/de/florianmichael/viafabricplus/base/screen/impl/ClassicItemSelectionScreen.java
index 4f21cfa4..b1e30ba7 100644
--- a/src/main/java/de/florianmichael/viafabricplus/screen/ClassicItemSelectionScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/ClassicItemSelectionScreen.java
@@ -15,19 +15,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.screen;
+package de.florianmichael.viafabricplus.base.screen.impl;
-import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback;
+import de.florianmichael.viafabricplus.base.event.ChangeProtocolVersionCallback;
+import de.florianmichael.viafabricplus.base.screen.VFPScreen;
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.screen.Screen;
-import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
-import net.minecraft.sound.SoundEvents;
-import net.minecraft.text.Text;
import net.minecraft.util.math.MathHelper;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
@@ -35,7 +31,7 @@ import java.util.ArrayList;
import java.util.List;
@SuppressWarnings("DataFlowIssue")
-public class ClassicItemSelectionScreen extends Screen {
+public class ClassicItemSelectionScreen extends VFPScreen {
public static ClassicItemSelectionScreen INSTANCE;
@@ -58,7 +54,7 @@ public class ClassicItemSelectionScreen extends Screen {
public ItemStack selectedItem = null;
public ClassicItemSelectionScreen() {
- super(Text.literal("Classic item selection"));
+ super("Classic item selection", false);
}
public void reload(final ComparableProtocolVersion version, final boolean hasCustomBlocksV1) {
@@ -138,13 +134,13 @@ public class ClassicItemSelectionScreen extends Screen {
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (selectedItem != null) {
- this.client.interactionManager.clickCreativeStack(selectedItem, MinecraftClient.getInstance().player.getInventory().selectedSlot + 36); // Beta Inventory Tracker
+ this.client.interactionManager.clickCreativeStack(selectedItem, client.player.getInventory().selectedSlot + 36); // Beta Inventory Tracker
- this.client.player.getInventory().main.set(MinecraftClient.getInstance().player.getInventory().selectedSlot, selectedItem);
+ this.client.player.getInventory().main.set(client.player.getInventory().selectedSlot, selectedItem);
this.client.player.playerScreenHandler.sendContentUpdates();
- this.client.getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F));
-
+ playClickSound();
+
this.close();
}
return super.mouseClicked(mouseX, mouseY, button);
@@ -175,7 +171,7 @@ public class ClassicItemSelectionScreen extends Screen {
fill(matrices, renderX + x, renderY + y, renderX + x + ITEM_XY_BOX_DIMENSION_CLASSIC, renderY + y + ITEM_XY_BOX_DIMENSION_CLASSIC, Integer.MAX_VALUE);
selectedItem = item.getDefaultStack();
}
- MinecraftClient.getInstance().getItemRenderer().renderGuiItemIcon(matrices, item.getDefaultStack(), renderX + x + ITEM_XY_BOX_DIMENSION_MODERN / 4, renderY + y + ITEM_XY_BOX_DIMENSION_MODERN / 4);
+ client.getItemRenderer().renderGuiItemIcon(matrices, item.getDefaultStack(), renderX + x + ITEM_XY_BOX_DIMENSION_MODERN / 4, renderY + y + ITEM_XY_BOX_DIMENSION_MODERN / 4);
x += ITEM_XY_BOX_DIMENSION_CLASSIC;
}
y += ITEM_XY_BOX_DIMENSION_CLASSIC;
diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/ForceVersionScreen.java b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/base/ForceVersionScreen.java
similarity index 77%
rename from src/main/java/de/florianmichael/viafabricplus/screen/ForceVersionScreen.java
rename to src/main/java/de/florianmichael/viafabricplus/base/screen/impl/base/ForceVersionScreen.java
index 16e2bbf0..48089fe2 100644
--- a/src/main/java/de/florianmichael/viafabricplus/screen/ForceVersionScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/base/ForceVersionScreen.java
@@ -15,32 +15,28 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.screen;
+package de.florianmichael.viafabricplus.base.screen.impl.base;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
+import de.florianmichael.viafabricplus.base.screen.VFPScreen;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
-import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.client.util.math.MatrixStack;
-import net.minecraft.sound.SoundEvents;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
-import java.awt.*;
import java.util.function.Consumer;
-@SuppressWarnings({"DataFlowIssue", "DuplicatedCode"})
-public class ForceVersionScreen extends Screen {
- private final Screen prevScreen;
+public class ForceVersionScreen extends VFPScreen {
private final Consumer selectionConsumer;
public ForceVersionScreen(final Screen prevScreen, final Consumer selectionConsumer) {
- super(Text.literal("Force version"));
+ super("Force version", false);
this.prevScreen = prevScreen;
this.selectionConsumer = selectionConsumer;
@@ -58,16 +54,7 @@ public class ForceVersionScreen extends Screen {
this.renderBackground(matrices);
super.render(matrices, mouseX, mouseY, delta);
- matrices.push();
- matrices.scale(2F, 2F, 2F);
- drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
- matrices.pop();
- drawCenteredTextWithShadow(matrices, textRenderer, Text.translatable("forceversion.viafabricplus.title"), width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
- }
-
- @Override
- public void close() {
- client.setScreen(prevScreen);
+ this.renderTitle(matrices, Text.translatable("forceversion.viafabricplus.title"));
}
public class SlotList extends AlwaysSelectedEntryListWidget {
@@ -94,9 +81,10 @@ public class ForceVersionScreen extends Screen {
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
- ForceVersionScreen.this.selectionConsumer.accept(null);
- MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F));
- ForceVersionScreen.this.close();
+ selectionConsumer.accept(null);
+ playClickSound();
+ close();
+
return super.mouseClicked(mouseX, mouseY, button);
}
@@ -121,9 +109,10 @@ public class ForceVersionScreen extends Screen {
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
- ForceVersionScreen.this.selectionConsumer.accept(ViaLoadingBase.fromProtocolVersion(protocolVersion));
- MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F));
- ForceVersionScreen.this.close();
+ selectionConsumer.accept(ViaLoadingBase.fromProtocolVersion(protocolVersion));
+ playClickSound();
+ close();
+
return super.mouseClicked(mouseX, mouseY, button);
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/ProtocolSelectionScreen.java b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/base/ProtocolSelectionScreen.java
similarity index 66%
rename from src/main/java/de/florianmichael/viafabricplus/screen/ProtocolSelectionScreen.java
rename to src/main/java/de/florianmichael/viafabricplus/base/screen/impl/base/ProtocolSelectionScreen.java
index 877134b5..d70912a9 100644
--- a/src/main/java/de/florianmichael/viafabricplus/screen/ProtocolSelectionScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/base/ProtocolSelectionScreen.java
@@ -15,23 +15,21 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.screen;
+package de.florianmichael.viafabricplus.base.screen.impl.base;
-import com.mojang.blaze3d.systems.RenderSystem;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import de.florianmichael.classic4j.BetaCraftHandler;
import de.florianmichael.classic4j.model.classicube.highlevel.CCAccount;
import de.florianmichael.viafabricplus.definition.c0_30.ClassiCubeAccountHandler;
-import de.florianmichael.viafabricplus.screen.classicube.ClassiCubeLoginScreen;
-import de.florianmichael.viafabricplus.screen.classicube.ClassiCubeServerListScreen;
-import de.florianmichael.viafabricplus.screen.settings.SettingsScreen;
+import de.florianmichael.viafabricplus.base.screen.VFPScreen;
+import de.florianmichael.viafabricplus.base.screen.impl.thirdparty.classicube.ClassiCubeLoginScreen;
+import de.florianmichael.viafabricplus.base.screen.impl.thirdparty.classicube.ClassiCubeServerListScreen;
+import de.florianmichael.viafabricplus.base.screen.impl.thirdparty.BetaCraftScreen;
+import de.florianmichael.viafabricplus.base.screen.impl.settings.SettingsScreen;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
-import de.florianmichael.viafabricplus.util.ScreenUtil;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
-import net.minecraft.client.gui.screen.NoticeScreen;
-import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.tooltip.Tooltip;
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
import net.minecraft.client.gui.widget.ButtonWidget;
@@ -40,73 +38,70 @@ import net.minecraft.text.Text;
import java.awt.*;
-@SuppressWarnings({"DataFlowIssue", "DuplicatedCode"})
-public class ProtocolSelectionScreen extends Screen {
- private final static ProtocolSelectionScreen INSTANCE = new ProtocolSelectionScreen();
- public Screen prevScreen;
+public class ProtocolSelectionScreen extends VFPScreen {
+ public final static ProtocolSelectionScreen INSTANCE = new ProtocolSelectionScreen();
+
+ private ButtonWidget betaCraftButton;
protected ProtocolSelectionScreen() {
- super(Text.literal("Protocol selection"));
- }
-
- public static void open(final Screen current) {
- INSTANCE.prevScreen = current;
-
- RenderSystem.recordRenderCall(() -> MinecraftClient.getInstance().setScreen(INSTANCE));
+ super("Protocol selection", true);
}
@Override
protected void init() {
- super.init();
-
+ // List and Settings
this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, height - 30, textRenderer.fontHeight + 4));
- this.addDrawableChild(ButtonWidget.builder(Text.literal("<-"), button -> this.close()).position(5, 5).size(20, 20).build());
+ this.addDrawableChild(ButtonWidget.builder(Text.translatable("words.viafabricplus.settings"), button -> SettingsScreen.INSTANCE.open(this)).position(width - 98 - 5, 5).size(98, 20).build());
+
+ // ClassiCube
- this.addDrawableChild(ButtonWidget.builder(Text.translatable("words.viafabricplus.settings"), button -> client.setScreen(SettingsScreen.get(this))).position(width - 98 - 5, 5).size(98, 20).build());
final CCAccount classiCubeAccount = ClassiCubeAccountHandler.INSTANCE.getAccount();
ButtonWidget.Builder classiCubeBuilder = ButtonWidget.builder(Text.literal("ClassiCube"), button -> {
if (classiCubeAccount == null || classiCubeAccount.token == null) {
- client.setScreen(ClassiCubeLoginScreen.get(this));
+ ClassiCubeLoginScreen.INSTANCE.open(prevScreen);
return;
}
- client.setScreen(ClassiCubeServerListScreen.get(this));
+ ClassiCubeServerListScreen.INSTANCE.open(prevScreen);
}).position(width - 98 - 5, height - 25).size(98, 20);
if (classiCubeAccount == null || classiCubeAccount.token == null) {
classiCubeBuilder = classiCubeBuilder.tooltip(Tooltip.of(Text.translatable("classicube.viafabricplus.warning")));
}
this.addDrawableChild(classiCubeBuilder.build());
+
+ // BetaCraft
+
ButtonWidget.Builder betaCraftBuilder = ButtonWidget.builder(Text.literal("BetaCraft"), button -> {
if (BetaCraftScreen.SERVER_LIST == null) {
- BetaCraftHandler.requestServerList(bcServerList -> {
- BetaCraftScreen.SERVER_LIST = bcServerList;
+ betaCraftButton = button;
- RenderSystem.recordRenderCall(() -> client.setScreen(BetaCraftScreen.get(this)));
- }, throwable -> MinecraftClient.getInstance().execute(() -> MinecraftClient.getInstance().setScreen(new NoticeScreen(() -> RenderSystem.recordRenderCall(() -> client.setScreen(this)), Text.literal("Betacraft"), Text.translatable("betacraft.viafabricplus.error").append("\n" + throwable.getMessage()), Text.translatable("words.viafabricplus.cancel"), false))));
- } else client.setScreen(BetaCraftScreen.get(this));
+ BetaCraftHandler.requestServerList(serverList -> {
+ BetaCraftScreen.SERVER_LIST = serverList;
- button.setMessage(Text.literal("BetaCraft"));
+ BetaCraftScreen.INSTANCE.open(this);
+ }, throwable -> showErrorScreen("BetaCraft", throwable));
+
+ } else {
+ BetaCraftScreen.INSTANCE.open(this);
+ }
}).position(5, height - 25).size(98, 20);
if (BetaCraftScreen.SERVER_LIST == null) {
betaCraftBuilder = betaCraftBuilder.tooltip(Tooltip.of(Text.translatable("betacraft.viafabricplus.warning")));
}
this.addDrawableChild(betaCraftBuilder.build());
+
+ super.init();
+ }
+
+ @Override
+ public void tick() {
+ if (betaCraftButton != null) betaCraftButton.setMessage(Text.of("Loading..."));
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
this.renderBackground(matrices);
super.render(matrices, mouseX, mouseY, delta);
-
- matrices.push();
- matrices.scale(2F, 2F, 2F);
- drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
- matrices.pop();
- drawCenteredTextWithShadow(matrices, textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
- }
-
- @Override
- public void close() {
- client.setScreen(prevScreen);
+ this.renderTitle(matrices);
}
public static class SlotList extends AlwaysSelectedEntryListWidget {
@@ -133,7 +128,7 @@ public class ProtocolSelectionScreen extends Screen {
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
ViaLoadingBase.getInstance().reload(this.protocolVersion);
- ScreenUtil.playClickSound();
+ playClickSound();
return super.mouseClicked(mouseX, mouseY, button);
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/settings/SettingsScreen.java b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/SettingsScreen.java
similarity index 62%
rename from src/main/java/de/florianmichael/viafabricplus/screen/settings/SettingsScreen.java
rename to src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/SettingsScreen.java
index e8111c2f..a4187a95 100644
--- a/src/main/java/de/florianmichael/viafabricplus/screen/settings/SettingsScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/SettingsScreen.java
@@ -15,42 +15,30 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.screen.settings;
+package de.florianmichael.viafabricplus.base.screen.impl.settings;
import de.florianmichael.viafabricplus.ViaFabricPlus;
-import de.florianmichael.viafabricplus.screen.base.MappedSlotEntry;
-import de.florianmichael.viafabricplus.screen.settings.settingrenderer.meta.TitleRenderer;
-import de.florianmichael.viafabricplus.settings.base.AbstractSetting;
-import de.florianmichael.viafabricplus.settings.base.SettingGroup;
+import de.florianmichael.viafabricplus.base.screen.MappedSlotEntry;
+import de.florianmichael.viafabricplus.base.screen.VFPScreen;
+import de.florianmichael.viafabricplus.base.screen.impl.settings.settingrenderer.meta.TitleRenderer;
+import de.florianmichael.viafabricplus.base.settings.base.AbstractSetting;
+import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
-import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
-import net.minecraft.text.Text;
-import java.awt.*;
-
-@SuppressWarnings({"DataFlowIssue", "DuplicatedCode"})
-public class SettingsScreen extends Screen {
+public class SettingsScreen extends VFPScreen {
public final static SettingsScreen INSTANCE = new SettingsScreen();
- public Screen prevScreen;
- protected SettingsScreen() {
- super(Text.literal("Setting"));
- }
-
- public static SettingsScreen get(final Screen prevScreen) {
- SettingsScreen.INSTANCE.prevScreen = prevScreen;
- return SettingsScreen.INSTANCE;
+ public SettingsScreen() {
+ super("Setting", true);
}
@Override
protected void init() {
- super.init();
-
this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, height + 5, (textRenderer.fontHeight + 2) * 2));
- this.addDrawableChild(ButtonWidget.builder(Text.literal("<-"), button -> this.close()).position(5, 5).size(20, 20).build());
+
+ super.init();
}
@Override
@@ -58,16 +46,7 @@ public class SettingsScreen extends Screen {
this.renderBackground(matrices);
super.render(matrices, mouseX, mouseY, delta);
- matrices.push();
- matrices.scale(2F, 2F, 2F);
- drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
- matrices.pop();
- drawCenteredTextWithShadow(matrices, textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
- }
-
- @Override
- public void close() {
- client.setScreen(prevScreen);
+ this.renderTitle(matrices);
}
public static class SlotList extends AlwaysSelectedEntryListWidget {
diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/settings/settingrenderer/BooleanSettingRenderer.java b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/settingrenderer/BooleanSettingRenderer.java
similarity index 76%
rename from src/main/java/de/florianmichael/viafabricplus/screen/settings/settingrenderer/BooleanSettingRenderer.java
rename to src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/settingrenderer/BooleanSettingRenderer.java
index 2ed6a0bd..41956623 100644
--- a/src/main/java/de/florianmichael/viafabricplus/screen/settings/settingrenderer/BooleanSettingRenderer.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/settingrenderer/BooleanSettingRenderer.java
@@ -15,11 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.screen.settings.settingrenderer;
+package de.florianmichael.viafabricplus.base.screen.impl.settings.settingrenderer;
-import de.florianmichael.viafabricplus.screen.base.MappedSlotEntry;
-import de.florianmichael.viafabricplus.settings.type_impl.BooleanSetting;
-import de.florianmichael.viafabricplus.util.ScreenUtil;
+import de.florianmichael.viafabricplus.base.screen.MappedSlotEntry;
+import de.florianmichael.viafabricplus.base.settings.type_impl.BooleanSetting;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.util.math.MatrixStack;
@@ -41,14 +40,12 @@ public class BooleanSettingRenderer extends MappedSlotEntry {
}
@Override
- public boolean mouseClicked(double mouseX, double mouseY, int button) {
+ public void mappedMouseClicked(double mouseX, double mouseY, int button) {
this.value.setValue(!this.value.getValue());
- ScreenUtil.playClickSound();
- return super.mouseClicked(mouseX, mouseY, button);
}
@Override
- public void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
+ public void mappedRender(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
final Text text = this.value.getValue() ? Text.translatable("words.viafabricplus.on") : Text.translatable("words.viafabricplus.off");
diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/settings/settingrenderer/ButtonSettingRenderer.java b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/settingrenderer/ButtonSettingRenderer.java
similarity index 73%
rename from src/main/java/de/florianmichael/viafabricplus/screen/settings/settingrenderer/ButtonSettingRenderer.java
rename to src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/settingrenderer/ButtonSettingRenderer.java
index 74fd18eb..9d72b78b 100644
--- a/src/main/java/de/florianmichael/viafabricplus/screen/settings/settingrenderer/ButtonSettingRenderer.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/settingrenderer/ButtonSettingRenderer.java
@@ -15,11 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.screen.settings.settingrenderer;
+package de.florianmichael.viafabricplus.base.screen.impl.settings.settingrenderer;
-import de.florianmichael.viafabricplus.screen.base.MappedSlotEntry;
-import de.florianmichael.viafabricplus.settings.type_impl.ButtonSetting;
-import de.florianmichael.viafabricplus.util.ScreenUtil;
+import de.florianmichael.viafabricplus.base.screen.MappedSlotEntry;
+import de.florianmichael.viafabricplus.base.settings.type_impl.ButtonSetting;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawableHelper;
@@ -39,14 +38,12 @@ public class ButtonSettingRenderer extends MappedSlotEntry {
}
@Override
- public boolean mouseClicked(double mouseX, double mouseY, int button) {
+ public void mappedMouseClicked(double mouseX, double mouseY, int button) {
this.value.getValue().run();
- ScreenUtil.playClickSound();
- return super.mouseClicked(mouseX, mouseY, button);
}
@Override
- public void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
+ public void mappedRender(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
DrawableHelper.drawCenteredTextWithShadow(matrices, textRenderer, this.value.displayValue(), entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/settings/settingrenderer/ModeSettingRenderer.java b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/settingrenderer/ModeSettingRenderer.java
similarity index 76%
rename from src/main/java/de/florianmichael/viafabricplus/screen/settings/settingrenderer/ModeSettingRenderer.java
rename to src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/settingrenderer/ModeSettingRenderer.java
index e6d39656..42658c86 100644
--- a/src/main/java/de/florianmichael/viafabricplus/screen/settings/settingrenderer/ModeSettingRenderer.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/settingrenderer/ModeSettingRenderer.java
@@ -15,11 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.screen.settings.settingrenderer;
+package de.florianmichael.viafabricplus.base.screen.impl.settings.settingrenderer;
-import de.florianmichael.viafabricplus.screen.base.MappedSlotEntry;
-import de.florianmichael.viafabricplus.settings.type_impl.ModeSetting;
-import de.florianmichael.viafabricplus.util.ScreenUtil;
+import de.florianmichael.viafabricplus.base.screen.MappedSlotEntry;
+import de.florianmichael.viafabricplus.base.settings.type_impl.ModeSetting;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.util.math.MatrixStack;
@@ -41,15 +40,13 @@ public class ModeSettingRenderer extends MappedSlotEntry {
}
@Override
- public boolean mouseClicked(double mouseX, double mouseY, int button) {
+ public void mappedMouseClicked(double mouseX, double mouseY, int button) {
final int currentIndex = Arrays.stream(this.value.getOptions()).toList().indexOf(this.value.value) + 1;
this.value.setValue(currentIndex > this.value.getOptions().length - 1 ? 0 : currentIndex);
- ScreenUtil.playClickSound();
- return super.mouseClicked(mouseX, mouseY, button);
}
@Override
- public void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
+ public void mappedRender(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
textRenderer.drawWithShadow(matrices, this.value.getName().formatted(Formatting.GRAY), 3, entryHeight / 2F - textRenderer.fontHeight / 2F, -1);
diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/settings/settingrenderer/ProtocolSyncBooleanSettingRenderer.java b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/settingrenderer/ProtocolSyncBooleanSettingRenderer.java
similarity index 77%
rename from src/main/java/de/florianmichael/viafabricplus/screen/settings/settingrenderer/ProtocolSyncBooleanSettingRenderer.java
rename to src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/settingrenderer/ProtocolSyncBooleanSettingRenderer.java
index fc161234..e9d8407f 100644
--- a/src/main/java/de/florianmichael/viafabricplus/screen/settings/settingrenderer/ProtocolSyncBooleanSettingRenderer.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/settingrenderer/ProtocolSyncBooleanSettingRenderer.java
@@ -15,12 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.screen.settings.settingrenderer;
+package de.florianmichael.viafabricplus.base.screen.impl.settings.settingrenderer;
-import de.florianmichael.viafabricplus.screen.base.MappedSlotEntry;
-import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
-import de.florianmichael.viafabricplus.settings.type_impl.ProtocolSyncBooleanSetting;
-import de.florianmichael.viafabricplus.util.ScreenUtil;
+import de.florianmichael.viafabricplus.base.screen.MappedSlotEntry;
+import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
+import de.florianmichael.viafabricplus.base.settings.type_impl.ProtocolSyncBooleanSetting;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.util.math.MatrixStack;
@@ -42,14 +41,12 @@ public class ProtocolSyncBooleanSettingRenderer extends MappedSlotEntry {
}
@Override
- public boolean mouseClicked(double mouseX, double mouseY, int button) {
+ public void mappedMouseClicked(double mouseX, double mouseY, int button) {
this.value.setValue(!this.value.getValue());
- ScreenUtil.playClickSound();
- return super.mouseClicked(mouseX, mouseY, button);
}
@Override
- public void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
+ public void mappedRender(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
final Text text = this.value.getValue() ? Text.translatable("words.viafabricplus.on") : Text.translatable("words.viafabricplus.off");
diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/settings/settingrenderer/meta/TitleRenderer.java b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/settingrenderer/meta/TitleRenderer.java
similarity index 80%
rename from src/main/java/de/florianmichael/viafabricplus/screen/settings/settingrenderer/meta/TitleRenderer.java
rename to src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/settingrenderer/meta/TitleRenderer.java
index 3dec89a4..9305217b 100644
--- a/src/main/java/de/florianmichael/viafabricplus/screen/settings/settingrenderer/meta/TitleRenderer.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/settings/settingrenderer/meta/TitleRenderer.java
@@ -15,9 +15,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.screen.settings.settingrenderer.meta;
+package de.florianmichael.viafabricplus.base.screen.impl.settings.settingrenderer.meta;
-import de.florianmichael.viafabricplus.screen.base.MappedSlotEntry;
+import de.florianmichael.viafabricplus.base.screen.MappedSlotEntry;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.util.math.MatrixStack;
@@ -40,12 +40,12 @@ public class TitleRenderer extends MappedSlotEntry {
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
matrices.push();
matrices.translate(x, y, 0);
- mappedRenderer(matrices, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta);
+ mappedRender(matrices, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta);
matrices.pop();
}
@Override
- public void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
+ public void mappedRender(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
textRenderer.drawWithShadow(matrices, Formatting.BOLD + this.name, 3, entryHeight / 2F - textRenderer.fontHeight / 2F, -1);
diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/BetaCraftScreen.java b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/thirdparty/BetaCraftScreen.java
similarity index 74%
rename from src/main/java/de/florianmichael/viafabricplus/screen/BetaCraftScreen.java
rename to src/main/java/de/florianmichael/viafabricplus/base/screen/impl/thirdparty/BetaCraftScreen.java
index 8b4bf1c1..6ab1df95 100644
--- a/src/main/java/de/florianmichael/viafabricplus/screen/BetaCraftScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/thirdparty/BetaCraftScreen.java
@@ -15,19 +15,18 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.screen;
+package de.florianmichael.viafabricplus.base.screen.impl.thirdparty;
import de.florianmichael.classic4j.model.betacraft.BCServerInfo;
import de.florianmichael.classic4j.model.betacraft.BCServerList;
import de.florianmichael.classic4j.model.betacraft.BCVersion;
import de.florianmichael.viafabricplus.definition.v1_14_4.LegacyServerAddress;
-import de.florianmichael.viafabricplus.screen.base.MappedSlotEntry;
-import de.florianmichael.viafabricplus.screen.settings.settingrenderer.meta.TitleRenderer;
-import de.florianmichael.viafabricplus.util.ScreenUtil;
+import de.florianmichael.viafabricplus.base.screen.MappedSlotEntry;
+import de.florianmichael.viafabricplus.base.screen.VFPScreen;
+import de.florianmichael.viafabricplus.base.screen.impl.settings.settingrenderer.meta.TitleRenderer;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.screen.ConnectScreen;
-import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.network.ServerAddress;
@@ -36,34 +35,26 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
-import java.awt.*;
import java.util.List;
-public class BetaCraftScreen extends Screen {
+public class BetaCraftScreen extends VFPScreen {
public static BCServerList SERVER_LIST;
public final static BetaCraftScreen INSTANCE = new BetaCraftScreen();
- public Screen prevScreen;
protected BetaCraftScreen() {
- super(Text.literal("BetaCraft"));
- }
-
- public static BetaCraftScreen get(final Screen prevScreen) {
- BetaCraftScreen.INSTANCE.prevScreen = prevScreen;
- return BetaCraftScreen.INSTANCE;
+ super("BetaCraft", true);
}
@Override
protected void init() {
- super.init();
-
this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, height + 5, (textRenderer.fontHeight + 2) * 3));
- this.addDrawableChild(ButtonWidget.builder(Text.literal("<-"), button -> this.close()).position(5, 5).size(20, 20).build());
this.addDrawableChild(ButtonWidget.builder(Text.translatable("words.viafabricplus.reset"), button -> {
- client.setScreen(prevScreen);
SERVER_LIST = null;
+ client.setScreen(prevScreen);
}).position(width - 98 - 5, 5).size(98, 20).build());
+
+ super.init();
}
@Override
@@ -71,19 +62,10 @@ public class BetaCraftScreen extends Screen {
this.renderBackground(matrices);
super.render(matrices, mouseX, mouseY, delta);
- matrices.push();
- matrices.scale(2F, 2F, 2F);
- drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
- matrices.pop();
- drawCenteredTextWithShadow(matrices, textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
+ this.renderTitle(matrices);
}
- @Override
- public void close() {
- client.setScreen(prevScreen);
- }
-
- public static class SlotList extends AlwaysSelectedEntryListWidget {
+ public class SlotList extends AlwaysSelectedEntryListWidget {
public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) {
super(minecraftClient, width, height, top, bottom, entryHeight);
@@ -122,17 +104,16 @@ public class BetaCraftScreen extends Screen {
}
@Override
- public boolean mouseClicked(double mouseX, double mouseY, int button) {
+ public void mappedMouseClicked(double mouseX, double mouseY, int button) {
final ServerAddress serverAddress = LegacyServerAddress.parse(null, server.host() + ":" + server.port());
final ServerInfo entry = new ServerInfo(server.name(), serverAddress.getAddress(), false);
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry);
- ScreenUtil.playClickSound();
- return super.mouseClicked(mouseX, mouseY, button);
+ playClickSound();
}
@Override
- public void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
+ public void mappedRender(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
drawCenteredTextWithShadow(matrices, textRenderer, server.name() + Formatting.DARK_GRAY + " [" + server.gameVersion() + "]", entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/classicube/ClassiCubeLoginScreen.java b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/thirdparty/classicube/ClassiCubeLoginScreen.java
similarity index 83%
rename from src/main/java/de/florianmichael/viafabricplus/screen/classicube/ClassiCubeLoginScreen.java
rename to src/main/java/de/florianmichael/viafabricplus/base/screen/impl/thirdparty/classicube/ClassiCubeLoginScreen.java
index 6c747b06..b471e35a 100644
--- a/src/main/java/de/florianmichael/viafabricplus/screen/classicube/ClassiCubeLoginScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/thirdparty/classicube/ClassiCubeLoginScreen.java
@@ -15,33 +15,34 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.screen.classicube;
+package de.florianmichael.viafabricplus.base.screen.impl.thirdparty.classicube;
import com.mojang.blaze3d.systems.RenderSystem;
import de.florianmichael.classic4j.ClassiCubeHandler;
import de.florianmichael.classic4j.api.LoginProcessHandler;
import de.florianmichael.classic4j.model.classicube.highlevel.CCAccount;
+import de.florianmichael.viafabricplus.base.screen.impl.base.ProtocolSelectionScreen;
import de.florianmichael.viafabricplus.definition.c0_30.ClassiCubeAccountHandler;
-import de.florianmichael.viafabricplus.integration.Classic4JImpl;
-import net.minecraft.client.MinecraftClient;
+import de.florianmichael.viafabricplus.base.screen.VFPScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
-public class ClassiCubeLoginScreen extends Screen {
+public class ClassiCubeLoginScreen extends VFPScreen {
public final static ClassiCubeLoginScreen INSTANCE = new ClassiCubeLoginScreen();
public Screen prevScreen;
public ClassiCubeLoginScreen() {
- super(Text.literal("ClassiCube Login"));
+ super("ClassiCube Login", false);
}
- public static ClassiCubeLoginScreen get(final Screen prevScreen) {
- ClassiCubeLoginScreen.INSTANCE.prevScreen = prevScreen;
- ClassiCubeLoginScreen.INSTANCE.status = Text.translatable("classicube.viafabricplus.account");
- return ClassiCubeLoginScreen.INSTANCE;
+ @Override
+ public void open(Screen prevScreen) {
+ status = Text.translatable("classicube.viafabricplus.account");
+
+ super.open(prevScreen);
}
private TextFieldWidget nameField;
@@ -76,12 +77,12 @@ public class ClassiCubeLoginScreen extends Screen {
ClassiCubeHandler.requestAuthentication(ClassiCubeAccountHandler.INSTANCE.getAccount(), null, new LoginProcessHandler() {
@Override
public void handleMfa(CCAccount account) {
- RenderSystem.recordRenderCall(() -> MinecraftClient.getInstance().setScreen(ClassiCubeMFAScreen.get(prevScreen)));
+ ClassiCubeMFAScreen.INSTANCE.open(prevScreen);
}
@Override
public void handleSuccessfulLogin(CCAccount account) {
- RenderSystem.recordRenderCall(() -> ClassiCubeServerListScreen.open(MinecraftClient.getInstance().currentScreen, this));
+ RenderSystem.recordRenderCall(() -> ClassiCubeServerListScreen.open(prevScreen, this));
}
@Override
@@ -103,7 +104,7 @@ public class ClassiCubeLoginScreen extends Screen {
@Override
public void close() {
- this.client.setScreen(this.prevScreen);
+ ProtocolSelectionScreen.INSTANCE.open(prevScreen);
}
@Override
diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/classicube/ClassiCubeMFAScreen.java b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/thirdparty/classicube/ClassiCubeMFAScreen.java
similarity index 83%
rename from src/main/java/de/florianmichael/viafabricplus/screen/classicube/ClassiCubeMFAScreen.java
rename to src/main/java/de/florianmichael/viafabricplus/base/screen/impl/thirdparty/classicube/ClassiCubeMFAScreen.java
index 35188281..9fdf8454 100644
--- a/src/main/java/de/florianmichael/viafabricplus/screen/classicube/ClassiCubeMFAScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/thirdparty/classicube/ClassiCubeMFAScreen.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.screen.classicube;
+package de.florianmichael.viafabricplus.base.screen.impl.thirdparty.classicube;
import com.mojang.blaze3d.systems.RenderSystem;
import de.florianmichael.classic4j.ClassiCubeHandler;
@@ -24,8 +24,8 @@ import de.florianmichael.classic4j.model.classicube.highlevel.CCAccount;
import de.florianmichael.classic4j.model.classicube.highlevel.CCError;
import de.florianmichael.viafabricplus.definition.c0_30.ClassiCubeAccountHandler;
import de.florianmichael.viafabricplus.integration.Classic4JImpl;
-import de.florianmichael.viafabricplus.screen.ProtocolSelectionScreen;
-import net.minecraft.client.MinecraftClient;
+import de.florianmichael.viafabricplus.base.screen.VFPScreen;
+import de.florianmichael.viafabricplus.base.screen.impl.base.ProtocolSelectionScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
@@ -34,19 +34,17 @@ import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
-public class ClassiCubeMFAScreen extends Screen {
+public class ClassiCubeMFAScreen extends VFPScreen {
public final static ClassiCubeMFAScreen INSTANCE = new ClassiCubeMFAScreen();
- public Screen prevScreen;
public ClassiCubeMFAScreen() {
- super(Text.literal("ClassiCube MFA"));
+ super("ClassiCube MFA", true);
}
- public static ClassiCubeMFAScreen get(final Screen prevScreen) {
- ClassiCubeMFAScreen.INSTANCE.prevScreen = prevScreen;
- ClassiCubeMFAScreen.INSTANCE.status = Classic4JImpl.fromError(CCError.LOGIN_CODE);
-
- return ClassiCubeMFAScreen.INSTANCE;
+ @Override
+ public void open(Screen prevScreen) {
+ status = Classic4JImpl.fromError(CCError.LOGIN_CODE);
+ super.open(prevScreen);
}
private TextFieldWidget mfaField;
@@ -73,7 +71,7 @@ public class ClassiCubeMFAScreen extends Screen {
@Override
public void handleSuccessfulLogin(CCAccount account) {
- RenderSystem.recordRenderCall(() -> ClassiCubeServerListScreen.open(MinecraftClient.getInstance().currentScreen, this));
+ RenderSystem.recordRenderCall(() -> ClassiCubeServerListScreen.open(prevScreen, this));
}
@Override
@@ -93,7 +91,7 @@ public class ClassiCubeMFAScreen extends Screen {
@Override
public void close() {
- ProtocolSelectionScreen.open(new MultiplayerScreen(new TitleScreen()));
+ ProtocolSelectionScreen.INSTANCE.open(prevScreen);
}
@Override
diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/classicube/ClassiCubeServerListScreen.java b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/thirdparty/classicube/ClassiCubeServerListScreen.java
similarity index 69%
rename from src/main/java/de/florianmichael/viafabricplus/screen/classicube/ClassiCubeServerListScreen.java
rename to src/main/java/de/florianmichael/viafabricplus/base/screen/impl/thirdparty/classicube/ClassiCubeServerListScreen.java
index 85d9ebbf..06d15870 100644
--- a/src/main/java/de/florianmichael/viafabricplus/screen/classicube/ClassiCubeServerListScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/screen/impl/thirdparty/classicube/ClassiCubeServerListScreen.java
@@ -15,27 +15,25 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.screen.classicube;
+package de.florianmichael.viafabricplus.base.screen.impl.thirdparty.classicube;
import com.mojang.blaze3d.systems.RenderSystem;
import de.florianmichael.classic4j.ClassiCubeHandler;
import de.florianmichael.classic4j.api.LoginProcessHandler;
import de.florianmichael.classic4j.model.classicube.CCServerInfo;
+import de.florianmichael.classic4j.model.classicube.highlevel.CCAccount;
import de.florianmichael.viafabricplus.definition.c0_30.ClassiCubeAccountHandler;
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
-import de.florianmichael.viafabricplus.integration.Classic4JImpl;
import de.florianmichael.viafabricplus.protocolhack.provider.vialegacy.ViaFabricPlusClassicMPPassProvider;
-import de.florianmichael.viafabricplus.screen.ProtocolSelectionScreen;
-import de.florianmichael.viafabricplus.screen.base.MappedSlotEntry;
-import de.florianmichael.viafabricplus.settings.groups.AuthenticationSettings;
-import de.florianmichael.viafabricplus.util.ScreenUtil;
+import de.florianmichael.viafabricplus.base.screen.VFPScreen;
+import de.florianmichael.viafabricplus.base.screen.impl.base.ProtocolSelectionScreen;
+import de.florianmichael.viafabricplus.base.screen.MappedSlotEntry;
+import de.florianmichael.viafabricplus.base.settings.groups.AuthenticationSettings;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.screen.ConnectScreen;
import net.minecraft.client.gui.screen.Screen;
-import net.minecraft.client.gui.screen.TitleScreen;
-import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.network.ServerAddress;
@@ -45,48 +43,40 @@ import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
-import java.awt.*;
import java.util.ArrayList;
import java.util.List;
-public class ClassiCubeServerListScreen extends Screen {
- public final static List SERVERS = new ArrayList<>();
- private final static ClassiCubeServerListScreen INSTANCE = new ClassiCubeServerListScreen();
- public Screen prevScreen;
-
- public static ClassiCubeServerListScreen get(final Screen prevScreen) {
- ClassiCubeServerListScreen.INSTANCE.prevScreen = prevScreen;
- return ClassiCubeServerListScreen.INSTANCE;
- }
+public class ClassiCubeServerListScreen extends VFPScreen {
+ public final static List SERVER_LIST = new ArrayList<>();
+ public final static ClassiCubeServerListScreen INSTANCE = new ClassiCubeServerListScreen();
public static void open(final Screen prevScreen, final LoginProcessHandler loginProcessHandler) {
ClassiCubeHandler.requestServerList(ClassiCubeAccountHandler.INSTANCE.getAccount(), ccServerList -> {
- ClassiCubeServerListScreen.SERVERS.addAll(ccServerList.servers());
- RenderSystem.recordRenderCall(() -> MinecraftClient.getInstance().setScreen(ClassiCubeServerListScreen.get(prevScreen)));
+ ClassiCubeServerListScreen.SERVER_LIST.addAll(ccServerList.servers());
+ RenderSystem.recordRenderCall(() -> ClassiCubeServerListScreen.INSTANCE.open(prevScreen));
}, loginProcessHandler::handleException);
}
public ClassiCubeServerListScreen() {
- super(Text.literal("ClassiCube ServerList"));
+ super("ClassiCube ServerList", true);
}
@Override
protected void init() {
- super.init();
-
this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, height + 5, (textRenderer.fontHeight + 4) * 3));
- this.addDrawableChild(ButtonWidget.builder(Text.literal("<-"), button -> this.close()).position(5, 5).size(20, 20).build());
this.addDrawableChild(ButtonWidget.builder(Text.translatable("words.viafabricplus.logout"), button -> {
- client.setScreen(prevScreen);
+ close();
ClassiCubeAccountHandler.INSTANCE.setAccount(null);
- SERVERS.clear();
+ SERVER_LIST.clear();
}).position(width - 98 - 5, 5).size(98, 20).build());
+
+ super.init();
}
@Override
public void close() {
- ProtocolSelectionScreen.open(new MultiplayerScreen(new TitleScreen()));
+ ProtocolSelectionScreen.INSTANCE.open(prevScreen);
}
@Override
@@ -94,11 +84,10 @@ public class ClassiCubeServerListScreen extends Screen {
this.renderBackground(matrices);
super.render(matrices, mouseX, mouseY, delta);
- matrices.push();
- matrices.scale(2F, 2F, 2F);
- drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
- matrices.pop();
- drawCenteredTextWithShadow(matrices, textRenderer, Text.literal("ClassiCube Profile: " + ClassiCubeAccountHandler.INSTANCE.getAccount().username()), width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
+ final CCAccount account = ClassiCubeAccountHandler.INSTANCE.getAccount();
+ if (account == null) return;
+
+ this.renderTitle(matrices, Text.of("ClassiCube Profile: " + account.username()));
}
public static class SlotList extends AlwaysSelectedEntryListWidget {
@@ -106,7 +95,7 @@ public class ClassiCubeServerListScreen extends Screen {
public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) {
super(minecraftClient, width, height, top, bottom, entryHeight);
- SERVERS.forEach(serverInfo -> this.addEntry(new ServerSlot(serverInfo)));
+ SERVER_LIST.forEach(serverInfo -> this.addEntry(new ServerSlot(serverInfo)));
}
@Override
@@ -134,7 +123,7 @@ public class ClassiCubeServerListScreen extends Screen {
}
@Override
- public boolean mouseClicked(double mouseX, double mouseY, int button) {
+ public void mappedMouseClicked(double mouseX, double mouseY, int button) {
final ServerAddress serverAddress = ServerAddress.parse(classiCubeServerInfo.ip() + ":" + classiCubeServerInfo.port());
final ServerInfo entry = new ServerInfo(classiCubeServerInfo.name(), serverAddress.getAddress(), false);
ViaFabricPlusClassicMPPassProvider.classiCubeMPPass = classiCubeServerInfo.mpPass();
@@ -144,12 +133,10 @@ public class ClassiCubeServerListScreen extends Screen {
}
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry);
- ScreenUtil.playClickSound();
- return super.mouseClicked(mouseX, mouseY, button);
}
@Override
- public void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
+ public void mappedRender(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
drawCenteredTextWithShadow(matrices, textRenderer, classiCubeServerInfo.name(), entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/SettingsSystem.java b/src/main/java/de/florianmichael/viafabricplus/base/settings/SettingsSystem.java
similarity index 86%
rename from src/main/java/de/florianmichael/viafabricplus/settings/SettingsSystem.java
rename to src/main/java/de/florianmichael/viafabricplus/base/settings/SettingsSystem.java
index 19575054..25700722 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/SettingsSystem.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/settings/SettingsSystem.java
@@ -15,14 +15,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.settings;
+package de.florianmichael.viafabricplus.base.settings;
import com.google.gson.JsonObject;
-import de.florianmichael.viafabricplus.event.InitializeSettingsCallback;
-import de.florianmichael.viafabricplus.settings.base.AbstractSetting;
-import de.florianmichael.viafabricplus.settings.base.SettingGroup;
-import de.florianmichael.viafabricplus.settings.groups.*;
-import de.florianmichael.viafabricplus.util.FileSaver;
+import de.florianmichael.viafabricplus.base.event.InitializeSettingsCallback;
+import de.florianmichael.viafabricplus.base.settings.base.AbstractSetting;
+import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
+import de.florianmichael.viafabricplus.base.settings.groups.*;
+import de.florianmichael.viafabricplus.base.FileSaver;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import java.util.ArrayList;
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/base/AbstractSetting.java b/src/main/java/de/florianmichael/viafabricplus/base/settings/base/AbstractSetting.java
similarity index 86%
rename from src/main/java/de/florianmichael/viafabricplus/settings/base/AbstractSetting.java
rename to src/main/java/de/florianmichael/viafabricplus/base/settings/base/AbstractSetting.java
index c9be5df5..e07cd8a9 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/base/AbstractSetting.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/settings/base/AbstractSetting.java
@@ -15,11 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.settings.base;
+package de.florianmichael.viafabricplus.base.settings.base;
import com.google.gson.JsonObject;
-import de.florianmichael.viafabricplus.screen.base.MappedSlotEntry;
-import de.florianmichael.viafabricplus.settings.ConfigRemapper;
+import de.florianmichael.viafabricplus.base.screen.MappedSlotEntry;
import net.minecraft.text.MutableText;
import net.minecraft.text.TranslatableTextContent;
@@ -48,7 +47,7 @@ public abstract class AbstractSetting {
}
public String getTranslationKey() {
- return ConfigRemapper.remapp(((TranslatableTextContent) name.getContent()).getKey());
+ return ((TranslatableTextContent) name.getContent()).getKey();
}
public T getDefaultValue() {
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/base/SettingGroup.java b/src/main/java/de/florianmichael/viafabricplus/base/settings/base/SettingGroup.java
similarity index 95%
rename from src/main/java/de/florianmichael/viafabricplus/settings/base/SettingGroup.java
rename to src/main/java/de/florianmichael/viafabricplus/base/settings/base/SettingGroup.java
index 3347789b..39eccd24 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/base/SettingGroup.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/settings/base/SettingGroup.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.settings.base;
+package de.florianmichael.viafabricplus.base.settings.base;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/groups/AuthenticationSettings.java b/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/AuthenticationSettings.java
similarity index 88%
rename from src/main/java/de/florianmichael/viafabricplus/settings/groups/AuthenticationSettings.java
rename to src/main/java/de/florianmichael/viafabricplus/base/settings/groups/AuthenticationSettings.java
index a0b4559d..b8ccf19d 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/groups/AuthenticationSettings.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/AuthenticationSettings.java
@@ -15,14 +15,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.settings.groups;
+package de.florianmichael.viafabricplus.base.settings.groups;
import de.florianmichael.viafabricplus.definition.bedrock.BedrockAccountHandler;
-import de.florianmichael.viafabricplus.screen.ProtocolSelectionScreen;
-import de.florianmichael.viafabricplus.screen.settings.SettingsScreen;
-import de.florianmichael.viafabricplus.settings.base.SettingGroup;
-import de.florianmichael.viafabricplus.settings.type_impl.BooleanSetting;
-import de.florianmichael.viafabricplus.settings.type_impl.ButtonSetting;
+import de.florianmichael.viafabricplus.base.screen.impl.base.ProtocolSelectionScreen;
+import de.florianmichael.viafabricplus.base.screen.impl.settings.SettingsScreen;
+import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
+import de.florianmichael.viafabricplus.base.settings.type_impl.BooleanSetting;
+import de.florianmichael.viafabricplus.base.settings.type_impl.ButtonSetting;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ConfirmScreen;
import net.minecraft.client.gui.screen.NoticeScreen;
@@ -54,7 +54,7 @@ public class AuthenticationSettings extends SettingGroup {
if (consumer) {
MinecraftClient.getInstance().keyboard.setClipboard(msaDeviceCode.userCode());
} else {
- MinecraftClient.getInstance().setScreen(SettingsScreen.get(new MultiplayerScreen(new TitleScreen())));
+ SettingsScreen.INSTANCE.open(new MultiplayerScreen(new TitleScreen()));
Thread.currentThread().interrupt();
}
}, Text.literal("Microsoft Bedrock login"), Text.translatable("bedrocklogin.viafabricplus.text", msaDeviceCode.userCode()), Text.translatable("words.viafabricplus.copy"), Text.translatable("words.viafabricplus.cancel"))));
@@ -66,7 +66,7 @@ public class AuthenticationSettings extends SettingGroup {
}
})));
}
- ProtocolSelectionScreen.open(new MultiplayerScreen(new TitleScreen()));
+ ProtocolSelectionScreen.INSTANCE.open(new MultiplayerScreen(new TitleScreen()));
} catch (Throwable e) {
e.printStackTrace();
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/groups/DebugSettings.java b/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/DebugSettings.java
similarity index 94%
rename from src/main/java/de/florianmichael/viafabricplus/settings/groups/DebugSettings.java
rename to src/main/java/de/florianmichael/viafabricplus/base/settings/groups/DebugSettings.java
index a45dc3e7..c6dc78e0 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/groups/DebugSettings.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/DebugSettings.java
@@ -15,11 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.settings.groups;
+package de.florianmichael.viafabricplus.base.settings.groups;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import de.florianmichael.viafabricplus.settings.base.SettingGroup;
-import de.florianmichael.viafabricplus.settings.type_impl.ProtocolSyncBooleanSetting;
+import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
+import de.florianmichael.viafabricplus.base.settings.type_impl.ProtocolSyncBooleanSetting;
import de.florianmichael.vialoadingbase.model.ProtocolRange;
import net.minecraft.text.Text;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/groups/ExperimentalSettings.java b/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/ExperimentalSettings.java
similarity index 87%
rename from src/main/java/de/florianmichael/viafabricplus/settings/groups/ExperimentalSettings.java
rename to src/main/java/de/florianmichael/viafabricplus/base/settings/groups/ExperimentalSettings.java
index 40c9824b..c0356636 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/groups/ExperimentalSettings.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/ExperimentalSettings.java
@@ -15,10 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.settings.groups;
+package de.florianmichael.viafabricplus.base.settings.groups;
-import de.florianmichael.viafabricplus.settings.base.SettingGroup;
-import de.florianmichael.viafabricplus.settings.type_impl.BooleanSetting;
+import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
+import de.florianmichael.viafabricplus.base.settings.type_impl.BooleanSetting;
import net.minecraft.text.Text;
public class ExperimentalSettings extends SettingGroup {
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/groups/GeneralSettings.java b/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/GeneralSettings.java
similarity index 89%
rename from src/main/java/de/florianmichael/viafabricplus/settings/groups/GeneralSettings.java
rename to src/main/java/de/florianmichael/viafabricplus/base/settings/groups/GeneralSettings.java
index f68435fd..171d1aac 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/groups/GeneralSettings.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/GeneralSettings.java
@@ -15,11 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.settings.groups;
+package de.florianmichael.viafabricplus.base.settings.groups;
-import de.florianmichael.viafabricplus.settings.base.SettingGroup;
-import de.florianmichael.viafabricplus.settings.type_impl.BooleanSetting;
-import de.florianmichael.viafabricplus.settings.type_impl.ModeSetting;
+import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
+import de.florianmichael.viafabricplus.base.settings.type_impl.BooleanSetting;
+import de.florianmichael.viafabricplus.base.settings.type_impl.ModeSetting;
import net.minecraft.text.Text;
public class GeneralSettings extends SettingGroup {
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/groups/VisualSettings.java b/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/VisualSettings.java
similarity index 94%
rename from src/main/java/de/florianmichael/viafabricplus/settings/groups/VisualSettings.java
rename to src/main/java/de/florianmichael/viafabricplus/base/settings/groups/VisualSettings.java
index c5964ee9..8980ffa9 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/groups/VisualSettings.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/VisualSettings.java
@@ -15,11 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.settings.groups;
+package de.florianmichael.viafabricplus.base.settings.groups;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import de.florianmichael.viafabricplus.settings.base.SettingGroup;
-import de.florianmichael.viafabricplus.settings.type_impl.ProtocolSyncBooleanSetting;
+import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
+import de.florianmichael.viafabricplus.base.settings.type_impl.ProtocolSyncBooleanSetting;
import de.florianmichael.vialoadingbase.model.ProtocolRange;
import net.minecraft.text.Text;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/type_impl/BooleanSetting.java b/src/main/java/de/florianmichael/viafabricplus/base/settings/type_impl/BooleanSetting.java
similarity index 80%
rename from src/main/java/de/florianmichael/viafabricplus/settings/type_impl/BooleanSetting.java
rename to src/main/java/de/florianmichael/viafabricplus/base/settings/type_impl/BooleanSetting.java
index 0f3672c2..d075368f 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/type_impl/BooleanSetting.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/settings/type_impl/BooleanSetting.java
@@ -15,13 +15,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.settings.type_impl;
+package de.florianmichael.viafabricplus.base.settings.type_impl;
import com.google.gson.JsonObject;
-import de.florianmichael.viafabricplus.screen.base.MappedSlotEntry;
-import de.florianmichael.viafabricplus.screen.settings.settingrenderer.BooleanSettingRenderer;
-import de.florianmichael.viafabricplus.settings.base.AbstractSetting;
-import de.florianmichael.viafabricplus.settings.base.SettingGroup;
+import de.florianmichael.viafabricplus.base.screen.MappedSlotEntry;
+import de.florianmichael.viafabricplus.base.screen.impl.settings.settingrenderer.BooleanSettingRenderer;
+import de.florianmichael.viafabricplus.base.settings.base.AbstractSetting;
+import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
import net.minecraft.text.MutableText;
public class BooleanSetting extends AbstractSetting {
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/type_impl/ButtonSetting.java b/src/main/java/de/florianmichael/viafabricplus/base/settings/type_impl/ButtonSetting.java
similarity index 78%
rename from src/main/java/de/florianmichael/viafabricplus/settings/type_impl/ButtonSetting.java
rename to src/main/java/de/florianmichael/viafabricplus/base/settings/type_impl/ButtonSetting.java
index 629d9fef..333ebb46 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/type_impl/ButtonSetting.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/settings/type_impl/ButtonSetting.java
@@ -15,13 +15,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.settings.type_impl;
+package de.florianmichael.viafabricplus.base.settings.type_impl;
import com.google.gson.JsonObject;
-import de.florianmichael.viafabricplus.screen.base.MappedSlotEntry;
-import de.florianmichael.viafabricplus.screen.settings.settingrenderer.ButtonSettingRenderer;
-import de.florianmichael.viafabricplus.settings.base.AbstractSetting;
-import de.florianmichael.viafabricplus.settings.base.SettingGroup;
+import de.florianmichael.viafabricplus.base.screen.MappedSlotEntry;
+import de.florianmichael.viafabricplus.base.screen.impl.settings.settingrenderer.ButtonSettingRenderer;
+import de.florianmichael.viafabricplus.base.settings.base.AbstractSetting;
+import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
import net.minecraft.text.MutableText;
public class ButtonSetting extends AbstractSetting {
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/type_impl/ModeSetting.java b/src/main/java/de/florianmichael/viafabricplus/base/settings/type_impl/ModeSetting.java
similarity index 83%
rename from src/main/java/de/florianmichael/viafabricplus/settings/type_impl/ModeSetting.java
rename to src/main/java/de/florianmichael/viafabricplus/base/settings/type_impl/ModeSetting.java
index 9166e231..403359d0 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/type_impl/ModeSetting.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/settings/type_impl/ModeSetting.java
@@ -15,13 +15,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.settings.type_impl;
+package de.florianmichael.viafabricplus.base.settings.type_impl;
import com.google.gson.JsonObject;
-import de.florianmichael.viafabricplus.screen.base.MappedSlotEntry;
-import de.florianmichael.viafabricplus.screen.settings.settingrenderer.ModeSettingRenderer;
-import de.florianmichael.viafabricplus.settings.base.AbstractSetting;
-import de.florianmichael.viafabricplus.settings.base.SettingGroup;
+import de.florianmichael.viafabricplus.base.screen.MappedSlotEntry;
+import de.florianmichael.viafabricplus.base.screen.impl.settings.settingrenderer.ModeSettingRenderer;
+import de.florianmichael.viafabricplus.base.settings.base.AbstractSetting;
+import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
import net.minecraft.text.MutableText;
import java.util.Arrays;
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/type_impl/ProtocolSyncBooleanSetting.java b/src/main/java/de/florianmichael/viafabricplus/base/settings/type_impl/ProtocolSyncBooleanSetting.java
similarity index 84%
rename from src/main/java/de/florianmichael/viafabricplus/settings/type_impl/ProtocolSyncBooleanSetting.java
rename to src/main/java/de/florianmichael/viafabricplus/base/settings/type_impl/ProtocolSyncBooleanSetting.java
index ae874a41..c5d7f8dc 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/type_impl/ProtocolSyncBooleanSetting.java
+++ b/src/main/java/de/florianmichael/viafabricplus/base/settings/type_impl/ProtocolSyncBooleanSetting.java
@@ -15,13 +15,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.settings.type_impl;
+package de.florianmichael.viafabricplus.base.settings.type_impl;
import com.google.gson.JsonObject;
-import de.florianmichael.viafabricplus.screen.base.MappedSlotEntry;
-import de.florianmichael.viafabricplus.screen.settings.settingrenderer.ProtocolSyncBooleanSettingRenderer;
-import de.florianmichael.viafabricplus.settings.base.SettingGroup;
-import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
+import de.florianmichael.viafabricplus.base.screen.MappedSlotEntry;
+import de.florianmichael.viafabricplus.base.screen.impl.settings.settingrenderer.ProtocolSyncBooleanSettingRenderer;
+import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
+import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import de.florianmichael.vialoadingbase.model.ProtocolRange;
import net.minecraft.text.MutableText;
diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/ChatLengthCalculation.java b/src/main/java/de/florianmichael/viafabricplus/definition/ChatLengthCalculation.java
index 4cd4ff35..97ebcba5 100644
--- a/src/main/java/de/florianmichael/viafabricplus/definition/ChatLengthCalculation.java
+++ b/src/main/java/de/florianmichael/viafabricplus/definition/ChatLengthCalculation.java
@@ -18,8 +18,8 @@
package de.florianmichael.viafabricplus.definition;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback;
-import de.florianmichael.viafabricplus.event.LoadClassicProtocolExtensionCallback;
+import de.florianmichael.viafabricplus.base.event.ChangeProtocolVersionCallback;
+import de.florianmichael.viafabricplus.base.event.LoadClassicProtocolExtensionCallback;
import net.minecraft.client.MinecraftClient;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.data.ClassicProtocolExtension;
diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/bedrock/BedrockAccountHandler.java b/src/main/java/de/florianmichael/viafabricplus/definition/bedrock/BedrockAccountHandler.java
index 4e26e1b3..95592ce5 100644
--- a/src/main/java/de/florianmichael/viafabricplus/definition/bedrock/BedrockAccountHandler.java
+++ b/src/main/java/de/florianmichael/viafabricplus/definition/bedrock/BedrockAccountHandler.java
@@ -19,8 +19,8 @@ package de.florianmichael.viafabricplus.definition.bedrock;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-import de.florianmichael.viafabricplus.util.FileSaver;
-import de.florianmichael.viafabricplus.util.ScreenUtil;
+import de.florianmichael.viafabricplus.ViaFabricPlus;
+import de.florianmichael.viafabricplus.base.FileSaver;
import net.raphimc.mcauth.MinecraftAuth;
import net.raphimc.mcauth.step.bedrock.StepMCChain;
import net.raphimc.mcauth.util.MicrosoftConstants;
@@ -59,7 +59,7 @@ public class BedrockAccountHandler extends FileSaver {
account = MinecraftAuth.BEDROCK_DEVICE_CODE_LOGIN.refresh(httpClient, account);
}
} catch (Exception e) {
- ScreenUtil.crash("Failed to log into Bedrock account!", e);
+ ViaFabricPlus.LOGGER.warn("No Bedrock account could be found");
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/ClassiCubeAccountHandler.java b/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/ClassiCubeAccountHandler.java
index b214e78b..8d6b5cd5 100644
--- a/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/ClassiCubeAccountHandler.java
+++ b/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/ClassiCubeAccountHandler.java
@@ -20,10 +20,10 @@ package de.florianmichael.viafabricplus.definition.c0_30;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import de.florianmichael.classic4j.model.classicube.highlevel.CCAccount;
-import de.florianmichael.viafabricplus.event.DisconnectConnectionCallback;
+import de.florianmichael.viafabricplus.ViaFabricPlus;
+import de.florianmichael.viafabricplus.base.event.DisconnectConnectionCallback;
import de.florianmichael.viafabricplus.protocolhack.provider.vialegacy.ViaFabricPlusClassicMPPassProvider;
-import de.florianmichael.viafabricplus.util.FileSaver;
-import de.florianmichael.viafabricplus.util.ScreenUtil;
+import de.florianmichael.viafabricplus.base.FileSaver;
import java.util.Map;
@@ -58,7 +58,7 @@ public class ClassiCubeAccountHandler extends FileSaver {
try {
account = CCAccount.fromJson(object);
} catch (Exception e) {
- ScreenUtil.crash("Failed to log into ClassiCube account!", e);
+ ViaFabricPlus.LOGGER.warn("No ClassiCube account could be found");
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/protocol/CustomClassicProtocolExtensions.java b/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/protocol/CustomClassicProtocolExtensions.java
index 493b3252..d9d05685 100644
--- a/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/protocol/CustomClassicProtocolExtensions.java
+++ b/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/protocol/CustomClassicProtocolExtensions.java
@@ -18,8 +18,8 @@
package de.florianmichael.viafabricplus.definition.c0_30.protocol;
import com.viaversion.viaversion.api.connection.UserConnection;
-import de.florianmichael.viafabricplus.screen.ClassicItemSelectionScreen;
-import de.florianmichael.viafabricplus.event.LoadClassicProtocolExtensionCallback;
+import de.florianmichael.viafabricplus.base.screen.impl.ClassicItemSelectionScreen;
+import de.florianmichael.viafabricplus.base.event.LoadClassicProtocolExtensionCallback;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import io.netty.buffer.ByteBuf;
import net.lenni0451.reflect.Enums;
diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/v1_12_2/FontCacheFix.java b/src/main/java/de/florianmichael/viafabricplus/definition/v1_12_2/FontCacheFix.java
index 71eba79f..8210a1c0 100644
--- a/src/main/java/de/florianmichael/viafabricplus/definition/v1_12_2/FontCacheFix.java
+++ b/src/main/java/de/florianmichael/viafabricplus/definition/v1_12_2/FontCacheFix.java
@@ -19,10 +19,9 @@ package de.florianmichael.viafabricplus.definition.v1_12_2;
import com.mojang.blaze3d.systems.RenderSystem;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback;
+import de.florianmichael.viafabricplus.base.event.ChangeProtocolVersionCallback;
import de.florianmichael.viafabricplus.injection.access.IFontStorage;
-import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
-import de.florianmichael.viafabricplus.settings.groups.ExperimentalSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.ExperimentalSettings;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
import net.fabricmc.loader.api.FabricLoader;
diff --git a/src/main/java/de/florianmichael/viafabricplus/mappings/ArmorPointsMappings.java b/src/main/java/de/florianmichael/viafabricplus/definition/v1_8/ArmorPointCalculation.java
similarity index 93%
rename from src/main/java/de/florianmichael/viafabricplus/mappings/ArmorPointsMappings.java
rename to src/main/java/de/florianmichael/viafabricplus/definition/v1_8/ArmorPointCalculation.java
index cad51884..562a0564 100644
--- a/src/main/java/de/florianmichael/viafabricplus/mappings/ArmorPointsMappings.java
+++ b/src/main/java/de/florianmichael/viafabricplus/definition/v1_8/ArmorPointCalculation.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.mappings;
+package de.florianmichael.viafabricplus.definition.v1_8;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ArmorType;
import net.minecraft.client.MinecraftClient;
@@ -29,7 +29,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-public class ArmorPointsMappings {
+public class ArmorPointCalculation {
public final static List- ARMOR_ITEMS_IN_1_8 = Arrays.asList(
Items.LEATHER_HELMET,
Items.LEATHER_CHESTPLATE,
@@ -66,6 +66,6 @@ public class ArmorPointsMappings {
}
public static int sum() {
- return MinecraftClient.getInstance().player.getInventory().armor.stream().mapToInt(ArmorPointsMappings::getArmorPoints).sum();
+ return MinecraftClient.getInstance().player.getInventory().armor.stream().mapToInt(ArmorPointCalculation::getArmorPoints).sum();
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinAddServerScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinAddServerScreen.java
index e2f46155..c9518503 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinAddServerScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinAddServerScreen.java
@@ -18,7 +18,7 @@
package de.florianmichael.viafabricplus.injection.mixin.base;
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
-import de.florianmichael.viafabricplus.screen.ForceVersionScreen;
+import de.florianmichael.viafabricplus.base.screen.impl.base.ForceVersionScreen;
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
import net.minecraft.client.gui.screen.AddServerScreen;
import net.minecraft.client.gui.screen.Screen;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection.java
index 672055b8..dd8be508 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection.java
@@ -17,8 +17,8 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.base;
-import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback;
-import de.florianmichael.viafabricplus.event.DisconnectConnectionCallback;
+import de.florianmichael.viafabricplus.base.event.ChangeProtocolVersionCallback;
+import de.florianmichael.viafabricplus.base.event.DisconnectConnectionCallback;
import de.florianmichael.viafabricplus.injection.access.IClientConnection;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import de.florianmichael.viafabricplus.protocolhack.netty.ViaFabricPlusVLBPipeline;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinConnectScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinConnectScreen.java
index b496d714..debbd8aa 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinConnectScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinConnectScreen.java
@@ -18,7 +18,7 @@
package de.florianmichael.viafabricplus.injection.mixin.base;
import de.florianmichael.viafabricplus.definition.c0_30.ClassicProgressRenderer;
-import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
import net.minecraft.client.gui.screen.ConnectScreen;
import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinConnectScreen_1.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinConnectScreen_1.java
index 56819ed8..6c6b53dc 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinConnectScreen_1.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinConnectScreen_1.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.base;
-import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback;
+import de.florianmichael.viafabricplus.base.event.ChangeProtocolVersionCallback;
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinDebugHud.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinDebugHud.java
index 012bc991..9d900128 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinDebugHud.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinDebugHud.java
@@ -19,12 +19,12 @@ package de.florianmichael.viafabricplus.injection.mixin.base;
import com.viaversion.viaversion.api.connection.UserConnection;
import de.florianmichael.viafabricplus.ViaFabricPlus;
-import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
+import de.florianmichael.viafabricplus.base.information.AbstractInformationGroup;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
-import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
-import de.florianmichael.viafabricplus.util.ScreenUtil;
+import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.DebugHud;
+import net.minecraft.util.Formatting;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -45,7 +45,7 @@ public class MixinDebugHud {
final UserConnection userConnection = MinecraftClient.getInstance().getNetworkHandler().getConnection().channel.attr(ProtocolHack.LOCAL_VIA_CONNECTION).get();
information.add("");
- information.add(ScreenUtil.prefixedMessage("").trim());
+ information.add(Formatting.GOLD + "[ViaFabricPlus] " + Formatting.WHITE);
for (AbstractInformationGroup group : ViaFabricPlus.INSTANCE.getInformationSystem().getGroups()) {
if (group.getProtocolRange() != null && !group.getProtocolRange().contains(ProtocolHack.getTargetVersion())) continue;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinDownloadingTerrainScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinDownloadingTerrainScreen.java
index 2b220ffa..c54920dc 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinDownloadingTerrainScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinDownloadingTerrainScreen.java
@@ -18,7 +18,7 @@
package de.florianmichael.viafabricplus.injection.mixin.base;
import de.florianmichael.viafabricplus.definition.c0_30.ClassicProgressRenderer;
-import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinMinecraftClient.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinMinecraftClient.java
index 2714974e..11db9efe 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinMinecraftClient.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinMinecraftClient.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.base;
-import de.florianmichael.viafabricplus.event.FinishMinecraftLoadCallback;
+import de.florianmichael.viafabricplus.base.event.FinishMinecraftLoadCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.RunArgs;
import org.spongepowered.asm.mixin.Mixin;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinMultiplayerScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinMultiplayerScreen.java
index 079656f3..e8997c1b 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinMultiplayerScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinMultiplayerScreen.java
@@ -19,8 +19,8 @@ package de.florianmichael.viafabricplus.injection.mixin.base;
import de.florianmichael.viafabricplus.definition.v1_14_4.LegacyServerAddress;
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
-import de.florianmichael.viafabricplus.screen.ProtocolSelectionScreen;
-import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
+import de.florianmichael.viafabricplus.base.screen.impl.base.ProtocolSelectionScreen;
+import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
@@ -43,7 +43,7 @@ public class MixinMultiplayerScreen extends Screen {
@Inject(method = "init", at = @At("RETURN"))
public void addProtocolSelectionButton(CallbackInfo ci) {
- ButtonWidget.Builder builder = ButtonWidget.builder(Text.literal("ViaFabricPlus"), button -> ProtocolSelectionScreen.open(this));
+ ButtonWidget.Builder builder = ButtonWidget.builder(Text.literal("ViaFabricPlus"), button -> ProtocolSelectionScreen.INSTANCE.open(this));
final int orientation = GeneralSettings.INSTANCE.mainButtonOrientation.getIndex();
switch (orientation) {
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinOptionsScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinOptionsScreen.java
index 2f72dd34..13bd449e 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinOptionsScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinOptionsScreen.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.base;
-import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.option.OptionsScreen;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinSharedConstants.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinSharedConstants.java
index 8abd7fa9..126c6769 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinSharedConstants.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinSharedConstants.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.base;
-import de.florianmichael.viafabricplus.screen.classicube.ClassiCubeLoginScreen;
+import de.florianmichael.viafabricplus.base.screen.impl.thirdparty.classicube.ClassiCubeLoginScreen;
import net.minecraft.SharedConstants;
import net.minecraft.client.MinecraftClient;
import org.spongepowered.asm.mixin.Mixin;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinBipedEntityModel.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinBipedEntityModel.java
index 1f07bed6..3a8b89e9 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinBipedEntityModel.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinBipedEntityModel.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
-import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.LivingEntity;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinCamera.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinCamera.java
index 1f9f6998..551237ec 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinCamera.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinCamera.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
-import de.florianmichael.viafabricplus.settings.groups.DebugSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings;
import net.minecraft.client.render.Camera;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayNetworkHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayNetworkHandler.java
index bf3e6d75..cebb162e 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayNetworkHandler.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayNetworkHandler.java
@@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
import com.mojang.authlib.GameProfile;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import de.florianmichael.viafabricplus.ViaFabricPlus;
-import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinInGameHud.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinInGameHud.java
index 3a184fad..8765a516 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinInGameHud.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinInGameHud.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
-import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.JumpingMount;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinItemRenderer.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinItemRenderer.java
index f3b67a85..ec7c23e9 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinItemRenderer.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinItemRenderer.java
@@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
-import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.item.ItemModels;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java
index 3fd4f149..90d7a6b9 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java
@@ -24,7 +24,7 @@ import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.Protocol1_12To1_
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
import de.florianmichael.viafabricplus.injection.access.IMinecraftClient;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
-import de.florianmichael.viafabricplus.settings.groups.DebugSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayNetworkHandler;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinPendingUpdateManager.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinPendingUpdateManager.java
index 33c7bcf7..67876d15 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinPendingUpdateManager.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinPendingUpdateManager.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
-import de.florianmichael.viafabricplus.settings.groups.DebugSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings;
import net.minecraft.client.network.PendingUpdateManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAbstractBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAbstractBlock.java
index e03006cf..aa71a032 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAbstractBlock.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAbstractBlock.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
-import de.florianmichael.viafabricplus.settings.groups.DebugSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java
index 9b37083c..cd0ff138 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java
@@ -19,11 +19,11 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
import com.mojang.authlib.GameProfile;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import de.florianmichael.viafabricplus.mappings.ArmorPointsMappings;
-import de.florianmichael.viafabricplus.event.SkipIdlePacketCallback;
+import de.florianmichael.viafabricplus.definition.v1_8.ArmorPointCalculation;
+import de.florianmichael.viafabricplus.base.event.SkipIdlePacketCallback;
import de.florianmichael.viafabricplus.injection.access.IClientPlayerEntity;
-import de.florianmichael.viafabricplus.settings.groups.DebugSettings;
-import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.input.Input;
@@ -221,7 +221,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
@Override
public int getArmor() {
if (VisualSettings.INSTANCE.emulateArmorHud.getValue()) {
- return ArmorPointsMappings.sum();
+ return ArmorPointCalculation.sum();
}
return super.getArmor();
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinLivingEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinLivingEntity.java
index eb0260b4..f879e985 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinLivingEntity.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinLivingEntity.java
@@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
-import de.florianmichael.viafabricplus.settings.groups.ExperimentalSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.ExperimentalSettings;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.EquipmentSlot;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java
index cf1092aa..22037d4f 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java
@@ -18,7 +18,7 @@
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityPose;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/input/MixinKeyboard.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/input/MixinKeyboard.java
index 8595ec32..daa0e3cb 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/input/MixinKeyboard.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/input/MixinKeyboard.java
@@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.input;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import de.florianmichael.viafabricplus.injection.access.IMinecraftClient;
-import de.florianmichael.viafabricplus.settings.groups.DebugSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import net.minecraft.client.Keyboard;
import net.minecraft.client.MinecraftClient;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/input/MixinMouse.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/input/MixinMouse.java
index 7dc31574..5cfe1919 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/input/MixinMouse.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/input/MixinMouse.java
@@ -18,7 +18,7 @@
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.input;
import de.florianmichael.viafabricplus.injection.access.IMinecraftClient;
-import de.florianmichael.viafabricplus.settings.groups.DebugSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.Mouse;
import org.spongepowered.asm.mixin.Mixin;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemCooldownManager.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemCooldownManager.java
index 7d2a3806..9486f686 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemCooldownManager.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemCooldownManager.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
-import de.florianmichael.viafabricplus.settings.groups.DebugSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings;
import net.minecraft.entity.player.ItemCooldownManager;
import net.minecraft.item.Item;
import org.spongepowered.asm.mixin.Mixin;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemGroup_EntriesImpl.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemGroup_EntriesImpl.java
index bfbaff6a..5e19293e 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemGroup_EntriesImpl.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemGroup_EntriesImpl.java
@@ -18,7 +18,7 @@
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
import de.florianmichael.viafabricplus.mappings.ItemReleaseVersionMappings;
-import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
import net.minecraft.client.MinecraftClient;
import net.minecraft.item.Item;
import net.minecraft.resource.featuretoggle.FeatureSet;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemGroups.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemGroups.java
index f9229ae0..351f9d7d 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemGroups.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemGroups.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
-import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
import net.minecraft.item.ItemGroup;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemStack.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemStack.java
index 9ac85f57..7f841b12 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemStack.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemStack.java
@@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import de.florianmichael.viafabricplus.settings.groups.DebugSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import net.minecraft.block.BlockState;
import net.minecraft.entity.attribute.EntityAttribute;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinChatHud.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinChatHud.java
index 3c7cc926..e6be6fe1 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinChatHud.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinChatHud.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen;
-import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
import net.minecraft.client.gui.hud.ChatHud;
import net.minecraft.client.gui.hud.ChatHudLine;
import net.minecraft.client.gui.hud.MessageIndicator;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinChatScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinChatScreen.java
index 6b6e0038..8ab90be4 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinChatScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinChatScreen.java
@@ -18,7 +18,7 @@
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen;
import de.florianmichael.viafabricplus.definition.ChatLengthCalculation;
-import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
import net.minecraft.client.gui.hud.ChatHud;
import net.minecraft.client.gui.hud.MessageIndicator;
import net.minecraft.client.gui.screen.ChatScreen;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinCommandBlockScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinCommandBlockScreen.java
index aafac833..c057b1d1 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinCommandBlockScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinCommandBlockScreen.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen;
-import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
import net.minecraft.block.entity.CommandBlockBlockEntity;
import net.minecraft.client.gui.screen.ingame.CommandBlockScreen;
import net.minecraft.client.gui.widget.CyclingButtonWidget;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinConnectScreen_1.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinConnectScreen_1.java
index eeddc3db..bd08d0b5 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinConnectScreen_1.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinConnectScreen_1.java
@@ -28,7 +28,7 @@ import de.florianmichael.viafabricplus.definition.v1_19_0.storage.ChatSession1_1
import de.florianmichael.viafabricplus.definition.v1_19_2.storage.ChatSession1_19_2;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import de.florianmichael.viafabricplus.protocolhack.provider.vialegacy.ViaFabricPlusClassicMPPassProvider;
-import de.florianmichael.viafabricplus.settings.groups.AuthenticationSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.AuthenticationSettings;
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ConnectScreen;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinCreativeInventoryScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinCreativeInventoryScreen.java
index 4cdf75d5..a7789b89 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinCreativeInventoryScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinCreativeInventoryScreen.java
@@ -17,8 +17,8 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen;
-import de.florianmichael.viafabricplus.screen.ClassicItemSelectionScreen;
-import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
+import de.florianmichael.viafabricplus.base.screen.impl.ClassicItemSelectionScreen;
+import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
import org.spongepowered.asm.mixin.Mixin;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinJigsawBlockScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinJigsawBlockScreen.java
index e65068aa..8cdeff89 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinJigsawBlockScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinJigsawBlockScreen.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen;
-import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
import net.minecraft.block.entity.JigsawBlockEntity;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.JigsawBlockScreen;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/merchant/MixinMerchantScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/merchant/MixinMerchantScreen.java
index 7f9b3d8a..cc9067e0 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/merchant/MixinMerchantScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/merchant/MixinMerchantScreen.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen.merchant;
-import de.florianmichael.viafabricplus.settings.groups.DebugSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.screen.ingame.MerchantScreen;
import net.minecraft.entity.player.PlayerInventory;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/sodium/MixinChunkTracker.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/sodium/MixinChunkTracker.java
index 3927991d..d25594a4 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/sodium/MixinChunkTracker.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/sodium/MixinChunkTracker.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.sodium;
-import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialegacy/MixinExtensionProtocolMetadataStorage.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialegacy/MixinExtensionProtocolMetadataStorage.java
index 00d8da6a..97c174b2 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialegacy/MixinExtensionProtocolMetadataStorage.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialegacy/MixinExtensionProtocolMetadataStorage.java
@@ -18,7 +18,7 @@
package de.florianmichael.viafabricplus.injection.mixin.fixes.vialegacy;
import de.florianmichael.viafabricplus.injection.access.IExtensionProtocolMetadataStorage;
-import de.florianmichael.viafabricplus.event.LoadClassicProtocolExtensionCallback;
+import de.florianmichael.viafabricplus.base.event.LoadClassicProtocolExtensionCallback;
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.data.ClassicProtocolExtension;
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.storage.ExtensionProtocolMetadataStorage;
import org.spongepowered.asm.mixin.Final;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialegacy/MixinViaLegacyConfig.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialegacy/MixinViaLegacyConfig.java
index 7aa8181a..b6e925e6 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialegacy/MixinViaLegacyConfig.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialegacy/MixinViaLegacyConfig.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.vialegacy;
-import de.florianmichael.viafabricplus.settings.groups.AuthenticationSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.AuthenticationSettings;
import net.raphimc.vialegacy.ViaLegacyConfig;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialoadingbase/MixinVLBViaConfig.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialoadingbase/MixinVLBViaConfig.java
index f9a1fed4..42e5e09a 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialoadingbase/MixinVLBViaConfig.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialoadingbase/MixinVLBViaConfig.java
@@ -18,7 +18,7 @@
package de.florianmichael.viafabricplus.injection.mixin.fixes.vialoadingbase;
import com.viaversion.viaversion.configuration.AbstractViaConfig;
-import de.florianmichael.viafabricplus.settings.groups.ExperimentalSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.ExperimentalSettings;
import de.florianmichael.vialoadingbase.platform.viaversion.VLBViaConfig;
import org.spongepowered.asm.mixin.Mixin;
diff --git a/src/main/java/de/florianmichael/viafabricplus/integration/ModMenuImpl.java b/src/main/java/de/florianmichael/viafabricplus/integration/ModMenuImpl.java
index 5489698e..2a0759f8 100644
--- a/src/main/java/de/florianmichael/viafabricplus/integration/ModMenuImpl.java
+++ b/src/main/java/de/florianmichael/viafabricplus/integration/ModMenuImpl.java
@@ -19,13 +19,15 @@ package de.florianmichael.viafabricplus.integration;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
-import de.florianmichael.viafabricplus.screen.settings.SettingsScreen;
-import net.minecraft.client.gui.screen.Screen;
+import de.florianmichael.viafabricplus.base.screen.impl.settings.SettingsScreen;
public class ModMenuImpl implements ModMenuApi {
@Override
public ConfigScreenFactory> getModConfigScreenFactory() {
- return (ConfigScreenFactory) SettingsScreen::get;
+ return parent -> {
+ SettingsScreen.INSTANCE.prevScreen = parent;
+ return SettingsScreen.INSTANCE;
+ };
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/mappings/ItemReleaseVersionMappings.java b/src/main/java/de/florianmichael/viafabricplus/mappings/ItemReleaseVersionMappings.java
index c8887974..a0256219 100644
--- a/src/main/java/de/florianmichael/viafabricplus/mappings/ItemReleaseVersionMappings.java
+++ b/src/main/java/de/florianmichael/viafabricplus/mappings/ItemReleaseVersionMappings.java
@@ -18,7 +18,7 @@
package de.florianmichael.viafabricplus.mappings;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback;
+import de.florianmichael.viafabricplus.base.event.ChangeProtocolVersionCallback;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
import de.florianmichael.vialoadingbase.model.ProtocolRange;
diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/ProtocolHack.java b/src/main/java/de/florianmichael/viafabricplus/protocolhack/ProtocolHack.java
index 66b9126e..e9eba770 100644
--- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/ProtocolHack.java
+++ b/src/main/java/de/florianmichael/viafabricplus/protocolhack/ProtocolHack.java
@@ -34,9 +34,9 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.HandItemPr
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
import de.florianmichael.viafabricplus.ViaFabricPlus;
import de.florianmichael.viafabricplus.definition.v1_19_0.provider.CommandArgumentsProvider;
-import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback;
-import de.florianmichael.viafabricplus.event.FinishViaLoadingBaseStartupCallback;
-import de.florianmichael.viafabricplus.event.ViaLoadingBaseBuilderCallback;
+import de.florianmichael.viafabricplus.base.event.ChangeProtocolVersionCallback;
+import de.florianmichael.viafabricplus.base.event.FinishViaLoadingBaseStartupCallback;
+import de.florianmichael.viafabricplus.base.event.ViaLoadingBaseBuilderCallback;
import de.florianmichael.viafabricplus.protocolhack.command.ViaFabricPlusVLBViaCommandHandler;
import de.florianmichael.viafabricplus.protocolhack.netty.ViaFabricPlusVLBPipeline;
import de.florianmichael.viafabricplus.protocolhack.platform.ViaAprilFoolsPlatformImpl;
diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java
index 1cd58b65..ac1b45d9 100644
--- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java
+++ b/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java
@@ -20,12 +20,10 @@ package de.florianmichael.viafabricplus.protocolhack.provider.vialegacy;
import com.viaversion.viaversion.api.connection.UserConnection;
import de.florianmichael.classic4j.JSPBetaCraftHandler;
import de.florianmichael.viafabricplus.integration.Classic4JImpl;
-import de.florianmichael.viafabricplus.settings.groups.AuthenticationSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.AuthenticationSettings;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicMPPassProvider;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.HandshakeStorage;
-import java.util.concurrent.atomic.AtomicReference;
-
public class ViaFabricPlusClassicMPPassProvider extends ClassicMPPassProvider {
public static String classiCubeMPPass;
diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialegacy/ViaFabricPlusOldAuthProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialegacy/ViaFabricPlusOldAuthProvider.java
index 9348dc66..9d67254f 100644
--- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialegacy/ViaFabricPlusOldAuthProvider.java
+++ b/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialegacy/ViaFabricPlusOldAuthProvider.java
@@ -19,10 +19,10 @@ package de.florianmichael.viafabricplus.protocolhack.provider.vialegacy;
import com.viaversion.viaversion.api.connection.UserConnection;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
-import de.florianmichael.viafabricplus.settings.groups.AuthenticationSettings;
-import de.florianmichael.viafabricplus.util.ScreenUtil;
+import de.florianmichael.viafabricplus.base.settings.groups.AuthenticationSettings;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
+import net.minecraft.util.Formatting;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.providers.OldAuthProvider;
public class ViaFabricPlusOldAuthProvider extends OldAuthProvider {
@@ -37,7 +37,8 @@ public class ViaFabricPlusOldAuthProvider extends OldAuthProvider {
mc.getSessionService().joinServer(mc.getSession().getProfile(), mc.getSession().getAccessToken(), serverId);
} catch (Exception e) {
if (AuthenticationSettings.INSTANCE.disconnectIfJoinServerCallFails.getValue()) {
- user.getChannel().attr(ProtocolHack.LOCAL_MINECRAFT_CONNECTION).get().disconnect(Text.literal(ScreenUtil.prefixedMessage("ViaLegacy fails to verify your session! Please log in into an Account or disable the BetaCraft authentication in the ViaFabricPlus Settings")));
+ user.getChannel().attr(ProtocolHack.LOCAL_MINECRAFT_CONNECTION).get().
+ disconnect(Text.literal(Formatting.GOLD + "[ViaFabricPlus] " + Formatting.WHITE + Text.translatable("authentication.viafabricplus.error")));
} else {
e.printStackTrace();
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialoadingbase/ViaFabricPlusVLBBaseVersionProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialoadingbase/ViaFabricPlusVLBBaseVersionProvider.java
index 637c8549..5a55c220 100644
--- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialoadingbase/ViaFabricPlusVLBBaseVersionProvider.java
+++ b/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialoadingbase/ViaFabricPlusVLBBaseVersionProvider.java
@@ -24,7 +24,7 @@ import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import de.florianmichael.viafabricplus.ViaFabricPlus;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
-import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
+import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
import de.florianmichael.vialoadingbase.provider.VLBBaseVersionProvider;
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/ConfigRemapper.java b/src/main/java/de/florianmichael/viafabricplus/settings/ConfigRemapper.java
deleted file mode 100644
index 24286522..00000000
--- a/src/main/java/de/florianmichael/viafabricplus/settings/ConfigRemapper.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
- * Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package de.florianmichael.viafabricplus.settings;
-
-@Deprecated
-public class ConfigRemapper {
-
- /**
- * Remaps the old config format to the new one, will be removed in the future
- */
- public static String remapp(String key) {
- if (key.equals("bedrock.viafabricplus.set")) key = "authentication.viafabricplus.bedrock";
- if (key.startsWith("mppass")) key = key.replace("mppass", "authentication");
- if (key.equals("visual.viafabricplus.chunkborderfix")) key = "experimental.viafabricplus.chunkborderfix";
- if (key.startsWith("bridge")) key = key.replace("bridge", "general");
-
- return key;
- }
-}
diff --git a/src/main/java/de/florianmichael/viafabricplus/util/ScreenUtil.java b/src/main/java/de/florianmichael/viafabricplus/util/ScreenUtil.java
deleted file mode 100644
index c6e3a630..00000000
--- a/src/main/java/de/florianmichael/viafabricplus/util/ScreenUtil.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
- * Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package de.florianmichael.viafabricplus.util;
-
-import de.florianmichael.viafabricplus.ViaFabricPlus;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.sound.PositionedSoundInstance;
-import net.minecraft.sound.SoundEvents;
-import net.minecraft.util.Formatting;
-
-public class ScreenUtil {
-
- public static void playClickSound() {
- MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F));
- }
-
- public static String prefixedMessage(final String message) {
- return Formatting.GOLD + "[ViaFabricPlus] " + Formatting.WHITE + message;
- }
-
- public static void crash(final String message, final Throwable e) {
- if (System.getProperty("VFPDebug") != null) {
- ViaFabricPlus.LOGGER.error(message, e);
- } else {
- ViaFabricPlus.LOGGER.error(message + ", Use -DVFPDebug to show the log");
- }
- }
-
- public static String format(double a) {
- return String.format("%.2f", a);
- }
-
- public static String formatBytes(long value) {
- if (value < 1024L)
- return value + " B";
- else if (value < 1024L * 1024L)
- return format(((double) value / 1024.0)) + " Kb";
- else if (value < 1024L * 1024L * 1024L)
- return format(((double) value / 1024.0 / 1024.0)) + " Mb";
- else if (value < 1024L * 1024L * 1024L * 1024L)
- return format(((double) value / 1024.0 / 1024.0 / 1024.0)) + " Gb";
- else
- return format(((double) value / 1024.0 / 1024.0 / 1024.0 / 1024.0)) + " Tb";
- }
-}
diff --git a/src/main/resources/assets/viafabricplus/lang/en_us.json b/src/main/resources/assets/viafabricplus/lang/en_us.json
index 028868dd..598418d0 100644
--- a/src/main/resources/assets/viafabricplus/lang/en_us.json
+++ b/src/main/resources/assets/viafabricplus/lang/en_us.json
@@ -12,6 +12,7 @@
"words.viafabricplus.online": "Online Mode",
"words.viafabricplus.reset": "Reset",
"words.viafabricplus.copy": "Copy code",
+ "words.viafabricplus.error": "Something went wrong! Please try again later",
"general.viafabricplus.secret": "Show Super Secret Settings",
"general.viafabricplus.extrainformation": "Show extra information in Debug Hud",
@@ -45,6 +46,7 @@
"authentication.viafabricplus.spoof": "Spoof Username to ClassiCube Name if using ClassiCube",
"authentication.viafabricplus.skin": "Allow ViaLegacy to load skins in legacy versions",
"authentication.viafabricplus.bedrock": "Click to set account for Bedrock edition",
+ "authentication.viafabricplus.error": "ViaFabricPlus failed to verify your session! Please log in into an Account or disable the BetaCraft authentication in the ViaFabricPlus Settings",
"visual.viafabricplus.secure": "Disable secure chat warning",
"visual.viafabricplus.indicator": "Hide signature indicator",
@@ -74,6 +76,5 @@
"classicube.viafabricplus.warning": "This feature will send API requests to the ClassiCube API.",
- "betacraft.viafabricplus.warning": "Pressing this button will send API requests to \"betacraft.uk/serverlist\".",
- "betacraft.viafabricplus.error": "Something went wrong! Please try again later"
+ "betacraft.viafabricplus.warning": "Pressing this button will send API requests to \"betacraft.uk/serverlist\"."
}