mirror of
https://github.com/PaperMC/Waterfall.git
synced 2025-01-07 16:37:39 +01:00
Handle experimental features packet
This commit is contained in:
parent
8050674c86
commit
6192b90a78
@ -0,0 +1,98 @@
|
|||||||
|
From e9a6d3da3ceac9b97ebba26625f9ec6c99de73a9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Shane Freeder <theboyetronic@gmail.com>
|
||||||
|
Date: Wed, 7 Dec 2022 18:51:23 +0000
|
||||||
|
Subject: [PATCH] Handle experimental features packet
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java b/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java
|
||||||
|
index 0c334afc..a5703d41 100644
|
||||||
|
--- a/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java
|
||||||
|
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java
|
||||||
|
@@ -13,6 +13,7 @@ import net.md_5.bungee.protocol.packet.EncryptionResponse;
|
||||||
|
import net.md_5.bungee.protocol.packet.EntityEffect; // Waterfall
|
||||||
|
import net.md_5.bungee.protocol.packet.EntityRemoveEffect; // Waterfall
|
||||||
|
import net.md_5.bungee.protocol.packet.EntityStatus;
|
||||||
|
+import net.md_5.bungee.protocol.packet.ExperimentalFeatures; // Waterfall
|
||||||
|
import net.md_5.bungee.protocol.packet.GameState;
|
||||||
|
import net.md_5.bungee.protocol.packet.Handshake;
|
||||||
|
import net.md_5.bungee.protocol.packet.KeepAlive;
|
||||||
|
@@ -234,5 +235,8 @@ public abstract class AbstractPacketHandler
|
||||||
|
public void handle(EntityRemoveEffect removeEffect) throws Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ public void handle(ExperimentalFeatures experimentalFeatures) {
|
||||||
|
+ }
|
||||||
|
// Waterfall end
|
||||||
|
}
|
||||||
|
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
|
||||||
|
index 2357f380..e20bda01 100644
|
||||||
|
--- a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
|
||||||
|
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
|
||||||
|
@@ -21,6 +21,7 @@ import net.md_5.bungee.protocol.packet.Commands;
|
||||||
|
import net.md_5.bungee.protocol.packet.EncryptionRequest;
|
||||||
|
import net.md_5.bungee.protocol.packet.EncryptionResponse;
|
||||||
|
import net.md_5.bungee.protocol.packet.EntityStatus;
|
||||||
|
+import net.md_5.bungee.protocol.packet.ExperimentalFeatures;
|
||||||
|
import net.md_5.bungee.protocol.packet.GameState;
|
||||||
|
import net.md_5.bungee.protocol.packet.EntityEffect;
|
||||||
|
import net.md_5.bungee.protocol.packet.EntityRemoveEffect;
|
||||||
|
@@ -473,6 +474,8 @@ public enum Protocol
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x0D ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0C )
|
||||||
|
);
|
||||||
|
+ TO_CLIENT.registerPacket(ExperimentalFeatures.class, ExperimentalFeatures::new,
|
||||||
|
+ map (ProtocolConstants.MINECRAFT_1_19_3, 0x67));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 1
|
||||||
|
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ExperimentalFeatures.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ExperimentalFeatures.java
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..9467f244
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ExperimentalFeatures.java
|
||||||
|
@@ -0,0 +1,41 @@
|
||||||
|
+package net.md_5.bungee.protocol.packet;
|
||||||
|
+
|
||||||
|
+import net.md_5.bungee.protocol.AbstractPacketHandler;
|
||||||
|
+import net.md_5.bungee.protocol.DefinedPacket;
|
||||||
|
+
|
||||||
|
+import java.util.ArrayList;
|
||||||
|
+import java.util.List;
|
||||||
|
+
|
||||||
|
+import io.netty.buffer.ByteBuf;
|
||||||
|
+import lombok.AllArgsConstructor;
|
||||||
|
+import lombok.Data;
|
||||||
|
+import lombok.EqualsAndHashCode;
|
||||||
|
+import lombok.NoArgsConstructor;
|
||||||
|
+
|
||||||
|
+@Data
|
||||||
|
+@NoArgsConstructor
|
||||||
|
+@AllArgsConstructor
|
||||||
|
+@EqualsAndHashCode(callSuper = false)
|
||||||
|
+public class ExperimentalFeatures extends DefinedPacket {
|
||||||
|
+ List<String> features = new ArrayList<>();
|
||||||
|
+ @Override
|
||||||
|
+ public void handle(AbstractPacketHandler handler) throws Exception {
|
||||||
|
+ handler.handle(this);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void read(ByteBuf buf) {
|
||||||
|
+ final int i = readVarInt(buf);
|
||||||
|
+ for (int i1 = 0; i1 < i; i1++) {
|
||||||
|
+ features.add(readString(buf));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void write(ByteBuf buf) {
|
||||||
|
+ writeVarInt(features.size(), buf);
|
||||||
|
+ for (String feature : features) {
|
||||||
|
+ writeString(feature, buf);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.38.1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user