Don't register entity effect packets for 1.9+

This commit is contained in:
Shane Freeder 2021-04-30 00:48:32 +01:00
parent f188d4c751
commit bf21a394fa
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
2 changed files with 49 additions and 54 deletions

View File

@ -1,4 +1,4 @@
From d1cae1a3697ae9bfa0599b0e4658a2cee7fbb07a Mon Sep 17 00:00:00 2001
From 266bc30c5330ef442070a9e7d122d756ca7dca0b Mon Sep 17 00:00:00 2001
From: Aaron Hill <aa1ronham@gmail.com>
Date: Thu, 15 Sep 2016 22:38:37 +0200
Subject: [PATCH] Fix potion race condition on Forge 1.8.9
@ -33,7 +33,7 @@ index ac31e435..252389bd 100644
+ // 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 50a911c2..66c925d0 100644
index 50a911c2..3a686e60 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
@@ -17,6 +17,8 @@ import net.md_5.bungee.protocol.packet.EncryptionRequest;
@ -45,7 +45,7 @@ index 50a911c2..66c925d0 100644
import net.md_5.bungee.protocol.packet.Handshake;
import net.md_5.bungee.protocol.packet.KeepAlive;
import net.md_5.bungee.protocol.packet.Kick;
@@ -106,6 +108,32 @@ public enum Protocol
@@ -106,6 +108,18 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_15, 0x0D ),
map( ProtocolConstants.MINECRAFT_1_16, 0x0C )
);
@ -53,31 +53,29 @@ index 50a911c2..66c925d0 100644
+ TO_CLIENT.registerPacket(
+ EntityEffect.class,
+ map(ProtocolConstants.MINECRAFT_1_8, 0x1D),
+ map(ProtocolConstants.MINECRAFT_1_9, 0x4C),
+ map(ProtocolConstants.MINECRAFT_1_9_4, 0x4B),
+ map(ProtocolConstants.MINECRAFT_1_12, 0x4E),
+ map(ProtocolConstants.MINECRAFT_1_12_1, 0x4F),
+ map(ProtocolConstants.MINECRAFT_1_13, 0x53),
+ map(ProtocolConstants.MINECRAFT_1_14, 0x59),
+ map(ProtocolConstants.MINECRAFT_1_15, 0x5A),
+ map(ProtocolConstants.MINECRAFT_1_16, 0x59)
+ map(ProtocolConstants.MINECRAFT_1_9, Integer.MIN_VALUE)
+ );
+ TO_CLIENT.registerPacket(
+ EntityRemoveEffect.class,
+ map(ProtocolConstants.MINECRAFT_1_8, 0x1E),
+ map(ProtocolConstants.MINECRAFT_1_9, 0x31),
+ map(ProtocolConstants.MINECRAFT_1_12, 0x32),
+ map(ProtocolConstants.MINECRAFT_1_12_1, 0x33),
+ map(ProtocolConstants.MINECRAFT_1_13, 0x36),
+ map(ProtocolConstants.MINECRAFT_1_14, 0x38),
+ map(ProtocolConstants.MINECRAFT_1_15, 0x39),
+ map(ProtocolConstants.MINECRAFT_1_16, 0x38),
+ map(ProtocolConstants.MINECRAFT_1_16_2, 0x37)
+ map(ProtocolConstants.MINECRAFT_1_9, Integer.MIN_VALUE)
+ );
+ // Waterfall end
TO_CLIENT.registerPacket(
PlayerListItem.class, // PlayerInfo
map( ProtocolConstants.MINECRAFT_1_8, 0x38 ),
@@ -501,9 +515,11 @@ public enum Protocol
}
}
+ if (mapping.packetID != Integer.MIN_VALUE) { // Waterfall
ProtocolData data = protocols.get( protocol );
data.packetMap.put( packetClass, mapping.packetID );
data.packetConstructors[mapping.packetID] = constructor;
+ } // Waterfall
}
} catch ( NoSuchMethodException ex )
{
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/EntityEffect.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/EntityEffect.java
new file mode 100644
index 00000000..d11a9ea9
@ -172,7 +170,7 @@ index 00000000..7ed2dc3a
+ }
+}
diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
index 76ab1481..fae9805c 100644
index 5e3c27a3..bc8156cc 100644
--- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java
+++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
@@ -1,7 +1,9 @@
@ -280,5 +278,5 @@ index d15044f4..bea2bbff 100644
* Sends the server mod list to the client, or stores it for sending later.
*
--
2.28.0
2.31.1

