From 3303d975b3985ec45e1b18dc1362d9d0b57e8acb Mon Sep 17 00:00:00 2001
From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com>
Date: Wed, 15 Mar 2023 00:47:06 +0100
Subject: [PATCH] recode again, updated README
---
README.md | 77 +++++++++++--------
build.gradle | 5 +-
gradle.properties | 6 +-
.../viafabricplus/ViaFabricPlus.java | 16 ++--
.../definition/ChatLengthDefinition.java | 6 +-
.../ItemReleaseVersionDefinition.java | 7 +-
.../c0_30/ClassicItemSelectionScreen.java | 6 +-
.../CustomClassicProtocolExtensions.java | 14 ++--
.../command/ClassicProtocolCommands.java | 14 ++--
.../c0_30/command/impl/HelpCommand.java | 4 +-
...ava => ChangeProtocolVersionCallback.java} | 31 +++-----
....java => FinishMinecraftLoadCallback.java} | 27 +++----
.../FinishViaLoadingBaseStartupCallback.java | 32 ++++++++
.../FinishViaLoadingBaseStartupListener.java | 41 ----------
...r.java => InitializeSettingsCallback.java} | 27 +++----
.../LoadClassicProtocolExtensionCallback.java | 33 ++++++++
.../LoadClassicProtocolExtensionListener.java | 46 -----------
...LoadListener.java => PreLoadCallback.java} | 27 +++----
...tener.java => SkipIdlePacketCallback.java} | 27 +++----
.../mixin/base/MixinClientConnection.java | 6 +-
.../mixin/base/MixinClientConnection_1.java | 16 ++--
.../base/MixinClientLoginNetworkHandler.java | 1 -
.../mixin/base/MixinMinecraftClient.java | 5 +-
.../mixin/base/MixinMultiplayerScreen.java | 2 +-
.../MixinMultiplayerServerListPinger.java | 2 +-
.../mixin/bridge/MixinConnectScreen.java | 2 +-
.../injection/mixin/bridge/MixinDebugHud.java | 2 +-
.../bridge/MixinDownloadingTerrainScreen.java | 2 +-
.../mixin/bridge/MixinOptionsScreen.java | 2 +-
.../mixin/fixes/MixinBipedEntityModel.java | 2 +-
.../injection/mixin/fixes/MixinCamera.java | 6 +-
.../fixes/MixinClientPlayNetworkHandler.java | 2 +-
.../MixinClientPlayerInteractionManager.java | 3 +-
.../injection/mixin/fixes/MixinInGameHud.java | 16 ++--
.../mixin/fixes/MixinItemRenderer.java | 2 +-
.../mixin/fixes/MixinMinecraftClient.java | 4 +-
.../fixes/MixinPendingUpdateManager.java | 2 +-
.../mixin/fixes/block/MixinAbstractBlock.java | 2 +-
.../fixes/entity/MixinClientPlayerEntity.java | 9 +--
.../mixin/fixes/entity/MixinPlayerEntity.java | 2 +-
.../mixin/fixes/input/MixinKeyboard.java | 2 +-
.../mixin/fixes/input/MixinMouse.java | 2 +-
.../fixes/item/MixinItemCooldownManager.java | 2 +-
.../item/MixinItemGroup_EntriesImpl.java | 2 +-
.../mixin/fixes/item/MixinItemGroups.java | 4 +-
.../mixin/fixes/item/MixinItemStack.java | 2 +-
.../mixin/fixes/screen/MixinChatScreen.java | 2 +-
.../fixes/screen/MixinCommandBlockScreen.java | 2 +-
.../screen/MixinCreativeInventoryScreen.java | 2 +-
.../fixes/screen/MixinJigsawBlockScreen.java | 4 +-
.../mixin/fixes/screen/hud/MixinChatHud.java | 2 +-
.../screen/merchant/MixinMerchantScreen.java | 2 +-
...MixinExtensionProtocolMetadataStorage.java | 5 +-
.../ProtocolSyncBooleanSettingRenderer.java | 2 +-
.../settings/SettingsSystem.java | 14 ++--
.../settings/groups/BridgeSettings.java | 6 +-
.../settings/groups/DebugSettings.java | 6 +-
.../settings/groups/GeneralSettings.java | 6 +-
.../settings/groups/MPPassSettings.java | 6 +-
.../settings/groups/VisualSettings.java | 6 +-
.../type_impl/ProtocolSyncBooleanSetting.java | 2 +-
.../vialoadingbase/ViaLoadingBaseStartup.java | 13 +++-
.../BedrockRakNetConstants.java | 2 +-
.../PreNettyConstants.java | 2 +-
.../DisconnectHandler.java | 2 +-
.../PingEncapsulationCodec.java | 2 +-
.../RakMessageEncapsulationCodec.java | 2 +-
.../RakNetPingSessions.java | 2 +-
.../FixedUnconnectedPingEncoder.java | 2 +-
.../FixedUnconnectedPongDecoder.java | 2 +-
.../VFPPreNettyDecoder.java | 2 +-
.../VFPPreNettyEncoder.java | 2 +-
.../ViaFabricPlusNettyPipelineProvider.java | 2 +-
...abricPlusClassicCustomCommandProvider.java | 6 +-
.../ViaFabricPlusClassicMPPassProvider.java | 4 +-
...aFabricPlusClassicWorldHeightProvider.java | 2 +-
.../ViaFabricPlusEncryptionProvider.java | 2 +-
.../ViaFabricPlusGameProfileFetcher.java | 2 +-
.../ViaFabricPlusOldAuthProvider.java | 6 +-
.../ViaFabricPlusHandItemProvider.java | 2 +-
...FabricPlusMovementTransmitterProvider.java | 2 +-
.../VFPVLBViaDecodeHandler.java | 2 +-
82 files changed, 300 insertions(+), 380 deletions(-)
rename src/main/java/de/florianmichael/viafabricplus/event/{ChangeProtocolVersionListener.java => ChangeProtocolVersionCallback.java} (53%)
rename src/main/java/de/florianmichael/viafabricplus/event/{FinishMinecraftLoadListener.java => FinishMinecraftLoadCallback.java} (55%)
create mode 100644 src/main/java/de/florianmichael/viafabricplus/event/FinishViaLoadingBaseStartupCallback.java
delete mode 100644 src/main/java/de/florianmichael/viafabricplus/event/FinishViaLoadingBaseStartupListener.java
rename src/main/java/de/florianmichael/viafabricplus/event/{InitializeSettingsListener.java => InitializeSettingsCallback.java} (55%)
create mode 100644 src/main/java/de/florianmichael/viafabricplus/event/LoadClassicProtocolExtensionCallback.java
delete mode 100644 src/main/java/de/florianmichael/viafabricplus/event/LoadClassicProtocolExtensionListener.java
rename src/main/java/de/florianmichael/viafabricplus/event/{LoadListener.java => PreLoadCallback.java} (59%)
rename src/main/java/de/florianmichael/viafabricplus/event/{SkipIdlePacketListener.java => SkipIdlePacketCallback.java} (56%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/{platform/raknet => constants}/BedrockRakNetConstants.java (95%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/{platform/pre_netty => constants}/PreNettyConstants.java (93%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/{raknet => viabedrock}/DisconnectHandler.java (99%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/{raknet => viabedrock}/PingEncapsulationCodec.java (99%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/{raknet => viabedrock}/RakMessageEncapsulationCodec.java (99%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/{raknet => viabedrock}/RakNetPingSessions.java (99%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/{raknet => viabedrock}/library_fix/FixedUnconnectedPingEncoder.java (99%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/{raknet => viabedrock}/library_fix/FixedUnconnectedPongDecoder.java (99%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/{pre_netty => vialegacy}/VFPPreNettyDecoder.java (99%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/{pre_netty => vialegacy}/VFPPreNettyEncoder.java (99%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/{ => viabedrock}/ViaFabricPlusNettyPipelineProvider.java (97%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/{ => vialegacy}/ViaFabricPlusClassicCustomCommandProvider.java (91%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/{ => vialegacy}/ViaFabricPlusClassicMPPassProvider.java (94%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/{ => vialegacy}/ViaFabricPlusClassicWorldHeightProvider.java (94%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/{ => vialegacy}/ViaFabricPlusEncryptionProvider.java (95%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/{ => vialegacy}/ViaFabricPlusGameProfileFetcher.java (97%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/{ => vialegacy}/ViaFabricPlusOldAuthProvider.java (88%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/{ => viaversion}/ViaFabricPlusHandItemProvider.java (95%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/{ => viaversion}/ViaFabricPlusMovementTransmitterProvider.java (94%)
rename src/main/java/de/florianmichael/viafabricplus/vialoadingbase/{platform => replacement}/VFPVLBViaDecodeHandler.java (96%)
diff --git a/README.md b/README.md
index 43ef603f..24118b18 100644
--- a/README.md
+++ b/README.md
@@ -83,45 +83,33 @@ Settings are optional settings that can turn fixes on and off, originally they w
![](/.github/images/settings.png)
## Addons
-To make a ViaFabricPlus addon you just have to implement the ViaFabricPlusAddon interface in your main class:
+There is no real addon base, to create addons you can simply use the Fabric system, and then interact with ViaFabricPlus via the **EventDispatcher**.
```java
-package net.example;
+public class ViaFabricPlusExampleAddon implements ClientModInitializer {
-public class ViaFabricPlusExampleAddon implements ViaFabricPlusAddon {
-
- @Override
- public void onLoad() {
- // called after ViaVersion and Minecraft is initialized
- }
-
- @Override
- public void onChangeVersion(ComparableProtocolVersion protocolVersion) {
- // called when the user changes the target version in the gui
- }
-}
-```
-To load the addon you have to specify the addon main class as entrypoint in your *fabric.mod.json*:
-```json
-{
- "entrypoints": {
- "viafabricplus": [
- "net.example.ViaFabricPlusExampleAddon"
- ]
+ @Override
+ public void onInitializeClient() {
+ ChangeProtocolVersionCallback.EVENT.register(protocolVersion -> {
+ System.out.println("Version changed to " + protocolVersion.getName());
+ });
}
}
```
+#### ViaFabricPlus has 7 events at the moment:
+| Callback class name | Description |
+|--------------------------------------|--------------------------------------------------------------------------------------------|
+| ChangeProtocolVersionCallback | Called when the user changes the target version in the screen |
+| FinishMinecraftLoadCallback | Called when Minecraft is finished with loading all its components |
+| FinishViaLoadingBaseStartupCallback | Called when ViaLoadingBase and Via* is loaded and ready to use |
+| InitializeSettingsCallback | Called after the default setting groups are loaded and before the setting config is loaded |
+| LoadClassicProtocolExtensionCallback | Called when the classic server sends the protocol extensions (only in **c0.30 CPE**) |
+| PreLoadCallback | Called before everything (Pre-pre load) |
+| SkipIdlePacketCallback | In case you need an event as soon as the idle packet is skipped in the <= 1.8 |
### General API
-In case you need an event as soon as the idle packet is skipped in the <= 1.8, you can do that:
-```java
-IdlePacketExecutor.registerIdlePacketSkipExecute(() -> {
- // Called when the idle packet is skipped
-});
-```
-
In case you need the release version of a material, you can do that:
```java
-final ProtocolRange range = ItemReleaseVersionDefinition.getItemMap().get(Items.WRITABLE_BOOK); // If an item does not appear in the item map, it has always existed
+final ProtocolRange range = ItemReleaseVersionDefinition.INSTANCE.getItemMap().get(Items.WRITABLE_BOOK); // If an item does not appear in the item map, it has always existed
// The Range class then contains all versions in which the item occurs.
// You can find out how the Range class works in the ViaLoadingBase README.
@@ -137,7 +125,7 @@ public class ExampleSettingGroup extends SettingGroup {
public ExampleSettingGroup() {
super("Example");
- ViaFabricPlus.getClassWrapper().loadGroup(this); // should be in your onLoad method
+ ViaFabricPlus.INSTANCE.getSettingsSystem().addGroup(this); // should be in your onLoad method
}
}
```
@@ -172,7 +160,34 @@ public void onLoad() {
```
#### Implementing custom classic protocol extensions:
+```java
+public class ExampleExtensionSupport implements ClientModInitializer {
+ public static ClientboundPacketsc0_30cpe EXT_CLICK_DISTANCE;
+
+ @Override
+ public void onInitializeClient() {
+ PreLoadCallback.EVENT.register(() -> {
+ CustomClassicProtocolExtensions.allowExtension(ClassicProtocolExtension.CLICK_DISTANCE); // Register extension as supported
+
+ EXT_CLICK_DISTANCE = CustomClassicProtocolExtensions.createNewPacket(ClassicProtocolExtension.CLICK_DISTANCE, 0x12, (user, buf) -> buf.readShort());
+ });
+
+ FinishViaLoadingBaseStartupCallback.EVENT.register(() -> {
+ Via.getManager().getProtocolManager().getProtocol(Protocolc0_30toc0_30cpe.class).registerClientbound(EXT_CLICK_DISTANCE, null, new PacketHandlers() {
+ @Override
+ protected void register() {
+ handler(wrapper -> {
+ wrapper.cancel();
+ final short distance = wrapper.read(Type.SHORT);
+ // Do your stuff...
+ });
+ }
+ }, true);
+ });
+ }
+}
+```
## Alternatives
- [ClientViaVersion](https://github.com/Gerrygames/ClientViaVersion): Discontinued 5zig plugin.
diff --git a/build.gradle b/build.gradle
index 3bd9c139..10f93a3d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -53,10 +53,9 @@ dependencies {
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
- modImplementation "com.terraformersmc:modmenu:${project.mod_menu_version}"
+ modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
libs "com.github.FlorianMichael:ViaLoadingBase:${project.vialoadingbase_version}"
- libs "com.github.FlorianMichael:DietrichEvents:${project.dietrichevents_version}"
libs("org.cloudburstmc.netty:netty-transport-raknet:${project.raknet_transport_version}") {
exclude group: "io.netty", module: "netty-common"
exclude group: "io.netty", module: "netty-buffer"
@@ -74,6 +73,8 @@ dependencies {
libs "net.lenni0451.mcstructs:text:${project.mcstructs_text_version}"
libs "net.lenni0451:Reflect:${project.reflect_version}"
+
+ modImplementation "com.terraformersmc:modmenu:${project.mod_menu_version}"
}
processResources {
diff --git a/gradle.properties b/gradle.properties
index 57ea1155..81d4c00c 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,19 +2,19 @@
org.gradle.jvmargs=-Xmx8G
org.gradle.parallel=true
-# minecraft
+# minecraft and fabric
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.5
loader_version=0.14.14
+fabric_api_version=0.74.0+1.19.3
# viafabricplus
-mod_version=1.9.0
+mod_version=2.0.0
maven_group=de.florianmichael
archives_base_name=viafabricplus
# base lib
vialoadingbase_version=6dad0a2561
-dietrichevents_version=1.0.0
raknet_transport_version=1.0.0.CR1-SNAPSHOT
# viaversion (and required) libs
diff --git a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java
index 52b1f05c..d2a440b4 100644
--- a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java
+++ b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java
@@ -17,7 +17,6 @@
*/
package de.florianmichael.viafabricplus;
-import de.florianmichael.dietrichevents.EventDispatcher;
import de.florianmichael.viafabricplus.definition.ChatLengthDefinition;
import de.florianmichael.viafabricplus.definition.ItemReleaseVersionDefinition;
import de.florianmichael.viafabricplus.definition.PackFormatsDefinition;
@@ -25,8 +24,8 @@ import de.florianmichael.viafabricplus.definition.c0_30.ClassicItemSelectionScre
import de.florianmichael.viafabricplus.definition.c0_30.CustomClassicProtocolExtensions;
import de.florianmichael.viafabricplus.definition.c0_30.command.ClassicProtocolCommands;
import de.florianmichael.viafabricplus.definition.v1_8_x.ArmorPointsDefinition;
-import de.florianmichael.viafabricplus.event.FinishMinecraftLoadListener;
-import de.florianmichael.viafabricplus.event.LoadListener;
+import de.florianmichael.viafabricplus.event.FinishMinecraftLoadCallback;
+import de.florianmichael.viafabricplus.event.PreLoadCallback;
import de.florianmichael.viafabricplus.settings.SettingsSystem;
import de.florianmichael.viafabricplus.vialoadingbase.ViaLoadingBaseStartup;
@@ -36,11 +35,10 @@ public class ViaFabricPlus {
public final static File RUN_DIRECTORY = new File("ViaFabricPlus");
public final static ViaFabricPlus INSTANCE = new ViaFabricPlus();
- private final EventDispatcher eventDispatcher = new EventDispatcher();
private final SettingsSystem settingsSystem = new SettingsSystem();
public void init() {
- eventDispatcher.subscribe(FinishMinecraftLoadListener.class, () -> {
+ FinishMinecraftLoadCallback.EVENT.register(() -> {
settingsSystem.init();
// General definitions
@@ -51,18 +49,14 @@ public class ViaFabricPlus {
// Classic Stuff
ChatLengthDefinition.create();
ClassicItemSelectionScreen.create();
- ClassicProtocolCommands.load();
+ ClassicProtocolCommands.create();
});
- eventDispatcher.post(new LoadListener.LoadEvent());
+ PreLoadCallback.EVENT.invoker().onLoad();
CustomClassicProtocolExtensions.create();
new ViaLoadingBaseStartup();
}
- public EventDispatcher getEventDispatcher() {
- return eventDispatcher;
- }
-
public SettingsSystem getSettingsSystem() {
return settingsSystem;
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/ChatLengthDefinition.java b/src/main/java/de/florianmichael/viafabricplus/definition/ChatLengthDefinition.java
index ef33af9b..2e01eb04 100644
--- a/src/main/java/de/florianmichael/viafabricplus/definition/ChatLengthDefinition.java
+++ b/src/main/java/de/florianmichael/viafabricplus/definition/ChatLengthDefinition.java
@@ -18,9 +18,7 @@
package de.florianmichael.viafabricplus.definition;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import de.florianmichael.viafabricplus.ViaFabricPlus;
-import de.florianmichael.viafabricplus.event.ChangeProtocolVersionListener;
-import de.florianmichael.vialoadingbase.platform.ComparableProtocolVersion;
+import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback;
import net.minecraft.client.MinecraftClient;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
@@ -30,7 +28,7 @@ public class ChatLengthDefinition {
public static void create() {
INSTANCE = new ChatLengthDefinition();
- ViaFabricPlus.INSTANCE.getEventDispatcher().subscribe(ChangeProtocolVersionListener.class, protocolVersion -> {
+ ChangeProtocolVersionCallback.EVENT.register(protocolVersion -> {
INSTANCE.maxLength = 256;
if (protocolVersion.isOlderThanOrEqualTo(ProtocolVersion.v1_10)) {
INSTANCE.maxLength = 100;
diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/ItemReleaseVersionDefinition.java b/src/main/java/de/florianmichael/viafabricplus/definition/ItemReleaseVersionDefinition.java
index 93eb07d5..20fc80e3 100644
--- a/src/main/java/de/florianmichael/viafabricplus/definition/ItemReleaseVersionDefinition.java
+++ b/src/main/java/de/florianmichael/viafabricplus/definition/ItemReleaseVersionDefinition.java
@@ -18,8 +18,7 @@
package de.florianmichael.viafabricplus.definition;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import de.florianmichael.viafabricplus.ViaFabricPlus;
-import de.florianmichael.viafabricplus.event.ChangeProtocolVersionListener;
+import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback;
import de.florianmichael.vialoadingbase.platform.ComparableProtocolVersion;
import de.florianmichael.vialoadingbase.platform.ProtocolRange;
import net.minecraft.item.Item;
@@ -40,10 +39,10 @@ public class ItemReleaseVersionDefinition {
public static void create() {
INSTANCE = new ItemReleaseVersionDefinition();
- ViaFabricPlus.INSTANCE.getEventDispatcher().subscribe(ChangeProtocolVersionListener.class, (protocolVersion -> {
+ ChangeProtocolVersionCallback.EVENT.register(protocolVersion -> {
INSTANCE.currentMap.clear();
INSTANCE.currentMap.addAll(Registries.ITEM.stream().filter(item -> INSTANCE.contains(item, protocolVersion)).toList());
- }));
+ });
}
private final Map- itemMap = new HashMap<>();
diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/ClassicItemSelectionScreen.java b/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/ClassicItemSelectionScreen.java
index c7494f06..9926bd68 100644
--- a/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/ClassicItemSelectionScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/ClassicItemSelectionScreen.java
@@ -17,10 +17,8 @@
*/
package de.florianmichael.viafabricplus.definition.c0_30;
-import de.florianmichael.viafabricplus.ViaFabricPlus;
-import de.florianmichael.viafabricplus.event.ChangeProtocolVersionListener;
+import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback;
import de.florianmichael.vialoadingbase.platform.ComparableProtocolVersion;
-import de.florianmichael.vialoadingbase.platform.InternalProtocolList;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.sound.PositionedSoundInstance;
@@ -44,7 +42,7 @@ public class ClassicItemSelectionScreen extends Screen {
public static void create() {
INSTANCE = new ClassicItemSelectionScreen();
- ViaFabricPlus.INSTANCE.getEventDispatcher().subscribe(ChangeProtocolVersionListener.class, protocolVersion -> {
+ ChangeProtocolVersionCallback.EVENT.register(protocolVersion -> {
if (protocolVersion.isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
INSTANCE.reload(protocolVersion, false);
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/CustomClassicProtocolExtensions.java b/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/CustomClassicProtocolExtensions.java
index d623b1ac..4a8a3d6f 100644
--- a/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/CustomClassicProtocolExtensions.java
+++ b/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/CustomClassicProtocolExtensions.java
@@ -18,16 +18,14 @@
package de.florianmichael.viafabricplus.definition.c0_30;
import com.viaversion.viaversion.api.connection.UserConnection;
-import de.florianmichael.dietrichevents.EventDispatcher;
-import de.florianmichael.viafabricplus.ViaFabricPlus;
import de.florianmichael.viafabricplus.definition.ChatLengthDefinition;
-import de.florianmichael.viafabricplus.event.LoadClassicProtocolExtensionListener;
-import de.florianmichael.viafabricplus.event.LoadListener;
+import de.florianmichael.viafabricplus.event.LoadClassicProtocolExtensionCallback;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import io.netty.buffer.ByteBuf;
import net.lenni0451.reflect.Enums;
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.ClientboundPacketsc0_30cpe;
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.data.ClassicProtocolExtension;
+import org.lwjgl.openal.AL;
import java.util.Arrays;
import java.util.HashMap;
@@ -38,12 +36,14 @@ import java.util.function.BiConsumer;
public class CustomClassicProtocolExtensions {
public static CustomClassicProtocolExtensions INSTANCE;
+ public static ClientboundPacketsc0_30cpe EXT_WEATHER_TYPE;
+
public static void create() {
CustomClassicProtocolExtensions.INSTANCE = new CustomClassicProtocolExtensions();
EXT_WEATHER_TYPE = createNewPacket(ClassicProtocolExtension.ENV_WEATHER_TYPE, 31, (user, buf) -> buf.readByte());
- ViaFabricPlus.INSTANCE.getEventDispatcher().subscribe(LoadClassicProtocolExtensionListener.class, (classicProtocolExtension) -> {
+ LoadClassicProtocolExtensionCallback.EVENT.register(classicProtocolExtension -> {
if (classicProtocolExtension == ClassicProtocolExtension.LONGER_MESSAGES) ChatLengthDefinition.INSTANCE.expand();
if (classicProtocolExtension == ClassicProtocolExtension.CUSTOM_BLOCKS) ClassicItemSelectionScreen.INSTANCE.reload(ViaLoadingBase.getClassWrapper().getTargetVersion(), true);
});
@@ -52,7 +52,9 @@ public class CustomClassicProtocolExtensions {
public final List ALLOWED_EXTENSIONS = Arrays.asList(ClassicProtocolExtension.ENV_WEATHER_TYPE);
public final Map CUSTOM_PACKETS = new HashMap<>();
- public static ClientboundPacketsc0_30cpe EXT_WEATHER_TYPE;
+ public static void allowExtension(final ClassicProtocolExtension classicProtocolExtension) {
+ INSTANCE.ALLOWED_EXTENSIONS.add(classicProtocolExtension);
+ }
public static ClientboundPacketsc0_30cpe createNewPacket(final ClassicProtocolExtension classicProtocolExtension, final int packetId, final BiConsumer packetSplitter) {
final ClientboundPacketsc0_30cpe packet = Enums.newInstance(ClientboundPacketsc0_30cpe.class, classicProtocolExtension.getName(), ClassicProtocolExtension.values().length, new Class[] { int.class, BiConsumer.class }, new Object[] { packetId, packetSplitter });
diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/command/ClassicProtocolCommands.java b/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/command/ClassicProtocolCommands.java
index afeb91ca..8dd50da7 100644
--- a/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/command/ClassicProtocolCommands.java
+++ b/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/command/ClassicProtocolCommands.java
@@ -26,11 +26,15 @@ import java.util.List;
public class ClassicProtocolCommands {
public final static String COMMAND_PREFIX = "/v";
- public final static List commands = new ArrayList<>();
+ public static ClassicProtocolCommands INSTANCE;
- public static void load() {
- commands.add(new HelpCommand());
- commands.add(new SetTimeCommand());
- commands.add(new ListExtensionsCommand());
+ public final List commands = new ArrayList<>();
+
+ public static void create() {
+ INSTANCE = new ClassicProtocolCommands();
+
+ INSTANCE.commands.add(new HelpCommand());
+ INSTANCE.commands.add(new SetTimeCommand());
+ INSTANCE.commands.add(new ListExtensionsCommand());
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/command/impl/HelpCommand.java b/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/command/impl/HelpCommand.java
index f4e5a182..ac213960 100644
--- a/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/command/impl/HelpCommand.java
+++ b/src/main/java/de/florianmichael/viafabricplus/definition/c0_30/command/impl/HelpCommand.java
@@ -35,9 +35,9 @@ public class HelpCommand implements ICommand {
@Override
public void execute(String[] args) {
- sendFeedback(Formatting.GREEN + "Loaded " + Formatting.GOLD + (ClassicProtocolCommands.commands.size() - 1) + Formatting.GREEN + " commands");
+ sendFeedback(Formatting.GREEN + "Loaded " + Formatting.GOLD + (ClassicProtocolCommands.INSTANCE.commands.size() - 1) + Formatting.GREEN + " commands");
- for (ICommand command : ClassicProtocolCommands.commands) {
+ for (ICommand command : ClassicProtocolCommands.INSTANCE.commands) {
if (command.name().equals(name())) continue;
command.sendUsage();
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/ChangeProtocolVersionListener.java b/src/main/java/de/florianmichael/viafabricplus/event/ChangeProtocolVersionCallback.java
similarity index 53%
rename from src/main/java/de/florianmichael/viafabricplus/event/ChangeProtocolVersionListener.java
rename to src/main/java/de/florianmichael/viafabricplus/event/ChangeProtocolVersionCallback.java
index 23f2d4dd..8209cbd1 100644
--- a/src/main/java/de/florianmichael/viafabricplus/event/ChangeProtocolVersionListener.java
+++ b/src/main/java/de/florianmichael/viafabricplus/event/ChangeProtocolVersionCallback.java
@@ -17,30 +17,17 @@
*/
package de.florianmichael.viafabricplus.event;
-import de.florianmichael.dietrichevents.AbstractEvent;
-import de.florianmichael.dietrichevents.handle.EventExecutor;
-import de.florianmichael.dietrichevents.handle.Listener;
import de.florianmichael.vialoadingbase.platform.ComparableProtocolVersion;
+import net.fabricmc.fabric.api.event.Event;
+import net.fabricmc.fabric.api.event.EventFactory;
-public interface ChangeProtocolVersionListener extends Listener {
+public interface ChangeProtocolVersionCallback {
+
+ Event EVENT = EventFactory.createArrayBacked(ChangeProtocolVersionCallback.class, listeners -> version -> {
+ for (ChangeProtocolVersionCallback listener : listeners) {
+ listener.onChangeProtocolVersion(version);
+ }
+ });
void onChangeProtocolVersion(final ComparableProtocolVersion protocolVersion);
-
- class ChangeProtocolVersionEvent extends AbstractEvent {
- private final EventExecutor eventExecutor;
-
- public ChangeProtocolVersionEvent(final ComparableProtocolVersion protocolVersion) {
- this.eventExecutor = listener -> listener.onChangeProtocolVersion(protocolVersion);
- }
-
- @Override
- public EventExecutor getEventExecutor() {
- return this.eventExecutor;
- }
-
- @Override
- public Class getListenerType() {
- return ChangeProtocolVersionListener.class;
- }
- }
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/FinishMinecraftLoadListener.java b/src/main/java/de/florianmichael/viafabricplus/event/FinishMinecraftLoadCallback.java
similarity index 55%
rename from src/main/java/de/florianmichael/viafabricplus/event/FinishMinecraftLoadListener.java
rename to src/main/java/de/florianmichael/viafabricplus/event/FinishMinecraftLoadCallback.java
index c1538935..f0173fa8 100644
--- a/src/main/java/de/florianmichael/viafabricplus/event/FinishMinecraftLoadListener.java
+++ b/src/main/java/de/florianmichael/viafabricplus/event/FinishMinecraftLoadCallback.java
@@ -17,25 +17,16 @@
*/
package de.florianmichael.viafabricplus.event;
-import de.florianmichael.dietrichevents.AbstractEvent;
-import de.florianmichael.dietrichevents.handle.EventExecutor;
-import de.florianmichael.dietrichevents.handle.Listener;
+import net.fabricmc.fabric.api.event.Event;
+import net.fabricmc.fabric.api.event.EventFactory;
-public interface FinishMinecraftLoadListener extends Listener {
+public interface FinishMinecraftLoadCallback {
+
+ Event EVENT = EventFactory.createArrayBacked(FinishMinecraftLoadCallback.class, listeners -> () -> {
+ for (FinishMinecraftLoadCallback listener : listeners) {
+ listener.onFinishMinecraftLoad();
+ }
+ });
void onFinishMinecraftLoad();
-
- class FinishMinecraftLoadEvent extends AbstractEvent {
- private final EventExecutor eventExecutor = FinishMinecraftLoadListener::onFinishMinecraftLoad;
-
- @Override
- public EventExecutor getEventExecutor() {
- return eventExecutor;
- }
-
- @Override
- public Class getListenerType() {
- return FinishMinecraftLoadListener.class;
- }
- }
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/FinishViaLoadingBaseStartupCallback.java b/src/main/java/de/florianmichael/viafabricplus/event/FinishViaLoadingBaseStartupCallback.java
new file mode 100644
index 00000000..8f3a6082
--- /dev/null
+++ b/src/main/java/de/florianmichael/viafabricplus/event/FinishViaLoadingBaseStartupCallback.java
@@ -0,0 +1,32 @@
+/*
+ * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
+ * Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (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.event;
+
+import net.fabricmc.fabric.api.event.Event;
+import net.fabricmc.fabric.api.event.EventFactory;
+
+public interface FinishViaLoadingBaseStartupCallback {
+
+ Event EVENT = EventFactory.createArrayBacked(FinishViaLoadingBaseStartupCallback.class, listeners -> () -> {
+ for (FinishViaLoadingBaseStartupCallback listener : listeners) {
+ listener.onFinishViaLoadingBaseStartup();
+ }
+ });
+
+ void onFinishViaLoadingBaseStartup();
+}
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/FinishViaLoadingBaseStartupListener.java b/src/main/java/de/florianmichael/viafabricplus/event/FinishViaLoadingBaseStartupListener.java
deleted file mode 100644
index ca92cab5..00000000
--- a/src/main/java/de/florianmichael/viafabricplus/event/FinishViaLoadingBaseStartupListener.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
- * Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (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.event;
-
-import de.florianmichael.dietrichevents.AbstractEvent;
-import de.florianmichael.dietrichevents.handle.EventExecutor;
-import de.florianmichael.dietrichevents.handle.Listener;
-
-public interface FinishViaLoadingBaseStartupListener extends Listener {
-
- void onFinishViaLoadingBaseStartup();
-
- class FinishViaLoadingBaseStartupEvent extends AbstractEvent {
- private final EventExecutor eventExecutor = FinishViaLoadingBaseStartupListener::onFinishViaLoadingBaseStartup;
-
- @Override
- public EventExecutor getEventExecutor() {
- return eventExecutor;
- }
-
- @Override
- public Class getListenerType() {
- return FinishViaLoadingBaseStartupListener.class;
- }
- }
-}
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/InitializeSettingsListener.java b/src/main/java/de/florianmichael/viafabricplus/event/InitializeSettingsCallback.java
similarity index 55%
rename from src/main/java/de/florianmichael/viafabricplus/event/InitializeSettingsListener.java
rename to src/main/java/de/florianmichael/viafabricplus/event/InitializeSettingsCallback.java
index 7c9d570f..311d47ba 100644
--- a/src/main/java/de/florianmichael/viafabricplus/event/InitializeSettingsListener.java
+++ b/src/main/java/de/florianmichael/viafabricplus/event/InitializeSettingsCallback.java
@@ -17,25 +17,16 @@
*/
package de.florianmichael.viafabricplus.event;
-import de.florianmichael.dietrichevents.AbstractEvent;
-import de.florianmichael.dietrichevents.handle.EventExecutor;
-import de.florianmichael.dietrichevents.handle.Listener;
+import net.fabricmc.fabric.api.event.Event;
+import net.fabricmc.fabric.api.event.EventFactory;
-public interface InitializeSettingsListener extends Listener {
+public interface InitializeSettingsCallback {
+
+ Event EVENT = EventFactory.createArrayBacked(InitializeSettingsCallback.class, listeners -> () -> {
+ for (InitializeSettingsCallback listener : listeners) {
+ listener.onInitializeSettings();
+ }
+ });
void onInitializeSettings();
-
- class InitializeSettingsEvent extends AbstractEvent {
- private final EventExecutor eventExecutor = InitializeSettingsListener::onInitializeSettings;
-
- @Override
- public EventExecutor getEventExecutor() {
- return eventExecutor;
- }
-
- @Override
- public Class getListenerType() {
- return InitializeSettingsListener.class;
- }
- }
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/LoadClassicProtocolExtensionCallback.java b/src/main/java/de/florianmichael/viafabricplus/event/LoadClassicProtocolExtensionCallback.java
new file mode 100644
index 00000000..121de559
--- /dev/null
+++ b/src/main/java/de/florianmichael/viafabricplus/event/LoadClassicProtocolExtensionCallback.java
@@ -0,0 +1,33 @@
+/*
+ * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
+ * Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (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.event;
+
+import net.fabricmc.fabric.api.event.Event;
+import net.fabricmc.fabric.api.event.EventFactory;
+import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.data.ClassicProtocolExtension;
+
+public interface LoadClassicProtocolExtensionCallback {
+
+ Event EVENT = EventFactory.createArrayBacked(LoadClassicProtocolExtensionCallback.class, listeners -> classicProtocolExtension -> {
+ for (LoadClassicProtocolExtensionCallback listener : listeners) {
+ listener.onLoadClassicProtocolExtension(classicProtocolExtension);
+ }
+ });
+
+ void onLoadClassicProtocolExtension(final ClassicProtocolExtension classicProtocolExtension);
+}
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/LoadClassicProtocolExtensionListener.java b/src/main/java/de/florianmichael/viafabricplus/event/LoadClassicProtocolExtensionListener.java
deleted file mode 100644
index 6029680c..00000000
--- a/src/main/java/de/florianmichael/viafabricplus/event/LoadClassicProtocolExtensionListener.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
- * Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (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.event;
-
-import de.florianmichael.dietrichevents.AbstractEvent;
-import de.florianmichael.dietrichevents.handle.EventExecutor;
-import de.florianmichael.dietrichevents.handle.Listener;
-import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.data.ClassicProtocolExtension;
-
-public interface LoadClassicProtocolExtensionListener extends Listener {
-
- void onLoadClassicProtocolExtension(final ClassicProtocolExtension classicProtocolExtension);
-
- class LoadClassicProtocolExtensionEvent extends AbstractEvent {
- private final EventExecutor eventExecutor;
-
- public LoadClassicProtocolExtensionEvent(final ClassicProtocolExtension classicProtocolExtension) {
- this.eventExecutor = listener -> listener.onLoadClassicProtocolExtension(classicProtocolExtension);
- }
-
- @Override
- public EventExecutor getEventExecutor() {
- return this.eventExecutor;
- }
-
- @Override
- public Class getListenerType() {
- return LoadClassicProtocolExtensionListener.class;
- }
- }
-}
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/LoadListener.java b/src/main/java/de/florianmichael/viafabricplus/event/PreLoadCallback.java
similarity index 59%
rename from src/main/java/de/florianmichael/viafabricplus/event/LoadListener.java
rename to src/main/java/de/florianmichael/viafabricplus/event/PreLoadCallback.java
index 5e6bac93..48432b42 100644
--- a/src/main/java/de/florianmichael/viafabricplus/event/LoadListener.java
+++ b/src/main/java/de/florianmichael/viafabricplus/event/PreLoadCallback.java
@@ -17,25 +17,16 @@
*/
package de.florianmichael.viafabricplus.event;
-import de.florianmichael.dietrichevents.AbstractEvent;
-import de.florianmichael.dietrichevents.handle.EventExecutor;
-import de.florianmichael.dietrichevents.handle.Listener;
+import net.fabricmc.fabric.api.event.Event;
+import net.fabricmc.fabric.api.event.EventFactory;
-public interface LoadListener extends Listener {
+public interface PreLoadCallback {
+
+ Event EVENT = EventFactory.createArrayBacked(PreLoadCallback.class, listeners -> () -> {
+ for (PreLoadCallback listener : listeners) {
+ listener.onLoad();
+ }
+ });
void onLoad();
-
- class LoadEvent extends AbstractEvent {
- private final EventExecutor eventExecutor = LoadListener::onLoad;
-
- @Override
- public EventExecutor getEventExecutor() {
- return this.eventExecutor;
- }
-
- @Override
- public Class getListenerType() {
- return LoadListener.class;
- }
- }
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/event/SkipIdlePacketListener.java b/src/main/java/de/florianmichael/viafabricplus/event/SkipIdlePacketCallback.java
similarity index 56%
rename from src/main/java/de/florianmichael/viafabricplus/event/SkipIdlePacketListener.java
rename to src/main/java/de/florianmichael/viafabricplus/event/SkipIdlePacketCallback.java
index bce9c96f..d6608942 100644
--- a/src/main/java/de/florianmichael/viafabricplus/event/SkipIdlePacketListener.java
+++ b/src/main/java/de/florianmichael/viafabricplus/event/SkipIdlePacketCallback.java
@@ -17,25 +17,16 @@
*/
package de.florianmichael.viafabricplus.event;
-import de.florianmichael.dietrichevents.AbstractEvent;
-import de.florianmichael.dietrichevents.handle.EventExecutor;
-import de.florianmichael.dietrichevents.handle.Listener;
+import net.fabricmc.fabric.api.event.Event;
+import net.fabricmc.fabric.api.event.EventFactory;
-public interface SkipIdlePacketListener extends Listener {
+public interface SkipIdlePacketCallback {
+
+ Event EVENT = EventFactory.createArrayBacked(SkipIdlePacketCallback.class, listeners -> () -> {
+ for (SkipIdlePacketCallback listener : listeners) {
+ listener.onSkipIdlePacket();
+ }
+ });
void onSkipIdlePacket();
-
- class SkipIdlePacketEvent extends AbstractEvent {
- private final EventExecutor eventExecutor = SkipIdlePacketListener::onSkipIdlePacket;
-
- @Override
- public EventExecutor getEventExecutor() {
- return eventExecutor;
- }
-
- @Override
- public Class getListenerType() {
- return SkipIdlePacketListener.class;
- }
- }
}
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 d76e3cf7..eb143a76 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
@@ -18,9 +18,9 @@
package de.florianmichael.viafabricplus.injection.mixin.base;
import de.florianmichael.viafabricplus.injection.access.IClientConnection;
-import de.florianmichael.viafabricplus.vialoadingbase.platform.pre_netty.PreNettyConstants;
-import de.florianmichael.viafabricplus.vialoadingbase.platform.raknet.BedrockRakNetConstants;
-import de.florianmichael.viafabricplus.vialoadingbase.platform.raknet.RakNetPingSessions;
+import de.florianmichael.viafabricplus.vialoadingbase.constants.PreNettyConstants;
+import de.florianmichael.viafabricplus.vialoadingbase.constants.BedrockRakNetConstants;
+import de.florianmichael.viafabricplus.vialoadingbase.platform.viabedrock.RakNetPingSessions;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import de.florianmichael.vialoadingbase.event.PipelineReorderEvent;
import io.netty.bootstrap.AbstractBootstrap;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection_1.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection_1.java
index d2262dae..6c2bb65e 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection_1.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection_1.java
@@ -20,16 +20,16 @@ package de.florianmichael.viafabricplus.injection.mixin.base;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.connection.UserConnectionImpl;
import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
-import de.florianmichael.viafabricplus.ViaFabricPlus;
import de.florianmichael.viafabricplus.injection.access.IClientConnection;
import de.florianmichael.viafabricplus.vialoadingbase.ViaLoadingBaseStartup;
-import de.florianmichael.viafabricplus.vialoadingbase.platform.pre_netty.PreNettyConstants;
-import de.florianmichael.viafabricplus.vialoadingbase.platform.pre_netty.VFPPreNettyDecoder;
-import de.florianmichael.viafabricplus.vialoadingbase.platform.pre_netty.VFPPreNettyEncoder;
-import de.florianmichael.viafabricplus.vialoadingbase.platform.VFPVLBViaDecodeHandler;
-import de.florianmichael.viafabricplus.vialoadingbase.platform.raknet.*;
-import de.florianmichael.viafabricplus.vialoadingbase.platform.raknet.library_fix.FixedUnconnectedPingEncoder;
-import de.florianmichael.viafabricplus.vialoadingbase.platform.raknet.library_fix.FixedUnconnectedPongDecoder;
+import de.florianmichael.viafabricplus.vialoadingbase.constants.BedrockRakNetConstants;
+import de.florianmichael.viafabricplus.vialoadingbase.constants.PreNettyConstants;
+import de.florianmichael.viafabricplus.vialoadingbase.platform.vialegacy.VFPPreNettyDecoder;
+import de.florianmichael.viafabricplus.vialoadingbase.platform.vialegacy.VFPPreNettyEncoder;
+import de.florianmichael.viafabricplus.vialoadingbase.replacement.VFPVLBViaDecodeHandler;
+import de.florianmichael.viafabricplus.vialoadingbase.platform.viabedrock.*;
+import de.florianmichael.viafabricplus.vialoadingbase.platform.viabedrock.library_fix.FixedUnconnectedPingEncoder;
+import de.florianmichael.viafabricplus.vialoadingbase.platform.viabedrock.library_fix.FixedUnconnectedPongDecoder;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import de.florianmichael.vialoadingbase.netty.VLBViaEncodeHandler;
import de.florianmichael.vialoadingbase.netty.NettyConstants;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientLoginNetworkHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientLoginNetworkHandler.java
index ae0c87e6..a67fc3e6 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientLoginNetworkHandler.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientLoginNetworkHandler.java
@@ -17,7 +17,6 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.base;
-import de.florianmichael.viafabricplus.ViaFabricPlus;
import de.florianmichael.viafabricplus.vialoadingbase.ViaLoadingBaseStartup;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import net.minecraft.client.network.ClientLoginNetworkHandler;
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 16aea76b..d569fce8 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,8 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.base;
-import de.florianmichael.viafabricplus.ViaFabricPlus;
-import de.florianmichael.viafabricplus.event.FinishMinecraftLoadListener;
+import de.florianmichael.viafabricplus.event.FinishMinecraftLoadCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.RunArgs;
import org.spongepowered.asm.mixin.Mixin;
@@ -31,6 +30,6 @@ public class MixinMinecraftClient {
@Inject(method = "", at = @At("RETURN"))
public void postLoad(RunArgs args, CallbackInfo ci) {
- ViaFabricPlus.INSTANCE.getEventDispatcher().post(new FinishMinecraftLoadListener.FinishMinecraftLoadEvent());
+ FinishMinecraftLoadCallback.EVENT.invoker().onFinishMinecraftLoad();
}
}
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 63d2d7ab..a45a1715 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
@@ -39,7 +39,7 @@ public class MixinMultiplayerScreen extends Screen {
public void addProtocolSelectionButton(CallbackInfo ci) {
ButtonWidget.Builder builder = ButtonWidget.builder(Text.literal("ViaFabricPlus"), button -> ProtocolSelectionScreen.open(this));
- final int orientation = GeneralSettings.getClassWrapper().mainButtonOrientation.getIndex();
+ final int orientation = GeneralSettings.INSTANCE.mainButtonOrientation.getIndex();
switch (orientation) {
case 0 -> builder = builder.position(0, 0);
case 1 -> builder = builder.position(width - 98, 0);
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinMultiplayerServerListPinger.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinMultiplayerServerListPinger.java
index de859296..e4869fdd 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinMultiplayerServerListPinger.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinMultiplayerServerListPinger.java
@@ -17,7 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.base;
-import de.florianmichael.viafabricplus.vialoadingbase.platform.raknet.RakNetPingSessions;
+import de.florianmichael.viafabricplus.vialoadingbase.platform.viabedrock.RakNetPingSessions;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import net.minecraft.client.network.MultiplayerServerListPinger;
import net.raphimc.viabedrock.api.BedrockProtocolVersion;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinConnectScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinConnectScreen.java
index 3560e194..240dce83 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinConnectScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinConnectScreen.java
@@ -31,7 +31,7 @@ public class MixinConnectScreen {
@Inject(method = "render", at = @At("RETURN"))
public void renderClassicProgress(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
- if (!BridgeSettings.getClassWrapper().showClassicLoadingProgressInConnectScreen.getValue()) return;
+ if (!BridgeSettings.INSTANCE.showClassicLoadingProgressInConnectScreen.getValue()) return;
ClassicProgressRenderer.renderProgress(matrices);
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinDebugHud.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinDebugHud.java
index 29e51fe0..cc4142d6 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinDebugHud.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinDebugHud.java
@@ -43,7 +43,7 @@ public class MixinDebugHud {
@Inject(method = "getLeftText", at = @At("RETURN"))
public void addViaFabricPlusInformation(CallbackInfoReturnable
> cir) {
- if (MinecraftClient.getInstance().isInSingleplayer() || !BridgeSettings.getClassWrapper().showExtraInformationInDebugHud.getValue()) return;
+ if (MinecraftClient.getInstance().isInSingleplayer() || !BridgeSettings.INSTANCE.showExtraInformationInDebugHud.getValue()) return;
final List information = new ArrayList<>();
if (MinecraftClient.getInstance().getNetworkHandler() != null) {
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinDownloadingTerrainScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinDownloadingTerrainScreen.java
index e6948dd1..9bbff1b4 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinDownloadingTerrainScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinDownloadingTerrainScreen.java
@@ -31,7 +31,7 @@ public class MixinDownloadingTerrainScreen {
@Inject(method = "render", at = @At("RETURN"))
public void renderClassicProgress(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
- if (!BridgeSettings.getClassWrapper().showClassicLoadingProgressInConnectScreen.getValue()) return;
+ if (!BridgeSettings.INSTANCE.showClassicLoadingProgressInConnectScreen.getValue()) return;
ClassicProgressRenderer.renderProgress(matrices);
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinOptionsScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinOptionsScreen.java
index 74172c21..0e507dc8 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinOptionsScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinOptionsScreen.java
@@ -48,7 +48,7 @@ public abstract class MixinOptionsScreen extends Screen {
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/GridWidget$Adder;add(Lnet/minecraft/client/gui/widget/ClickableWidget;)Lnet/minecraft/client/gui/widget/ClickableWidget;", ordinal = 10, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
public void addValuesButton(CallbackInfo ci, GridWidget gridWidget, GridWidget.Adder adder) {
- if (BridgeSettings.getClassWrapper().optionsButtonInGameOptions.getValue()) {
+ if (BridgeSettings.INSTANCE.optionsButtonInGameOptions.getValue()) {
adder.add(this.createButton(Text.literal("ViaFabricPlus").styled(style -> style.withColor(Formatting.GOLD)).append(" ").append("Settings..."), () -> SettingsScreen.get((OptionsScreen) (Object) this)));
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && MinecraftClient.getInstance().player != null) {
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinBipedEntityModel.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinBipedEntityModel.java
index bc514080..64b51b01 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinBipedEntityModel.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinBipedEntityModel.java
@@ -38,7 +38,7 @@ public class MixinBipedEntityModel {
@Inject(method = "setAngles(Lnet/minecraft/entity/LivingEntity;FFFFF)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/model/ModelPart;roll:F", ordinal = 1, shift = At.Shift.AFTER))
public void addOldWalkAnimation(T livingEntity, float f, float g, float h, float i, float j, CallbackInfo ci) {
- if (VisualSettings.getClassWrapper().oldWalkingAnimation.getValue()) {
+ if (VisualSettings.INSTANCE.oldWalkingAnimation.getValue()) {
this.rightArm.pitch = MathHelper.cos(f * 0.6662F + 3.1415927F) * 2.0F * g;
this.rightArm.roll = (MathHelper.cos(f * 0.2312F) + 1.0F) * 1.0F * g;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinCamera.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinCamera.java
index 0cc50cc2..3e4cb59a 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinCamera.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinCamera.java
@@ -42,7 +42,7 @@ public class MixinCamera {
@Inject(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;setPos(DDD)V", shift = At.Shift.BEFORE))
public void onUpdateHeight(BlockView area, Entity focusedEntity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo ci) {
- if (!DebugSettings.getClassWrapper().replaceSneaking.getValue() && DebugSettings.getClassWrapper().sneakInstant.getValue()) {
+ if (!DebugSettings.INSTANCE.replaceSneaking.getValue() && DebugSettings.INSTANCE.sneakInstant.getValue()) {
cameraY = lastCameraY = focusedEntity.getStandingEyeHeight();
}
}
@@ -51,14 +51,14 @@ public class MixinCamera {
public void onUpdateEyeHeight(CallbackInfo ci) {
if (this.focusedEntity == null) return;
- if (DebugSettings.getClassWrapper().replaceSneaking.getValue()) {
+ if (DebugSettings.INSTANCE.replaceSneaking.getValue()) {
ci.cancel();
this.lastCameraY = this.cameraY;
if (this.focusedEntity instanceof PlayerEntity player && !player.isSleeping()) {
if (player.isSneaking()) {
cameraY = 1.54F;
- } else if (!DebugSettings.getClassWrapper().longSneaking.getValue()) {
+ } else if (!DebugSettings.INSTANCE.longSneaking.getValue()) {
cameraY = 1.62F;
} else if (cameraY < 1.62F) {
float delta = 1.62F - cameraY;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayNetworkHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayNetworkHandler.java
index a2ecf57c..6744a922 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayNetworkHandler.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayNetworkHandler.java
@@ -148,6 +148,6 @@ public abstract class MixinClientPlayNetworkHandler {
@Redirect(method = "onServerMetadata", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/ServerMetadataS2CPacket;isSecureChatEnforced()Z"))
public boolean removeSecureChatWarning(ServerMetadataS2CPacket instance) {
- return instance.isSecureChatEnforced() || VisualSettings.getClassWrapper().disableSecureChatWarning.getValue();
+ return instance.isSecureChatEnforced() || VisualSettings.INSTANCE.disableSecureChatWarning.getValue();
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayerInteractionManager.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayerInteractionManager.java
index 7dc6de3f..25e0999d 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayerInteractionManager.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinClientPlayerInteractionManager.java
@@ -22,11 +22,10 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2;
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4;
-import de.florianmichael.viafabricplus.ViaFabricPlus;
import de.florianmichael.viafabricplus.injection.access.IClientPlayerEntity;
import de.florianmichael.viafabricplus.injection.access.IScreenHandler;
import de.florianmichael.viafabricplus.vialoadingbase.ViaLoadingBaseStartup;
-import de.florianmichael.viafabricplus.vialoadingbase.provider.ViaFabricPlusHandItemProvider;
+import de.florianmichael.viafabricplus.vialoadingbase.provider.viaversion.ViaFabricPlusHandItemProvider;
import de.florianmichael.viafabricplus.util.ItemTranslator;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import net.minecraft.client.MinecraftClient;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinInGameHud.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinInGameHud.java
index 9753ee61..23857fcf 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinInGameHud.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinInGameHud.java
@@ -41,22 +41,22 @@ public abstract class MixinInGameHud {
@Inject(method = "renderExperienceBar", at = @At("HEAD"), cancellable = true)
public void removeExperienceBar(MatrixStack matrices, int x, CallbackInfo ci) {
- if (VisualSettings.getClassWrapper().removeNewerHudElements.getValue()) ci.cancel();
+ if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) ci.cancel();
}
@Inject(method = "renderMountJumpBar", at = @At("HEAD"), cancellable = true)
public void removeMountJumpBar(JumpingMount mount, MatrixStack matrices, int x, CallbackInfo ci) {
- if (VisualSettings.getClassWrapper().removeNewerHudElements.getValue()) ci.cancel();
+ if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) ci.cancel();
}
@Inject(method = "renderMountHealth", at = @At("HEAD"), cancellable = true)
public void removeMountHealth(MatrixStack matrices, CallbackInfo ci) {
- if (VisualSettings.getClassWrapper().removeNewerHudElements.getValue()) ci.cancel();
+ if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) ci.cancel();
}
@Inject(method = "getHeartCount", at = @At("HEAD"), cancellable = true)
public void removeHungerBar(LivingEntity entity, CallbackInfoReturnable cir) {
- if (VisualSettings.getClassWrapper().removeNewerHudElements.getValue()) {
+ if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) {
cir.setReturnValue(1);
}
}
@@ -65,7 +65,7 @@ public abstract class MixinInGameHud {
@Redirect(method = "renderStatusBars", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/hud/InGameHud;scaledHeight:I", opcode = Opcodes.GETFIELD))
private int moveHealthDown(InGameHud instance) {
- if (VisualSettings.getClassWrapper().removeNewerHudElements.getValue()) return scaledHeight + 6;
+ if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) return scaledHeight + 6;
return scaledHeight;
}
@@ -73,7 +73,7 @@ public abstract class MixinInGameHud {
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"),
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 0)), index = 1)
private int moveArmor(int old) {
- if (VisualSettings.getClassWrapper().removeNewerHudElements.getValue()) return scaledWidth - old - 9;
+ if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) return scaledWidth - old - 9;
return old;
}
@@ -81,7 +81,7 @@ public abstract class MixinInGameHud {
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"),
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 0)), index = 2)
private int moveArmorDown(int old) {
- if (VisualSettings.getClassWrapper().removeNewerHudElements.getValue()) return scaledWidth - 39 + 6;
+ if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) return scaledWidth - 39 + 6;
return old;
}
@@ -89,7 +89,7 @@ public abstract class MixinInGameHud {
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 2),
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V")), index = 1)
private int moveAir(int old) {
- if (VisualSettings.getClassWrapper().removeNewerHudElements.getValue()) return scaledWidth - old - 9;
+ if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) return scaledWidth - old - 9;
return old;
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinItemRenderer.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinItemRenderer.java
index 250007b1..eafaf8df 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinItemRenderer.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinItemRenderer.java
@@ -39,7 +39,7 @@ public class MixinItemRenderer {
@Inject(method = "getModel", at = @At("HEAD"), cancellable = true)
public void removeModel(ItemStack stack, World world, LivingEntity entity, int seed, CallbackInfoReturnable cir) {
- if (VisualSettings.getClassWrapper().replacePetrifiedOakSlab.getValue() && world != null /* world is null in gui rendering */ && stack.isOf(Items.PETRIFIED_OAK_SLAB)) {
+ if (VisualSettings.INSTANCE.replacePetrifiedOakSlab.getValue() && world != null /* world is null in gui rendering */ && stack.isOf(Items.PETRIFIED_OAK_SLAB)) {
cir.setReturnValue(this.models.getModelManager().getMissingModel());
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinMinecraftClient.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinMinecraftClient.java
index 0c760420..e8da41d8 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinMinecraftClient.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinMinecraftClient.java
@@ -99,14 +99,14 @@ public abstract class MixinMinecraftClient {
@Inject(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;",
ordinal = 4, shift = At.Shift.BEFORE))
public void injectTick(CallbackInfo ci) {
- if (!DebugSettings.getClassWrapper().executeInputsInSync.getValue()) return;
+ if (!DebugSettings.INSTANCE.executeInputsInSync.getValue()) return;
SyncInputExecutor.callback();
}
@Inject(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;hasRidingInventory()Z"))
private void onInventoryKeyPressed(CallbackInfo ci) throws Exception {
- if (getNetworkHandler() != null && DebugSettings.getClassWrapper().sendOpenInventoryPacket.getValue()) {
+ if (getNetworkHandler() != null && DebugSettings.INSTANCE.sendOpenInventoryPacket.getValue()) {
final UserConnection viaConnection = MinecraftClient.getInstance().getNetworkHandler().getConnection().channel.attr(ViaLoadingBaseStartup.LOCAL_VIA_CONNECTION).get();
if (viaConnection != null && ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11_1)) {
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinPendingUpdateManager.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinPendingUpdateManager.java
index 6787f3b5..6bb8f2a1 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinPendingUpdateManager.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/MixinPendingUpdateManager.java
@@ -29,7 +29,7 @@ public class MixinPendingUpdateManager {
@Inject(method = "incrementSequence", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/PendingUpdateManager;pendingSequence:Z", shift = At.Shift.BEFORE), cancellable = true)
public void injectIncrementSequence(CallbackInfoReturnable cir) {
- if (DebugSettings.getClassWrapper().disableSequencing.getValue()) {
+ if (DebugSettings.INSTANCE.disableSequencing.getValue()) {
cir.setReturnValue((PendingUpdateManager) (Object) this);
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinAbstractBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinAbstractBlock.java
index fafaafb6..02911e30 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinAbstractBlock.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/block/MixinAbstractBlock.java
@@ -33,7 +33,7 @@ public class MixinAbstractBlock {
@Inject(method = "calcBlockBreakingDelta", at = @At("HEAD"), cancellable = true)
public void fixLegacyMiningSpeed(BlockState state, PlayerEntity player, BlockView world, BlockPos pos, CallbackInfoReturnable cir) {
- if (DebugSettings.getClassWrapper().legacyMiningSpeeds.getValue()) {
+ if (DebugSettings.INSTANCE.legacyMiningSpeeds.getValue()) {
final float hardness = state.getHardness(world, pos);
if (hardness == -1.0F) {
cir.setReturnValue(0.0F);
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinClientPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinClientPlayerEntity.java
index ddd6cb07..1fb27ba0 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinClientPlayerEntity.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinClientPlayerEntity.java
@@ -19,9 +19,8 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.entity;
import com.mojang.authlib.GameProfile;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import de.florianmichael.viafabricplus.ViaFabricPlus;
import de.florianmichael.viafabricplus.definition.v1_8_x.ArmorPointsDefinition;
-import de.florianmichael.viafabricplus.event.SkipIdlePacketListener;
+import de.florianmichael.viafabricplus.event.SkipIdlePacketCallback;
import de.florianmichael.viafabricplus.injection.access.IClientPlayerEntity;
import de.florianmichael.viafabricplus.settings.groups.DebugSettings;
import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
@@ -114,10 +113,10 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
this.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(this.getX(), this.getY(), this.getZ(), this.onGround));
} else if (bl4) {
this.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(this.getYaw(), this.getPitch(), this.onGround));
- } else if (this.lastOnGround != this.onGround || DebugSettings.getClassWrapper().sendIdlePacket.getValue()) {
+ } else if (this.lastOnGround != this.onGround || DebugSettings.INSTANCE.sendIdlePacket.getValue()) {
this.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(this.onGround));
} else {
- ViaFabricPlus.INSTANCE.getEventDispatcher().post(new SkipIdlePacketListener.SkipIdlePacketEvent());
+ SkipIdlePacketCallback.EVENT.invoker().onSkipIdlePacket();
}
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
++this.ticksSinceLastPositionPacketSent;
@@ -208,7 +207,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
@Override
public int getArmor() {
- if (VisualSettings.getClassWrapper().emulateArmorHud.getValue()) {
+ if (VisualSettings.INSTANCE.emulateArmorHud.getValue()) {
return ArmorPointsDefinition.sum();
}
return super.getArmor();
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinPlayerEntity.java
index 4556c9c4..a910c460 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinPlayerEntity.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/entity/MixinPlayerEntity.java
@@ -105,7 +105,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
// Copyright Gaming32 - LICENSE_GENERAL_MIT file
@Inject(method = "getHurtSound", at = @At("HEAD"), cancellable = true)
public void replaceSound(DamageSource source, CallbackInfoReturnable cir) {
- if (VisualSettings.getClassWrapper().replaceHurtSoundWithOOFSound.getValue()) {
+ if (VisualSettings.INSTANCE.replaceHurtSoundWithOOFSound.getValue()) {
cir.setReturnValue(LegacySounds.RANDOM_HURT);
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinKeyboard.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinKeyboard.java
index 16863144..dfb0aadb 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinKeyboard.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinKeyboard.java
@@ -33,7 +33,7 @@ public class MixinKeyboard {
@Redirect(method = "*", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;execute(Ljava/lang/Runnable;)V"))
public void redirectSync(MinecraftClient instance, Runnable runnable) {
- if (DebugSettings.getClassWrapper().executeInputsInSync.getValue()) {
+ if (DebugSettings.INSTANCE.executeInputsInSync.getValue()) {
SyncInputExecutor.trackKeyboardInteraction(runnable);
return;
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinMouse.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinMouse.java
index 2be55b09..6f91b46f 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinMouse.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/input/MixinMouse.java
@@ -30,7 +30,7 @@ public class MixinMouse {
@Redirect(method = { "method_29615", "method_22685", "method_22684" }, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;execute(Ljava/lang/Runnable;)V"))
public void redirectSync(MinecraftClient instance, Runnable runnable) {
- if (DebugSettings.getClassWrapper().executeInputsInSync.getValue()) {
+ if (DebugSettings.INSTANCE.executeInputsInSync.getValue()) {
SyncInputExecutor.trackMouseInteraction(runnable);
return;
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemCooldownManager.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemCooldownManager.java
index 715b35be..3ed03130 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemCooldownManager.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemCooldownManager.java
@@ -30,7 +30,7 @@ public class MixinItemCooldownManager {
@Inject(method = "set", at = @At("HEAD"), cancellable = true)
public void injectSet(Item item, int duration, CallbackInfo ci) {
- if (DebugSettings.getClassWrapper().removeCooldowns.getValue()) {
+ if (DebugSettings.INSTANCE.removeCooldowns.getValue()) {
ci.cancel();
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemGroup_EntriesImpl.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemGroup_EntriesImpl.java
index 526f8eca..497ea1c4 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemGroup_EntriesImpl.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemGroup_EntriesImpl.java
@@ -31,7 +31,7 @@ public class MixinItemGroup_EntriesImpl {
@Redirect(method = "add", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;isEnabled(Lnet/minecraft/resource/featuretoggle/FeatureSet;)Z"))
public boolean removeUnknownItems(Item instance, FeatureSet featureSet) {
- if (!GeneralSettings.getClassWrapper().removeNotAvailableItemsFromCreativeTab.getValue() || MinecraftClient.getInstance().isInSingleplayer()) return instance.isEnabled(featureSet);
+ if (!GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getValue() || MinecraftClient.getInstance().isInSingleplayer()) return instance.isEnabled(featureSet);
if (ItemReleaseVersionDefinition.INSTANCE.getCurrentMap().contains(instance)) return instance.isEnabled(featureSet);
return false;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemGroups.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemGroups.java
index 24d65632..67428753 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemGroups.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemGroups.java
@@ -40,12 +40,12 @@ public class MixinItemGroups {
@Redirect(method = "displayParametersMatch", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/featuretoggle/FeatureSet;equals(Ljava/lang/Object;)Z"))
private static boolean adjustLastVersionMatchCheck(FeatureSet instance, Object o) {
- return instance.equals(o) && viafabricplus_version == ViaLoadingBase.getClassWrapper().getTargetVersion() && viafabricplus_state == GeneralSettings.getClassWrapper().removeNotAvailableItemsFromCreativeTab.getValue();
+ return instance.equals(o) && viafabricplus_version == ViaLoadingBase.getClassWrapper().getTargetVersion() && viafabricplus_state == GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getValue();
}
@Inject(method = "updateDisplayParameters", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemGroups;updateEntries(Lnet/minecraft/resource/featuretoggle/FeatureSet;Z)V", shift = At.Shift.BEFORE))
private static void trackLastVersion(FeatureSet enabledFeatures, boolean operatorEnabled, CallbackInfoReturnable cir) {
viafabricplus_version = ViaLoadingBase.getClassWrapper().getTargetVersion();
- viafabricplus_state = GeneralSettings.getClassWrapper().removeNotAvailableItemsFromCreativeTab.getValue();
+ viafabricplus_state = GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getValue();
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemStack.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemStack.java
index 93a7dc2a..4b0c9786 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemStack.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/item/MixinItemStack.java
@@ -65,7 +65,7 @@ public abstract class MixinItemStack {
@SuppressWarnings({"InvalidInjectorMethodSignature", "MixinAnnotationTarget"})
@ModifyVariable(method = "getAttributeModifiers", ordinal = 0, at = @At(value = "STORE", ordinal = 1))
private Multimap modifyVariableGetAttributeModifiers(Multimap modifiers) {
- if (!DebugSettings.getClassWrapper().replaceAttributeModifiers.getValue() || modifiers.isEmpty()) return modifiers;
+ if (!DebugSettings.INSTANCE.replaceAttributeModifiers.getValue() || modifiers.isEmpty()) return modifiers;
modifiers = HashMultimap.create(modifiers);
modifiers.removeAll(EntityAttributes.GENERIC_ATTACK_DAMAGE);
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinChatScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinChatScreen.java
index 676f7683..33009416 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinChatScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinChatScreen.java
@@ -42,7 +42,7 @@ public class MixinChatScreen {
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;getIndicatorAt(DD)Lnet/minecraft/client/gui/hud/MessageIndicator;"))
public MessageIndicator removeIndicator(ChatHud instance, double mouseX, double mouseY) {
- if (VisualSettings.getClassWrapper().hideSignatureIndicator.getValue()) {
+ if (VisualSettings.INSTANCE.hideSignatureIndicator.getValue()) {
return null;
}
return instance.getIndicatorAt(mouseX, mouseY);
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinCommandBlockScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinCommandBlockScreen.java
index 2acd2883..1469b4f4 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinCommandBlockScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinCommandBlockScreen.java
@@ -43,7 +43,7 @@ public abstract class MixinCommandBlockScreen {
@Inject(method = "init", at = @At("TAIL"))
private void injectInit(CallbackInfo ci) {
- if (VisualSettings.getClassWrapper().removeNewerFeaturesFromCommandBlockScreen.getValue()) {
+ if (VisualSettings.INSTANCE.removeNewerFeaturesFromCommandBlockScreen.getValue()) {
modeButton.visible = false;
conditionalModeButton.visible = false;
redstoneTriggerButton.visible = false;
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinCreativeInventoryScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinCreativeInventoryScreen.java
index b6b292bf..02b721f8 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinCreativeInventoryScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinCreativeInventoryScreen.java
@@ -31,7 +31,7 @@ public class MixinCreativeInventoryScreen {
@Inject(method = "init", at = @At("RETURN"))
public void replaceCreativeMenu(CallbackInfo ci) {
- if (VisualSettings.getClassWrapper().replaceCreativeInventory.getValue()) {
+ if (VisualSettings.INSTANCE.replaceCreativeInventory.getValue()) {
MinecraftClient.getInstance().setScreen(ClassicItemSelectionScreen.INSTANCE);
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinJigsawBlockScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinJigsawBlockScreen.java
index 4dbc949d..84da323d 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinJigsawBlockScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/MixinJigsawBlockScreen.java
@@ -50,7 +50,7 @@ public class MixinJigsawBlockScreen extends Screen {
@Inject(method = "init", at = @At("RETURN"))
public void injectInit(CallbackInfo ci) {
- if (VisualSettings.getClassWrapper().removeNewerFeaturesFromJigsawScreen.getValue()) {
+ if (VisualSettings.INSTANCE.removeNewerFeaturesFromJigsawScreen.getValue()) {
nameField.active = false;
jointRotationButton.active = false;
int index = children().indexOf(jointRotationButton);
@@ -62,7 +62,7 @@ public class MixinJigsawBlockScreen extends Screen {
@Inject(method = "render", at = @At("HEAD"))
public void injectRender(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
- if (VisualSettings.getClassWrapper().removeNewerFeaturesFromJigsawScreen.getValue()) {
+ if (VisualSettings.INSTANCE.removeNewerFeaturesFromJigsawScreen.getValue()) {
nameField.setText(targetField.getText());
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/hud/MixinChatHud.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/hud/MixinChatHud.java
index 6f514769..51df4a5e 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/hud/MixinChatHud.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/hud/MixinChatHud.java
@@ -30,7 +30,7 @@ public class MixinChatHud {
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHudLine$Visible;indicator()Lnet/minecraft/client/gui/hud/MessageIndicator;"), require = 0)
public MessageIndicator removeIndicators(ChatHudLine.Visible instance) {
- if (VisualSettings.getClassWrapper().hideSignatureIndicator.getValue()) {
+ if (VisualSettings.INSTANCE.hideSignatureIndicator.getValue()) {
return null;
}
return instance.indicator();
diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/merchant/MixinMerchantScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/merchant/MixinMerchantScreen.java
index 3d4b323e..8bcbb4cd 100644
--- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/merchant/MixinMerchantScreen.java
+++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/screen/merchant/MixinMerchantScreen.java
@@ -51,7 +51,7 @@ public abstract class MixinMerchantScreen extends HandledScreen 1.18.2
public final ProtocolSyncBooleanSetting disableSequencing = new ProtocolSyncBooleanSetting(this, "Disable sequencing", ProtocolRange.andOlder(ProtocolVersion.v1_18_2));
@@ -54,8 +54,4 @@ public class DebugSettings extends SettingGroup {
public DebugSettings() {
super("Debug");
}
-
- public static DebugSettings getClassWrapper() {
- return DebugSettings.self;
- }
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/groups/GeneralSettings.java b/src/main/java/de/florianmichael/viafabricplus/settings/groups/GeneralSettings.java
index 3634f0fb..9492297f 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/groups/GeneralSettings.java
+++ b/src/main/java/de/florianmichael/viafabricplus/settings/groups/GeneralSettings.java
@@ -22,7 +22,7 @@ import de.florianmichael.viafabricplus.settings.type_impl.BooleanSetting;
import de.florianmichael.viafabricplus.settings.type_impl.ModeSetting;
public class GeneralSettings extends SettingGroup {
- private final static GeneralSettings self = new GeneralSettings();
+ public final static GeneralSettings INSTANCE = new GeneralSettings();
public final ModeSetting mainButtonOrientation = new ModeSetting(this, "Main button orientation", "Left; Top", "Right; Top", "Left; Bottom", "Right: Bottom");
public final BooleanSetting removeNotAvailableItemsFromCreativeTab = new BooleanSetting(this, "Remove not available items from creative tab", true);
@@ -33,8 +33,4 @@ public class GeneralSettings extends SettingGroup {
super("General");
mainButtonOrientation.setValue(1); // Default value
}
-
- public static GeneralSettings getClassWrapper() {
- return GeneralSettings.self;
- }
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/groups/MPPassSettings.java b/src/main/java/de/florianmichael/viafabricplus/settings/groups/MPPassSettings.java
index ff2904ef..a1dc8b2f 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/groups/MPPassSettings.java
+++ b/src/main/java/de/florianmichael/viafabricplus/settings/groups/MPPassSettings.java
@@ -21,7 +21,7 @@ import de.florianmichael.viafabricplus.settings.base.SettingGroup;
import de.florianmichael.viafabricplus.settings.type_impl.BooleanSetting;
public class MPPassSettings extends SettingGroup {
- private final static MPPassSettings self = new MPPassSettings();
+ public final static MPPassSettings INSTANCE = new MPPassSettings();
public final BooleanSetting useBetaCraftAuthentication = new BooleanSetting(this, "Use BetaCraft authentication", true);
public final BooleanSetting allowViaLegacyToCallJoinServerToVerifySession = new BooleanSetting(this, "Allow ViaLegacy to call joinServer() to verify session", true);
@@ -30,8 +30,4 @@ public class MPPassSettings extends SettingGroup {
public MPPassSettings() {
super("MP Pass");
}
-
- public static MPPassSettings getClassWrapper() {
- return MPPassSettings.self;
- }
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/groups/VisualSettings.java b/src/main/java/de/florianmichael/viafabricplus/settings/groups/VisualSettings.java
index a4ac0402..4bb95ac0 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/groups/VisualSettings.java
+++ b/src/main/java/de/florianmichael/viafabricplus/settings/groups/VisualSettings.java
@@ -24,7 +24,7 @@ import de.florianmichael.vialoadingbase.platform.ProtocolRange;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
public class VisualSettings extends SettingGroup {
- public final static VisualSettings self = new VisualSettings();
+ public final static VisualSettings INSTANCE = new VisualSettings();
// 1.19.2 -> 1.19
public final ProtocolSyncBooleanSetting disableSecureChatWarning = new ProtocolSyncBooleanSetting(this, "Disable secure chat warning", ProtocolRange.andOlder(ProtocolVersion.v1_19));
@@ -55,8 +55,4 @@ public class VisualSettings extends SettingGroup {
public VisualSettings() {
super("Visual");
}
-
- public static VisualSettings getClassWrapper() {
- return VisualSettings.self;
- }
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/type_impl/ProtocolSyncBooleanSetting.java b/src/main/java/de/florianmichael/viafabricplus/settings/type_impl/ProtocolSyncBooleanSetting.java
index 0d10766b..38fc24ae 100644
--- a/src/main/java/de/florianmichael/viafabricplus/settings/type_impl/ProtocolSyncBooleanSetting.java
+++ b/src/main/java/de/florianmichael/viafabricplus/settings/type_impl/ProtocolSyncBooleanSetting.java
@@ -46,7 +46,7 @@ public class ProtocolSyncBooleanSetting extends BooleanSetting {
@Override
public Boolean getValue() {
- if (GeneralSettings.getClassWrapper().automaticallyChangeValuesBasedOnTheCurrentVersion.getValue()) return this.getProtocolRange().contains(ViaLoadingBase.getClassWrapper().getTargetVersion());
+ if (GeneralSettings.INSTANCE.automaticallyChangeValuesBasedOnTheCurrentVersion.getValue()) return this.getProtocolRange().contains(ViaLoadingBase.getClassWrapper().getTargetVersion());
return super.getValue();
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/ViaLoadingBaseStartup.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/ViaLoadingBaseStartup.java
index 83c8b596..2949c8b7 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/ViaLoadingBaseStartup.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/ViaLoadingBaseStartup.java
@@ -23,12 +23,16 @@ 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.ChangeProtocolVersionListener;
-import de.florianmichael.viafabricplus.event.FinishViaLoadingBaseStartupListener;
+import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback;
+import de.florianmichael.viafabricplus.event.FinishViaLoadingBaseStartupCallback;
import de.florianmichael.viafabricplus.vialoadingbase.platform.ViaAprilFoolsPlatformImpl;
import de.florianmichael.viafabricplus.vialoadingbase.platform.ViaBedrockPlatformImpl;
import de.florianmichael.viafabricplus.vialoadingbase.platform.ViaLegacyPlatformImpl;
import de.florianmichael.viafabricplus.vialoadingbase.provider.*;
+import de.florianmichael.viafabricplus.vialoadingbase.provider.viabedrock.ViaFabricPlusNettyPipelineProvider;
+import de.florianmichael.viafabricplus.vialoadingbase.provider.vialegacy.*;
+import de.florianmichael.viafabricplus.vialoadingbase.provider.viaversion.ViaFabricPlusHandItemProvider;
+import de.florianmichael.viafabricplus.vialoadingbase.provider.viaversion.ViaFabricPlusMovementTransmitterProvider;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import de.florianmichael.vialoadingbase.platform.SubPlatform;
import io.netty.util.AttributeKey;
@@ -94,8 +98,9 @@ public class ViaLoadingBaseStartup {
providers.use(ClassicCustomCommandProvider.class, new ViaFabricPlusClassicCustomCommandProvider());
providers.use(NettyPipelineProvider.class, new ViaFabricPlusNettyPipelineProvider());
});
- builder = builder.onProtocolReload(protocolVersion -> ViaFabricPlus.INSTANCE.getEventDispatcher().post(new ChangeProtocolVersionListener.ChangeProtocolVersionEvent(protocolVersion)));
+ builder = builder.onProtocolReload(protocolVersion -> ChangeProtocolVersionCallback.EVENT.invoker().onChangeProtocolVersion(protocolVersion));
builder.build();
- ViaFabricPlus.INSTANCE.getEventDispatcher().post(new FinishViaLoadingBaseStartupListener.FinishViaLoadingBaseStartupEvent());
+
+ FinishViaLoadingBaseStartupCallback.EVENT.invoker().onFinishViaLoadingBaseStartup();
}
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/BedrockRakNetConstants.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/constants/BedrockRakNetConstants.java
similarity index 95%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/BedrockRakNetConstants.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/constants/BedrockRakNetConstants.java
index 46b569de..b1fadfa3 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/BedrockRakNetConstants.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/constants/BedrockRakNetConstants.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.vialoadingbase.platform.raknet;
+package de.florianmichael.viafabricplus.vialoadingbase.constants;
public class BedrockRakNetConstants {
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/pre_netty/PreNettyConstants.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/constants/PreNettyConstants.java
similarity index 93%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/pre_netty/PreNettyConstants.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/constants/PreNettyConstants.java
index 752ae0a6..5c8fddf8 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/pre_netty/PreNettyConstants.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/constants/PreNettyConstants.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.vialoadingbase.platform.pre_netty;
+package de.florianmichael.viafabricplus.vialoadingbase.constants;
public class PreNettyConstants {
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/DisconnectHandler.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/DisconnectHandler.java
similarity index 99%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/DisconnectHandler.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/DisconnectHandler.java
index 54928ee0..2e1c5f18 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/DisconnectHandler.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/DisconnectHandler.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.vialoadingbase.platform.raknet;
+package de.florianmichael.viafabricplus.vialoadingbase.platform.viabedrock;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/PingEncapsulationCodec.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/PingEncapsulationCodec.java
similarity index 99%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/PingEncapsulationCodec.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/PingEncapsulationCodec.java
index 3adbd34e..bfbd51f3 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/PingEncapsulationCodec.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/PingEncapsulationCodec.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.vialoadingbase.platform.raknet;
+package de.florianmichael.viafabricplus.vialoadingbase.platform.viabedrock;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/RakMessageEncapsulationCodec.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/RakMessageEncapsulationCodec.java
similarity index 99%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/RakMessageEncapsulationCodec.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/RakMessageEncapsulationCodec.java
index d6fcf410..cc595117 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/RakMessageEncapsulationCodec.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/RakMessageEncapsulationCodec.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.vialoadingbase.platform.raknet;
+package de.florianmichael.viafabricplus.vialoadingbase.platform.viabedrock;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.CompositeByteBuf;
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/RakNetPingSessions.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/RakNetPingSessions.java
similarity index 99%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/RakNetPingSessions.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/RakNetPingSessions.java
index eb0c28df..32408ac5 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/RakNetPingSessions.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/RakNetPingSessions.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.vialoadingbase.platform.raknet;
+package de.florianmichael.viafabricplus.vialoadingbase.platform.viabedrock;
import java.net.InetAddress;
import java.util.ArrayList;
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/library_fix/FixedUnconnectedPingEncoder.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/library_fix/FixedUnconnectedPingEncoder.java
similarity index 99%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/library_fix/FixedUnconnectedPingEncoder.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/library_fix/FixedUnconnectedPingEncoder.java
index 63eef036..e47cf991 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/library_fix/FixedUnconnectedPingEncoder.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/library_fix/FixedUnconnectedPingEncoder.java
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.vialoadingbase.platform.raknet.library_fix;
+package de.florianmichael.viafabricplus.vialoadingbase.platform.viabedrock.library_fix;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/library_fix/FixedUnconnectedPongDecoder.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/library_fix/FixedUnconnectedPongDecoder.java
similarity index 99%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/library_fix/FixedUnconnectedPongDecoder.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/library_fix/FixedUnconnectedPongDecoder.java
index a78f7727..f365a4f1 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/raknet/library_fix/FixedUnconnectedPongDecoder.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/viabedrock/library_fix/FixedUnconnectedPongDecoder.java
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package de.florianmichael.viafabricplus.vialoadingbase.platform.raknet.library_fix;
+package de.florianmichael.viafabricplus.vialoadingbase.platform.viabedrock.library_fix;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/pre_netty/VFPPreNettyDecoder.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/vialegacy/VFPPreNettyDecoder.java
similarity index 99%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/pre_netty/VFPPreNettyDecoder.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/vialegacy/VFPPreNettyDecoder.java
index 7f246b69..a2cd6b7c 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/pre_netty/VFPPreNettyDecoder.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/vialegacy/VFPPreNettyDecoder.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.vialoadingbase.platform.pre_netty;
+package de.florianmichael.viafabricplus.vialoadingbase.platform.vialegacy;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/pre_netty/VFPPreNettyEncoder.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/vialegacy/VFPPreNettyEncoder.java
similarity index 99%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/pre_netty/VFPPreNettyEncoder.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/vialegacy/VFPPreNettyEncoder.java
index 1bc4f36a..6bd4cd5f 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/pre_netty/VFPPreNettyEncoder.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/vialegacy/VFPPreNettyEncoder.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.vialoadingbase.platform.pre_netty;
+package de.florianmichael.viafabricplus.vialoadingbase.platform.vialegacy;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusNettyPipelineProvider.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/viabedrock/ViaFabricPlusNettyPipelineProvider.java
similarity index 97%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusNettyPipelineProvider.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/viabedrock/ViaFabricPlusNettyPipelineProvider.java
index 91f82b55..810ad981 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusNettyPipelineProvider.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/viabedrock/ViaFabricPlusNettyPipelineProvider.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.vialoadingbase.provider;
+package de.florianmichael.viafabricplus.vialoadingbase.provider.viabedrock;
import com.viaversion.viaversion.api.connection.UserConnection;
import de.florianmichael.viafabricplus.ViaFabricPlus;
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusClassicCustomCommandProvider.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusClassicCustomCommandProvider.java
similarity index 91%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusClassicCustomCommandProvider.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusClassicCustomCommandProvider.java
index f7ecdea3..5985d20b 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusClassicCustomCommandProvider.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusClassicCustomCommandProvider.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.vialoadingbase.provider;
+package de.florianmichael.viafabricplus.vialoadingbase.provider.vialegacy;
import com.viaversion.viaversion.api.connection.UserConnection;
import de.florianmichael.viafabricplus.definition.c0_30.command.ClassicProtocolCommands;
@@ -31,7 +31,7 @@ public class ViaFabricPlusClassicCustomCommandProvider extends ClassicCustomComm
@Override
public boolean handleChatMessage(UserConnection user, String message) {
- if (!GeneralSettings.getClassWrapper().allowClassicProtocolCommandUsage.getValue()) return super.handleChatMessage(user, message);
+ if (!GeneralSettings.INSTANCE.allowClassicProtocolCommandUsage.getValue()) return super.handleChatMessage(user, message);
try {
if (message.startsWith(ClassicProtocolCommands.COMMAND_PREFIX)) {
@@ -39,7 +39,7 @@ public class ViaFabricPlusClassicCustomCommandProvider extends ClassicCustomComm
final String[] input = message.split(" ");
if (input.length == 0) return super.handleChatMessage(user, message);
- for (ICommand command : ClassicProtocolCommands.commands) {
+ for (ICommand command : ClassicProtocolCommands.INSTANCE.commands) {
if (input[0].equalsIgnoreCase(command.name())) {
command.execute(Arrays.copyOfRange(input, 1, input.length));
return true;
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusClassicMPPassProvider.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java
similarity index 94%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusClassicMPPassProvider.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java
index 1eaa4b43..441823f7 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusClassicMPPassProvider.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.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.vialoadingbase.provider;
+package de.florianmichael.viafabricplus.vialoadingbase.provider.vialegacy;
import com.google.common.hash.Hashing;
import com.google.common.io.Resources;
@@ -35,7 +35,7 @@ public class ViaFabricPlusClassicMPPassProvider extends ClassicMPPassProvider {
@Override
public String getMpPass(UserConnection user) {
- if (MPPassSettings.getClassWrapper().useBetaCraftAuthentication.getValue()) {
+ if (MPPassSettings.INSTANCE.useBetaCraftAuthentication.getValue()) {
final HandshakeStorage handshakeStorage = user.get(HandshakeStorage.class);
return getBetaCraftMpPass(user, user.getProtocolInfo().getUsername(), handshakeStorage.getHostname(), handshakeStorage.getPort());
} else {
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusClassicWorldHeightProvider.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusClassicWorldHeightProvider.java
similarity index 94%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusClassicWorldHeightProvider.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusClassicWorldHeightProvider.java
index 5bb1628f..31f2fd43 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusClassicWorldHeightProvider.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusClassicWorldHeightProvider.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.vialoadingbase.provider;
+package de.florianmichael.viafabricplus.vialoadingbase.provider.vialegacy;
import com.viaversion.viaversion.api.connection.UserConnection;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicWorldHeightProvider;
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusEncryptionProvider.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusEncryptionProvider.java
similarity index 95%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusEncryptionProvider.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusEncryptionProvider.java
index e73c6bb9..dc4afeff 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusEncryptionProvider.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusEncryptionProvider.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.vialoadingbase.provider;
+package de.florianmichael.viafabricplus.vialoadingbase.provider.vialegacy;
import com.viaversion.viaversion.api.connection.UserConnection;
import de.florianmichael.viafabricplus.ViaFabricPlus;
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusGameProfileFetcher.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusGameProfileFetcher.java
similarity index 97%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusGameProfileFetcher.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusGameProfileFetcher.java
index 2202ce43..5791f878 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusGameProfileFetcher.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusGameProfileFetcher.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.vialoadingbase.provider;
+package de.florianmichael.viafabricplus.vialoadingbase.provider.vialegacy;
import com.mojang.authlib.Agent;
import com.mojang.authlib.GameProfileRepository;
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusOldAuthProvider.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusOldAuthProvider.java
similarity index 88%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusOldAuthProvider.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusOldAuthProvider.java
index 4fb72a05..b63d3900 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusOldAuthProvider.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/vialegacy/ViaFabricPlusOldAuthProvider.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.vialoadingbase.provider;
+package de.florianmichael.viafabricplus.vialoadingbase.provider.vialegacy;
import com.viaversion.viaversion.api.connection.UserConnection;
import de.florianmichael.viafabricplus.ViaFabricPlus;
@@ -30,14 +30,14 @@ public class ViaFabricPlusOldAuthProvider extends OldAuthProvider {
@Override
public void sendAuthRequest(UserConnection user, String serverId) throws Throwable {
- if (!MPPassSettings.getClassWrapper().allowViaLegacyToCallJoinServerToVerifySession.getValue()) return;
+ if (!MPPassSettings.INSTANCE.allowViaLegacyToCallJoinServerToVerifySession.getValue()) return;
final MinecraftClient mc = MinecraftClient.getInstance();
try {
mc.getSessionService().joinServer(mc.getSession().getProfile(), mc.getSession().getAccessToken(), serverId);
} catch (Exception e) {
- if (MPPassSettings.getClassWrapper().disconnectIfJoinServerCallFails.getValue()) {
+ if (MPPassSettings.INSTANCE.disconnectIfJoinServerCallFails.getValue()) {
user.getChannel().attr(ViaLoadingBaseStartup.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")));
} else {
e.printStackTrace();
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusHandItemProvider.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/viaversion/ViaFabricPlusHandItemProvider.java
similarity index 95%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusHandItemProvider.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/viaversion/ViaFabricPlusHandItemProvider.java
index 23192e2b..ea395d2e 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusHandItemProvider.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/viaversion/ViaFabricPlusHandItemProvider.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.vialoadingbase.provider;
+package de.florianmichael.viafabricplus.vialoadingbase.provider.viaversion;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.item.Item;
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusMovementTransmitterProvider.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/viaversion/ViaFabricPlusMovementTransmitterProvider.java
similarity index 94%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusMovementTransmitterProvider.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/viaversion/ViaFabricPlusMovementTransmitterProvider.java
index e6aaddf9..b335be83 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/ViaFabricPlusMovementTransmitterProvider.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/provider/viaversion/ViaFabricPlusMovementTransmitterProvider.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.vialoadingbase.provider;
+package de.florianmichael.viafabricplus.vialoadingbase.provider.viaversion;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
diff --git a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/VFPVLBViaDecodeHandler.java b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/replacement/VFPVLBViaDecodeHandler.java
similarity index 96%
rename from src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/VFPVLBViaDecodeHandler.java
rename to src/main/java/de/florianmichael/viafabricplus/vialoadingbase/replacement/VFPVLBViaDecodeHandler.java
index a0111234..415e7a18 100644
--- a/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/platform/VFPVLBViaDecodeHandler.java
+++ b/src/main/java/de/florianmichael/viafabricplus/vialoadingbase/replacement/VFPVLBViaDecodeHandler.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.vialoadingbase.platform;
+package de.florianmichael.viafabricplus.vialoadingbase.replacement;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;