mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-12-22 16:48:25 +01:00
recode again, updated README
This commit is contained in:
parent
869225e159
commit
3303d975b3
77
README.md
77
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: <br>
|
||||
```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.
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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<Item, ProtocolRange[]> itemMap = new HashMap<>();
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<ClassicProtocolExtension> ALLOWED_EXTENSIONS = Arrays.asList(ClassicProtocolExtension.ENV_WEATHER_TYPE);
|
||||
public final Map<Integer, ClientboundPacketsc0_30cpe> 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<UserConnection, ByteBuf> 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 });
|
||||
|
@ -26,11 +26,15 @@ import java.util.List;
|
||||
|
||||
public class ClassicProtocolCommands {
|
||||
public final static String COMMAND_PREFIX = "/v";
|
||||
public final static List<ICommand> 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<ICommand> 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());
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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<ChangeProtocolVersionCallback> EVENT = EventFactory.createArrayBacked(ChangeProtocolVersionCallback.class, listeners -> version -> {
|
||||
for (ChangeProtocolVersionCallback listener : listeners) {
|
||||
listener.onChangeProtocolVersion(version);
|
||||
}
|
||||
});
|
||||
|
||||
void onChangeProtocolVersion(final ComparableProtocolVersion protocolVersion);
|
||||
|
||||
class ChangeProtocolVersionEvent extends AbstractEvent<ChangeProtocolVersionListener> {
|
||||
private final EventExecutor<ChangeProtocolVersionListener> eventExecutor;
|
||||
|
||||
public ChangeProtocolVersionEvent(final ComparableProtocolVersion protocolVersion) {
|
||||
this.eventExecutor = listener -> listener.onChangeProtocolVersion(protocolVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventExecutor<ChangeProtocolVersionListener> getEventExecutor() {
|
||||
return this.eventExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ChangeProtocolVersionListener> getListenerType() {
|
||||
return ChangeProtocolVersionListener.class;
|
||||
}
|
||||
}
|
||||
}
|
@ -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<FinishMinecraftLoadCallback> EVENT = EventFactory.createArrayBacked(FinishMinecraftLoadCallback.class, listeners -> () -> {
|
||||
for (FinishMinecraftLoadCallback listener : listeners) {
|
||||
listener.onFinishMinecraftLoad();
|
||||
}
|
||||
});
|
||||
|
||||
void onFinishMinecraftLoad();
|
||||
|
||||
class FinishMinecraftLoadEvent extends AbstractEvent<FinishMinecraftLoadListener> {
|
||||
private final EventExecutor<FinishMinecraftLoadListener> eventExecutor = FinishMinecraftLoadListener::onFinishMinecraftLoad;
|
||||
|
||||
@Override
|
||||
public EventExecutor<FinishMinecraftLoadListener> getEventExecutor() {
|
||||
return eventExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<FinishMinecraftLoadListener> getListenerType() {
|
||||
return FinishMinecraftLoadListener.class;
|
||||
}
|
||||
}
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.event;
|
||||
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
|
||||
public interface FinishViaLoadingBaseStartupCallback {
|
||||
|
||||
Event<FinishViaLoadingBaseStartupCallback> EVENT = EventFactory.createArrayBacked(FinishViaLoadingBaseStartupCallback.class, listeners -> () -> {
|
||||
for (FinishViaLoadingBaseStartupCallback listener : listeners) {
|
||||
listener.onFinishViaLoadingBaseStartup();
|
||||
}
|
||||
});
|
||||
|
||||
void onFinishViaLoadingBaseStartup();
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<FinishViaLoadingBaseStartupListener> {
|
||||
private final EventExecutor<FinishViaLoadingBaseStartupListener> eventExecutor = FinishViaLoadingBaseStartupListener::onFinishViaLoadingBaseStartup;
|
||||
|
||||
@Override
|
||||
public EventExecutor<FinishViaLoadingBaseStartupListener> getEventExecutor() {
|
||||
return eventExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<FinishViaLoadingBaseStartupListener> getListenerType() {
|
||||
return FinishViaLoadingBaseStartupListener.class;
|
||||
}
|
||||
}
|
||||
}
|
@ -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<InitializeSettingsCallback> EVENT = EventFactory.createArrayBacked(InitializeSettingsCallback.class, listeners -> () -> {
|
||||
for (InitializeSettingsCallback listener : listeners) {
|
||||
listener.onInitializeSettings();
|
||||
}
|
||||
});
|
||||
|
||||
void onInitializeSettings();
|
||||
|
||||
class InitializeSettingsEvent extends AbstractEvent<InitializeSettingsListener> {
|
||||
private final EventExecutor<InitializeSettingsListener> eventExecutor = InitializeSettingsListener::onInitializeSettings;
|
||||
|
||||
@Override
|
||||
public EventExecutor<InitializeSettingsListener> getEventExecutor() {
|
||||
return eventExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<InitializeSettingsListener> getListenerType() {
|
||||
return InitializeSettingsListener.class;
|
||||
}
|
||||
}
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<LoadClassicProtocolExtensionCallback> EVENT = EventFactory.createArrayBacked(LoadClassicProtocolExtensionCallback.class, listeners -> classicProtocolExtension -> {
|
||||
for (LoadClassicProtocolExtensionCallback listener : listeners) {
|
||||
listener.onLoadClassicProtocolExtension(classicProtocolExtension);
|
||||
}
|
||||
});
|
||||
|
||||
void onLoadClassicProtocolExtension(final ClassicProtocolExtension classicProtocolExtension);
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<LoadClassicProtocolExtensionListener> {
|
||||
private final EventExecutor<LoadClassicProtocolExtensionListener> eventExecutor;
|
||||
|
||||
public LoadClassicProtocolExtensionEvent(final ClassicProtocolExtension classicProtocolExtension) {
|
||||
this.eventExecutor = listener -> listener.onLoadClassicProtocolExtension(classicProtocolExtension);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventExecutor<LoadClassicProtocolExtensionListener> getEventExecutor() {
|
||||
return this.eventExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<LoadClassicProtocolExtensionListener> getListenerType() {
|
||||
return LoadClassicProtocolExtensionListener.class;
|
||||
}
|
||||
}
|
||||
}
|
@ -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<PreLoadCallback> EVENT = EventFactory.createArrayBacked(PreLoadCallback.class, listeners -> () -> {
|
||||
for (PreLoadCallback listener : listeners) {
|
||||
listener.onLoad();
|
||||
}
|
||||
});
|
||||
|
||||
void onLoad();
|
||||
|
||||
class LoadEvent extends AbstractEvent<LoadListener> {
|
||||
private final EventExecutor<LoadListener> eventExecutor = LoadListener::onLoad;
|
||||
|
||||
@Override
|
||||
public EventExecutor<LoadListener> getEventExecutor() {
|
||||
return this.eventExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<LoadListener> getListenerType() {
|
||||
return LoadListener.class;
|
||||
}
|
||||
}
|
||||
}
|
@ -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<SkipIdlePacketCallback> EVENT = EventFactory.createArrayBacked(SkipIdlePacketCallback.class, listeners -> () -> {
|
||||
for (SkipIdlePacketCallback listener : listeners) {
|
||||
listener.onSkipIdlePacket();
|
||||
}
|
||||
});
|
||||
|
||||
void onSkipIdlePacket();
|
||||
|
||||
class SkipIdlePacketEvent extends AbstractEvent<SkipIdlePacketListener> {
|
||||
private final EventExecutor<SkipIdlePacketListener> eventExecutor = SkipIdlePacketListener::onSkipIdlePacket;
|
||||
|
||||
@Override
|
||||
public EventExecutor<SkipIdlePacketListener> getEventExecutor() {
|
||||
return eventExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<SkipIdlePacketListener> getListenerType() {
|
||||
return SkipIdlePacketListener.class;
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 = "<init>", at = @At("RETURN"))
|
||||
public void postLoad(RunArgs args, CallbackInfo ci) {
|
||||
ViaFabricPlus.INSTANCE.getEventDispatcher().post(new FinishMinecraftLoadListener.FinishMinecraftLoadEvent());
|
||||
FinishMinecraftLoadCallback.EVENT.invoker().onFinishMinecraftLoad();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class MixinDebugHud {
|
||||
|
||||
@Inject(method = "getLeftText", at = @At("RETURN"))
|
||||
public void addViaFabricPlusInformation(CallbackInfoReturnable<List<String>> cir) {
|
||||
if (MinecraftClient.getInstance().isInSingleplayer() || !BridgeSettings.getClassWrapper().showExtraInformationInDebugHud.getValue()) return;
|
||||
if (MinecraftClient.getInstance().isInSingleplayer() || !BridgeSettings.INSTANCE.showExtraInformationInDebugHud.getValue()) return;
|
||||
|
||||
final List<String> information = new ArrayList<>();
|
||||
if (MinecraftClient.getInstance().getNetworkHandler() != null) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -38,7 +38,7 @@ public class MixinBipedEntityModel<T extends LivingEntity> {
|
||||
|
||||
@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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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<Integer> 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;
|
||||
}
|
||||
}
|
||||
|
@ -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<BakedModel> 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());
|
||||
}
|
||||
}
|
||||
|
@ -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)) {
|
||||
|
@ -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<PendingUpdateManager> cir) {
|
||||
if (DebugSettings.getClassWrapper().disableSequencing.getValue()) {
|
||||
if (DebugSettings.INSTANCE.disableSequencing.getValue()) {
|
||||
cir.setReturnValue((PendingUpdateManager) (Object) this);
|
||||
}
|
||||
}
|
||||
|
@ -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<Float> 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);
|
||||
|
@ -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();
|
||||
|
@ -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<SoundEvent> cir) {
|
||||
if (VisualSettings.getClassWrapper().replaceHurtSoundWithOOFSound.getValue()) {
|
||||
if (VisualSettings.INSTANCE.replaceHurtSoundWithOOFSound.getValue()) {
|
||||
cir.setReturnValue(LegacySounds.RANDOM_HURT);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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<Boolean> cir) {
|
||||
viafabricplus_version = ViaLoadingBase.getClassWrapper().getTargetVersion();
|
||||
viafabricplus_state = GeneralSettings.getClassWrapper().removeNotAvailableItemsFromCreativeTab.getValue();
|
||||
viafabricplus_state = GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getValue();
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public abstract class MixinItemStack {
|
||||
@SuppressWarnings({"InvalidInjectorMethodSignature", "MixinAnnotationTarget"})
|
||||
@ModifyVariable(method = "getAttributeModifiers", ordinal = 0, at = @At(value = "STORE", ordinal = 1))
|
||||
private Multimap<EntityAttribute, EntityAttributeModifier> modifyVariableGetAttributeModifiers(Multimap<EntityAttribute, EntityAttributeModifier> 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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -51,7 +51,7 @@ public abstract class MixinMerchantScreen extends HandledScreen<MerchantScreenHa
|
||||
|
||||
@Inject(method = "syncRecipeIndex", at = @At("HEAD"))
|
||||
public void smoothOutRecipeIndex(CallbackInfo ci) {
|
||||
if (DebugSettings.getClassWrapper().smoothOutMerchantScreens.getValue()) {
|
||||
if (DebugSettings.INSTANCE.smoothOutMerchantScreens.getValue()) {
|
||||
if (viafabricplus_previousRecipeIndex != selectedIndex) {
|
||||
int direction = viafabricplus_previousRecipeIndex < selectedIndex ? 1 : -1;
|
||||
for (int smooth = viafabricplus_previousRecipeIndex + direction /* don't send the page we already are on */; smooth != selectedIndex; smooth += direction) {
|
||||
|
@ -17,9 +17,8 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.vialegacy;
|
||||
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.injection.access.IExtensionProtocolMetadataStorage;
|
||||
import de.florianmichael.viafabricplus.event.LoadClassicProtocolExtensionListener;
|
||||
import de.florianmichael.viafabricplus.event.LoadClassicProtocolExtensionCallback;
|
||||
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.data.ClassicProtocolExtension;
|
||||
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.storage.ExtensionProtocolMetadataStorage;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@ -38,7 +37,7 @@ public class MixinExtensionProtocolMetadataStorage implements IExtensionProtocol
|
||||
|
||||
@Inject(method = "addServerExtension", at = @At("RETURN"))
|
||||
public void updateChatLengthDefinition(ClassicProtocolExtension extension, int version, CallbackInfo ci) {
|
||||
ViaFabricPlus.INSTANCE.getEventDispatcher().post(new LoadClassicProtocolExtensionListener.LoadClassicProtocolExtensionEvent(extension));
|
||||
LoadClassicProtocolExtensionCallback.EVENT.invoker().onLoadClassicProtocolExtension(extension);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,7 +62,7 @@ public class ProtocolSyncBooleanSettingRenderer extends AbstractSettingRenderer
|
||||
final int length = textRenderer.drawWithShadow(matrices, Formatting.GRAY + this.value.getName(), 3, entryHeight / 2F - textRenderer.fontHeight / 2F, -1);
|
||||
|
||||
textRenderer.drawWithShadow(matrices, "(" + this.value.getProtocolRange().toString() + ")", length + 2, entryHeight / 2F - textRenderer.fontHeight / 2F, -1);
|
||||
if (GeneralSettings.getClassWrapper().automaticallyChangeValuesBasedOnTheCurrentVersion.getValue()) color = color.darker().darker();
|
||||
if (GeneralSettings.INSTANCE.automaticallyChangeValuesBasedOnTheCurrentVersion.getValue()) color = color.darker().darker();
|
||||
textRenderer.drawWithShadow(matrices, text, entryWidth - textRenderer.getWidth(text) - 3 - 3, entryHeight / 2F - textRenderer.fontHeight / 2F, color.getRGB());
|
||||
|
||||
matrices.pop();
|
||||
|
@ -21,7 +21,7 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.event.InitializeSettingsListener;
|
||||
import de.florianmichael.viafabricplus.event.InitializeSettingsCallback;
|
||||
import de.florianmichael.viafabricplus.settings.base.AbstractSetting;
|
||||
import de.florianmichael.viafabricplus.settings.base.SettingGroup;
|
||||
import de.florianmichael.viafabricplus.settings.groups.*;
|
||||
@ -41,14 +41,14 @@ public class SettingsSystem {
|
||||
|
||||
public void init() {
|
||||
addGroup(
|
||||
GeneralSettings.getClassWrapper(),
|
||||
BridgeSettings.getClassWrapper(),
|
||||
MPPassSettings.getClassWrapper(),
|
||||
VisualSettings.getClassWrapper(),
|
||||
DebugSettings.getClassWrapper()
|
||||
GeneralSettings.INSTANCE,
|
||||
BridgeSettings.INSTANCE,
|
||||
MPPassSettings.INSTANCE,
|
||||
VisualSettings.INSTANCE,
|
||||
DebugSettings.INSTANCE
|
||||
);
|
||||
|
||||
ViaFabricPlus.INSTANCE.getEventDispatcher().post(new InitializeSettingsListener.InitializeSettingsEvent());
|
||||
InitializeSettingsCallback.EVENT.invoker().onInitializeSettings();
|
||||
|
||||
loadConfig();
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(this::save));
|
||||
|
@ -21,7 +21,7 @@ import de.florianmichael.viafabricplus.settings.base.SettingGroup;
|
||||
import de.florianmichael.viafabricplus.settings.type_impl.BooleanSetting;
|
||||
|
||||
public class BridgeSettings extends SettingGroup {
|
||||
private final static BridgeSettings self = new BridgeSettings();
|
||||
public final static BridgeSettings INSTANCE = new BridgeSettings();
|
||||
|
||||
public final BooleanSetting optionsButtonInGameOptions = new BooleanSetting(this, "Options button in game options", true);
|
||||
public final BooleanSetting showExtraInformationInDebugHud = new BooleanSetting(this, "Show extra information in Debug Hud", true);
|
||||
@ -30,8 +30,4 @@ public class BridgeSettings extends SettingGroup {
|
||||
public BridgeSettings() {
|
||||
super("Bridge");
|
||||
}
|
||||
|
||||
public static BridgeSettings getClassWrapper() {
|
||||
return BridgeSettings.self;
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import de.florianmichael.vialoadingbase.platform.ProtocolRange;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
|
||||
public class DebugSettings extends SettingGroup {
|
||||
public static final DebugSettings self = new DebugSettings();
|
||||
public final static DebugSettings INSTANCE = new DebugSettings();
|
||||
|
||||
// 1.19 -> 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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.vialoadingbase.platform.raknet;
|
||||
package de.florianmichael.viafabricplus.vialoadingbase.constants;
|
||||
|
||||
public class BedrockRakNetConstants {
|
||||
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.vialoadingbase.platform.pre_netty;
|
||||
package de.florianmichael.viafabricplus.vialoadingbase.constants;
|
||||
|
||||
public class PreNettyConstants {
|
||||
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.vialoadingbase.platform.raknet;
|
||||
package de.florianmichael.viafabricplus.vialoadingbase.platform.viabedrock;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.vialoadingbase.platform.raknet;
|
||||
package de.florianmichael.viafabricplus.vialoadingbase.platform.viabedrock;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.vialoadingbase.platform.raknet;
|
||||
package de.florianmichael.viafabricplus.vialoadingbase.platform.viabedrock;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.CompositeByteBuf;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.vialoadingbase.platform.raknet;
|
||||
package de.florianmichael.viafabricplus.vialoadingbase.platform.viabedrock;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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;
|
@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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 {
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.vialoadingbase.provider;
|
||||
package de.florianmichael.viafabricplus.vialoadingbase.provider.vialegacy;
|
||||
|
||||
import com.mojang.authlib.Agent;
|
||||
import com.mojang.authlib.GameProfileRepository;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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();
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
Loading…
Reference in New Issue
Block a user