Update patches to handle vineflower decompiler (#10406)

* Update patches to handle vineflower decompiler

* update patches again to handle inlined simple lambdas

* update vf again and re-apply/rebuild patches

* update patches after removal of verify-merges flag

* fix compile issue

* remove maven local

* fix some issues

* address more issues

* fix collision patch

* use paperweight release

* more fixes

* update fineflower and fix patches again

* add missing comment descriptor

---------

Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
This commit is contained in:
Jake Potrebic
2024-04-12 12:14:06 -07:00
parent 99625a6d53
commit 89528bff42
128 changed files with 1079 additions and 1150 deletions

View File

@@ -179,8 +179,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> {
- private final byte[] encodeBuf = new byte[8192];
+ private final byte[] encodeBuf; // Paper - Use Velocity cipher
+ @javax.annotation.Nullable private final byte[] encodeBuf; // Paper - Use Velocity cipher
+ @javax.annotation.Nullable // Paper - Use Velocity cipher
private final Deflater deflater;
+ @javax.annotation.Nullable // Paper - Use Velocity cipher
+ private final com.velocitypowered.natives.compression.VelocityCompressor compressor; // Paper - Use Velocity cipher
private int threshold;
@@ -188,7 +190,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public CompressionEncoder(int compressionThreshold) {
+ this(null, compressionThreshold);
+ }
+ public CompressionEncoder(com.velocitypowered.natives.compression.VelocityCompressor compressor, int compressionThreshold) {
+ public CompressionEncoder(@javax.annotation.Nullable com.velocitypowered.natives.compression.VelocityCompressor compressor, int compressionThreshold) {
this.threshold = compressionThreshold;
- this.deflater = new Deflater();
+ if (compressor == null) {
@@ -209,8 +211,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
VarInt.write(byteBuf2, 0);
byteBuf2.writeBytes(byteBuf);
} else {
+ // Paper start - Use Velocity cipher
+ if (this.deflater != null) {
+ if (this.deflater != null) { // Paper - Use Velocity cipher
byte[] bs = new byte[i];
byteBuf.readBytes(bs);
VarInt.write(byteBuf2, bs.length);
@@ -218,6 +219,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
this.deflater.reset();
+ // Paper start - Use Velocity cipher
+ return;
+ }
+
@@ -228,12 +230,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } finally {
+ compatibleIn.release();
+ }
+ // Paper end - Use Velocity cipher
}
}
+ // Paper start - Use Velocity cipher
+ }
+ }
+
+ @Override
+ protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) throws Exception{
+ if (this.compressor != null) {
@@ -256,13 +255,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
+ if (this.compressor != null) {
+ this.compressor.close();
+ }
+ }
+ // Paper end - Use Velocity cipher
+
public int getThreshold() {
return this.threshold;
+ // Paper end - Use Velocity cipher
}
}
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/Connection.java