+ Handshake::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x00 )
);
}
@@ -64,6 +65,7 @@ public enum Protocol
{
TO_CLIENT.registerPacket(
KeepAlive.class,
+ KeepAlive::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x00 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x1F ),
map( ProtocolConstants.MINECRAFT_1_13, 0x21 ),
@@ -71,18 +73,21 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
Login.class,
+ Login::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x01 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x23 ),
map( ProtocolConstants.MINECRAFT_1_13, 0x25 )
);
TO_CLIENT.registerPacket(
Chat.class,
+ Chat::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x02 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x0F ),
map( ProtocolConstants.MINECRAFT_1_13, 0x0E )
);
TO_CLIENT.registerPacket(
Respawn.class,
+ Respawn::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x07 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x33 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x34 ),
@@ -92,11 +97,13 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
BossBar.class,
+ BossBar::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_9, 0x0C )
);
// 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),
@@ -107,6 +114,7 @@ public enum Protocol
);
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),
@@ -117,6 +125,7 @@ public enum Protocol
// Waterfall end
TO_CLIENT.registerPacket(
PlayerListItem.class, // PlayerInfo
+ PlayerListItem::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x38 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x2D ),
map( ProtocolConstants.MINECRAFT_1_12_1, 0x2E ),
@@ -125,12 +134,14 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
TabCompleteResponse.class,
+ TabCompleteResponse::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x3A ),
map( ProtocolConstants.MINECRAFT_1_9, 0x0E ),
map( ProtocolConstants.MINECRAFT_1_13, 0x10 )
);
TO_CLIENT.registerPacket(
ScoreboardObjective.class,
+ ScoreboardObjective::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x3B ),
map( ProtocolConstants.MINECRAFT_1_9, 0x3F ),
map( ProtocolConstants.MINECRAFT_1_12, 0x41 ),
@@ -140,6 +151,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
ScoreboardScore.class,
+ ScoreboardScore::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x3C ),
map( ProtocolConstants.MINECRAFT_1_9, 0x42 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x44 ),
@@ -149,6 +161,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
ScoreboardDisplay.class,
+ ScoreboardDisplay::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x3D ),
map( ProtocolConstants.MINECRAFT_1_9, 0x38 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x3A ),
@@ -158,6 +171,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
Team.class,
+ Team::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x3E ),
map( ProtocolConstants.MINECRAFT_1_9, 0x41 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x43 ),
@@ -167,6 +181,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
PluginMessage.class,
+ PluginMessage::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x3F ),
map( ProtocolConstants.MINECRAFT_1_9, 0x18 ),
map( ProtocolConstants.MINECRAFT_1_13, 0x19 ),
@@ -174,6 +189,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
Kick.class,
+ Kick::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x40 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x1A ),
map( ProtocolConstants.MINECRAFT_1_13, 0x1B ),
@@ -181,6 +197,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
Title.class,
+ Title::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x45 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x47 ),
map( ProtocolConstants.MINECRAFT_1_12_1, 0x48 ),
@@ -189,6 +206,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
PlayerListHeaderFooter.class,
+ PlayerListHeaderFooter::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x47 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x48 ),
map( ProtocolConstants.MINECRAFT_1_9_4, 0x47 ),
@@ -199,6 +217,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
EntityStatus.class,
+ EntityStatus::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x1A ),
map( ProtocolConstants.MINECRAFT_1_9, 0x1B ),
map( ProtocolConstants.MINECRAFT_1_13, 0x1C ),
@@ -206,6 +225,7 @@ public enum Protocol
);
TO_CLIENT.registerPacket(
Commands.class,
+ Commands::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_13, 0x11 )
);
TO_CLIENT.registerPacket(
@@ -215,6 +235,7 @@ public enum Protocol
TO_SERVER.registerPacket(
KeepAlive.class,
+ KeepAlive::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x00 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x0B ),
map( ProtocolConstants.MINECRAFT_1_12, 0x0C ),
@@ -224,6 +245,7 @@ public enum Protocol
);
TO_SERVER.registerPacket(
Chat.class,
+ Chat::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x01 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x02 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x03 ),
@@ -232,6 +254,7 @@ public enum Protocol
);
TO_SERVER.registerPacket(
TabCompleteRequest.class,
+ TabCompleteRequest::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x14 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x01 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x02 ),
@@ -241,6 +264,7 @@ public enum Protocol
);
TO_SERVER.registerPacket(
ClientSettings.class,
+ ClientSettings::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x15 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x04 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x05 ),
@@ -249,6 +273,7 @@ public enum Protocol
);
TO_SERVER.registerPacket(
PluginMessage.class,
+ PluginMessage::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x17 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x09 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x0A ),
@@ -265,19 +290,23 @@ public enum Protocol
{
TO_CLIENT.registerPacket(
StatusResponse.class,
+ StatusResponse::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x00 )
);
TO_CLIENT.registerPacket(
PingPacket.class,
+ PingPacket::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x01 )
);
TO_SERVER.registerPacket(
StatusRequest.class,
+ StatusRequest::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x00 )
);
TO_SERVER.registerPacket(
PingPacket.class,
+ PingPacket::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x01 )
);
}
@@ -289,35 +318,43 @@ public enum Protocol
{
TO_CLIENT.registerPacket(
Kick.class,
+ Kick::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x00 )
);
TO_CLIENT.registerPacket(
EncryptionRequest.class,
+ EncryptionRequest::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x01 )
);
TO_CLIENT.registerPacket(
LoginSuccess.class,
+ LoginSuccess::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x02 )
);
TO_CLIENT.registerPacket(
SetCompression.class,
+ SetCompression::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x03 )
);
TO_CLIENT.registerPacket(
LoginPayloadRequest.class,
+ LoginPayloadRequest::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_13, 0x04 )
);
TO_SERVER.registerPacket(
LoginRequest.class,
+ LoginRequest::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x00 )
);
TO_SERVER.registerPacket(
EncryptionResponse.class,
+ EncryptionResponse::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_8, 0x01 )
);
TO_SERVER.registerPacket(
LoginPayloadResponse.class,
+ LoginPayloadResponse::new, // Waterfall - speed up packet construction
map( ProtocolConstants.MINECRAFT_1_13, 0x02 )
);
}
@@ -368,7 +405,7 @@ public enum Protocol
private final int protocolVersion;
private final TObjectIntMap<Class<? extends DefinedPacket>> packetMap = new TObjectIntHashMap<>( MAX_PACKET_ID );
- private final Constructor<? extends DefinedPacket>[] packetConstructors = new Constructor[ MAX_PACKET_ID ];
+ private final java.util.function.Supplier<? extends DefinedPacket>[] packetConstructors = new java.util.function.Supplier[ MAX_PACKET_ID ]; // Waterfall - speed up packet construction
}
@Data
@@ -436,21 +473,24 @@ public enum Protocol
throw new BadPacketException( "Packet with id " + id + " outside of range " );