Skip to content

Commit

Permalink
Enable velocity forward protocol 2
Browse files Browse the repository at this point in the history
  • Loading branch information
james58899 committed Jun 9, 2022
1 parent 26dbada commit 4c35f75
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ minecraft_version=1.19
yarn_mappings=1.19+build.1
loader_version=0.14.6
# Mod Properties
mod_version=2.0.0
mod_version=2.1.0
maven_group=one.oktw
archives_base_name=FabricProxy-Lite
# Dependencies
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/one/oktw/FabricProxyLite.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import com.moandjiezana.toml.Toml;
import com.moandjiezana.toml.TomlWriter;
import io.netty.buffer.Unpooled;
import net.fabricmc.api.DedicatedServerModInitializer;
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.fabricmc.fabric.api.networking.v1.ServerLoginConnectionEvents;
import net.fabricmc.fabric.api.networking.v1.ServerLoginNetworking;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.network.PacketByteBuf;
import org.apache.logging.log4j.LogManager;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
Expand All @@ -22,10 +23,11 @@ public class FabricProxyLite implements DedicatedServerModInitializer, IMixinCon

@Override
public void onInitializeServer() {
PacketByteBuf packet = new PacketByteBuf(Unpooled.wrappedBuffer(new byte[]{(byte) VelocityLib.MODERN_FORWARDING_WITH_KEY}).asReadOnly());
// Packet receiver
ServerLoginNetworking.registerGlobalReceiver(VelocityLib.PLAYER_INFO_CHANNEL, new PacketHandler(config)::handleVelocityPacket);
if (!config.getHackEarlySend()) {
ServerLoginConnectionEvents.QUERY_START.register((handler, server, sender, synchronizer) -> sender.sendPacket(VelocityLib.PLAYER_INFO_CHANNEL, PacketByteBufs.empty()));
ServerLoginConnectionEvents.QUERY_START.register((handler, server, sender, synchronizer) -> sender.sendPacket(VelocityLib.PLAYER_INFO_CHANNEL, packet));
}
}

Expand Down

1 comment on commit 4c35f75

@Xernium
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As always thank you very much for this awesome mod.
❤️

Please sign in to comment.