View File

@ -1,11 +1,11 @@
From dc148013708fe031509a9aa1592078bd0b59731f Mon Sep 17 00:00:00 2001
From 25efdf442b60a21767250917e2d35da26d92372d Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Date: Wed, 17 Apr 2019 09:24:38 +0300
Subject: [PATCH] Speed up packet construction
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 66c925d0..d372933d 100644
index 3a686e60..0dffc8d2 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
@@ -54,6 +54,7 @@ public enum Protocol
@ -56,23 +56,20 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_9, 0x0C ),
map( ProtocolConstants.MINECRAFT_1_15, 0x0D ),
map( ProtocolConstants.MINECRAFT_1_16, 0x0C )
@@ -111,6 +117,7 @@ public enum Protocol
@@ -111,17 +117,20 @@ public enum Protocol
// Waterfall start
TO_CLIENT.registerPacket(
EntityEffect.class,
+ EntityEffect::new, // Waterfall - speed up packet construction
map(ProtocolConstants.MINECRAFT_1_8, 0x1D),
map(ProtocolConstants.MINECRAFT_1_9, 0x4C),
map(ProtocolConstants.MINECRAFT_1_9_4, 0x4B),
@@ -123,6 +130,7 @@ public enum Protocol
map(ProtocolConstants.MINECRAFT_1_9, Integer.MIN_VALUE)
);
TO_CLIENT.registerPacket(
EntityRemoveEffect.class,
+ EntityRemoveEffect::new, // Waterfall - speed up packet construction
map(ProtocolConstants.MINECRAFT_1_8, 0x1E),
map(ProtocolConstants.MINECRAFT_1_9, 0x31),
map(ProtocolConstants.MINECRAFT_1_12, 0x32),
@@ -136,6 +144,7 @@ public enum Protocol
map(ProtocolConstants.MINECRAFT_1_9, Integer.MIN_VALUE)
);
// Waterfall end
TO_CLIENT.registerPacket(
PlayerListItem.class, // PlayerInfo
@ -80,7 +77,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x38 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x2D ),
map( ProtocolConstants.MINECRAFT_1_12_1, 0x2E ),
@@ -147,6 +156,7 @@ public enum Protocol
@@ -133,6 +142,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
TabCompleteResponse.class,
@ -88,7 +85,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x3A ),
map( ProtocolConstants.MINECRAFT_1_9, 0x0E ),
map( ProtocolConstants.MINECRAFT_1_13, 0x10 ),
@@ -156,6 +166,7 @@ public enum Protocol
@@ -142,6 +152,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
ScoreboardObjective.class,
@ -96,7 +93,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x3B ),
map( ProtocolConstants.MINECRAFT_1_9, 0x3F ),
map( ProtocolConstants.MINECRAFT_1_12, 0x41 ),
@@ -166,6 +177,7 @@ public enum Protocol
@@ -152,6 +163,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
ScoreboardScore.class,
@ -104,7 +101,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x3C ),
map( ProtocolConstants.MINECRAFT_1_9, 0x42 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x44 ),
@@ -176,6 +188,7 @@ public enum Protocol
@@ -162,6 +174,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
ScoreboardDisplay.class,
@ -112,7 +109,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x3D ),
map( ProtocolConstants.MINECRAFT_1_9, 0x38 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x3A ),
@@ -186,6 +199,7 @@ public enum Protocol
@@ -172,6 +185,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
Team.class,
@ -120,7 +117,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x3E ),
map( ProtocolConstants.MINECRAFT_1_9, 0x41 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x43 ),
@@ -196,6 +210,7 @@ public enum Protocol
@@ -182,6 +196,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
PluginMessage.class,
@ -128,7 +125,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x3F ),
map( ProtocolConstants.MINECRAFT_1_9, 0x18 ),
map( ProtocolConstants.MINECRAFT_1_13, 0x19 ),
@@ -206,6 +221,7 @@ public enum Protocol
@@ -192,6 +207,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
Kick.class,
@ -136,7 +133,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x40 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x1A ),
map( ProtocolConstants.MINECRAFT_1_13, 0x1B ),
@@ -216,6 +232,7 @@ public enum Protocol
@@ -202,6 +218,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
Title.class,
@ -144,7 +141,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x45 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x47 ),
map( ProtocolConstants.MINECRAFT_1_12_1, 0x48 ),
@@ -226,6 +243,7 @@ public enum Protocol
@@ -212,6 +229,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
PlayerListHeaderFooter.class,
@ -152,7 +149,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x47 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x48 ),
map( ProtocolConstants.MINECRAFT_1_9_4, 0x47 ),
@@ -238,6 +256,7 @@ public enum Protocol
@@ -224,6 +242,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
EntityStatus.class,
@ -160,7 +157,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x1A ),
map( ProtocolConstants.MINECRAFT_1_9, 0x1B ),
map( ProtocolConstants.MINECRAFT_1_13, 0x1C ),
@@ -248,6 +267,7 @@ public enum Protocol
@@ -234,6 +253,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
Commands.class,
@ -168,7 +165,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_13, 0x11 ),
map( ProtocolConstants.MINECRAFT_1_15, 0x12 ),
map( ProtocolConstants.MINECRAFT_1_16, 0x11 ),
@@ -255,12 +275,14 @@ public enum Protocol
@@ -241,12 +261,14 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
GameState.class,
@ -183,7 +180,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_14, 0x41 ),
map( ProtocolConstants.MINECRAFT_1_15, 0x42 ),
map( ProtocolConstants.MINECRAFT_1_16, 0x41 )
@@ -268,6 +290,7 @@ public enum Protocol
@@ -254,6 +276,7 @@ public enum Protocol
TO_SERVER.registerPacket(
KeepAlive.class,
@ -191,7 +188,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x00 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x0B ),
map( ProtocolConstants.MINECRAFT_1_12, 0x0C ),
@@ -278,6 +301,7 @@ public enum Protocol
@@ -264,6 +287,7 @@ public enum Protocol
);
TO_SERVER.registerPacket(
Chat.class,
@ -199,7 +196,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x01 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x02 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x03 ),
@@ -286,6 +310,7 @@ public enum Protocol
@@ -272,6 +296,7 @@ public enum Protocol
);
TO_SERVER.registerPacket(
TabCompleteRequest.class,
@ -207,7 +204,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x14 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x01 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x02 ),
@@ -295,6 +320,7 @@ public enum Protocol
@@ -281,6 +306,7 @@ public enum Protocol
);
TO_SERVER.registerPacket(
ClientSettings.class,
@ -215,7 +212,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x15 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x04 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x05 ),
@@ -303,6 +329,7 @@ public enum Protocol
@@ -289,6 +315,7 @@ public enum Protocol
);
TO_SERVER.registerPacket(
PluginMessage.class,
@ -223,7 +220,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x17 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x09 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x0A ),
@@ -319,19 +346,23 @@ public enum Protocol
@@ -305,19 +332,23 @@ public enum Protocol
{
TO_CLIENT.registerPacket(
StatusResponse.class,
@ -247,7 +244,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_8, 0x01 )
);
}
@@ -343,35 +374,43 @@ public enum Protocol
@@ -329,35 +360,43 @@ public enum Protocol
{
TO_CLIENT.registerPacket(
Kick.class,
@ -291,7 +288,7 @@ index 66c925d0..d372933d 100644
map( ProtocolConstants.MINECRAFT_1_13, 0x02 )
);
}
@@ -422,7 +461,7 @@ public enum Protocol
@@ -408,7 +447,7 @@ public enum Protocol
private final int protocolVersion;
private final TObjectIntMap<Class<? extends DefinedPacket>> packetMap = new TObjectIntHashMap<>( MAX_PACKET_ID );
@ -300,7 +297,7 @@ index 66c925d0..d372933d 100644
}
@Data
@@ -490,21 +529,24 @@ public enum Protocol
@@ -476,21 +515,24 @@ public enum Protocol
throw new BadPacketException( "Packet with id " + id + " outside of range " );
}
@ -329,9 +326,9 @@ index 66c925d0..d372933d 100644
int mappingIndex = 0;
ProtocolMapping mapping = mappings[mappingIndex];
@@ -533,11 +575,32 @@ public enum Protocol
data.packetMap.put( packetClass, mapping.packetID );
@@ -521,11 +563,32 @@ public enum Protocol
data.packetConstructors[mapping.packetID] = constructor;
} // Waterfall
}
+ // Waterfall start - speed up packet construction
+ /*
@ -363,5 +360,5 @@ index 66c925d0..d372933d 100644
final int getId(Class<? extends DefinedPacket> packet, int version)
{
--
2.24.0
2.31.1