diff options
author | Jake Potrebic <[email protected]> | 2024-04-10 16:27:19 -0700 |
---|---|---|
committer | Jake Potrebic <[email protected]> | 2024-04-10 16:27:19 -0700 |
commit | 6ab2636b17708c1239057e33aa8bd17ed9bcafa8 (patch) | |
tree | ee8807b4e5013e01dac3d294696a28e9a9ce48ae | |
parent | 33c84e209f37ec87800d494fc9fbe832e97dd5d2 (diff) | |
download | Paper-6ab2636b17708c1239057e33aa8bd17ed9bcafa8.tar.gz Paper-6ab2636b17708c1239057e33aa8bd17ed9bcafa8.zip |
address more issues
4 files changed, 38 insertions, 43 deletions
diff --git a/patches/server/0006-MC-Dev-fixes.patch b/patches/server/0006-MC-Dev-fixes.patch index ca597ecb37..9015aa59a2 100644 --- a/patches/server/0006-MC-Dev-fixes.patch +++ b/patches/server/0006-MC-Dev-fixes.patch @@ -39,6 +39,25 @@ index d14613f7d37198276c251e73703b060a971fac28..a6d8aca7533ad9a556d80b6dafdd93f9 return registry; } +diff --git a/src/main/java/net/minecraft/nbt/TagParser.java b/src/main/java/net/minecraft/nbt/TagParser.java +index 733303e860560f4c93372326ab4efdaf21e5ace7..ebe0efe488357ae895aaf752e9bc008b96db156f 100644 +--- a/src/main/java/net/minecraft/nbt/TagParser.java ++++ b/src/main/java/net/minecraft/nbt/TagParser.java +@@ -252,11 +252,11 @@ public class TagParser { + } + + if (typeReader == ByteTag.TYPE) { +- list.add((T)((NumericTag)tag).getAsByte()); ++ list.add((T)(Byte)((NumericTag)tag).getAsByte()); // Paper - decompile fix + } else if (typeReader == LongTag.TYPE) { +- list.add((T)((NumericTag)tag).getAsLong()); ++ list.add((T)(Long)((NumericTag)tag).getAsLong()); // Paper - decompile fix + } else { +- list.add((T)((NumericTag)tag).getAsInt()); ++ list.add((T)(Integer)((NumericTag)tag).getAsInt()); // Paper - decompile fix + } + + if (!this.hasElementSeparator()) { diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java index 68ccf051f5a769abaa0bf9508add9303c56a1193..9d6dafb4855af9ccb7bc033ebf0fca5f75ceb9c6 100644 --- a/src/main/java/net/minecraft/network/ConnectionProtocol.java diff --git a/patches/server/1008-Optimise-general-POI-access.patch b/patches/server/1008-Optimise-general-POI-access.patch index 37c3515f14..715dea7d5c 100644 --- a/patches/server/1008-Optimise-general-POI-access.patch +++ b/patches/server/1008-Optimise-general-POI-access.patch @@ -841,7 +841,7 @@ index 0000000000000000000000000000000000000000..69be1761b3b5ba7b496c1c10a4db897e + } +} diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -index ea9a3cb588213af1a1eb9a79d0b7244f99048b5e..7fe13fa3ecce56117f0b13af386be572719a86c3 100644 +index e8aa27547e3fa1a42720889c7038d4fb0273e7b5..e1b6fe9ecda25f86431baf414f1bfd3a26a8b2bd 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java @@ -71,11 +71,11 @@ public class AcquirePoi { @@ -884,10 +884,10 @@ index d5a549f08b98c80a5cf0eef02cb8a389c32dfecb..92731b6b593289e9f583c9b705b219e8 BlockPos blockPos = path.getTarget(); Optional<Holder<PoiType>> optional = poiManager.getType(blockPos); diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -index c07cc1bf3b98525d72924edee4233364fd8174d0..3ac271b10c63fae4afcadc59140c0ad5b794f129 100644 +index c07cc1bf3b98525d72924edee4233364fd8174d0..61a06706f1468a8d4cceb9fb2aae61cf56bd991d 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -@@ -124,40 +124,48 @@ public class PoiManager extends SectionStorage<PoiSection> { +@@ -124,36 +124,45 @@ public class PoiManager extends SectionStorage<PoiSection> { public Optional<BlockPos> find( Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus ) { @@ -938,23 +938,16 @@ index c07cc1bf3b98525d72924edee4233364fd8174d0..3ac271b10c63fae4afcadc59140c0ad5 - return this.getInRange(typePredicate, pos, radius, PoiManager.Occupancy.HAS_SPACE) - .filter(poi -> biPredicate.test(poi.getPoiType(), poi.getPos())) - .findFirst() -- .map(poi -> { -- poi.acquireTicket(); -- return poi.getPos(); -- }); + // Paper start - re-route to faster logic + final @javax.annotation.Nullable PoiRecord closest = io.papermc.paper.util.PoiAccess.findClosestPoiDataRecord( + this, typePredicate, biPredicate, pos, radius, radius * radius, Occupancy.HAS_SPACE, false + ); -+ return Optional.ofNullable(closest).map(poi -> { ++ return Optional.ofNullable(closest) + // Paper end - re-route to faster logic -+ poi.acquireTicket(); -+ return poi.getPos(); -+ }); - } - - public Optional<BlockPos> getRandom( -@@ -168,8 +176,21 @@ public class PoiManager extends SectionStorage<PoiSection> { + .map(poi -> { + poi.acquireTicket(); + return poi.getPos(); +@@ -168,8 +177,21 @@ public class PoiManager extends SectionStorage<PoiSection> { int radius, RandomSource random ) { diff --git a/patches/server/1013-Use-Velocity-compression-and-cipher-natives.patch b/patches/server/1013-Use-Velocity-compression-and-cipher-natives.patch index d06acf313e..a9cc979072 100644 --- a/patches/server/1013-Use-Velocity-compression-and-cipher-natives.patch +++ b/patches/server/1013-Use-Velocity-compression-and-cipher-natives.patch @@ -171,16 +171,18 @@ index 5927c928b27f64bd3973e95d5867b59f67476d41..76aeebe60ac321ed604661a0ec969bb2 ByteBuffer byteBuffer; if (buf.nioBufferCount() > 0) { diff --git a/src/main/java/net/minecraft/network/CompressionEncoder.java b/src/main/java/net/minecraft/network/CompressionEncoder.java -index 11a466558c77b43969b8e4be3a3470f84c7fcb1a..3e648aa2f15708ebec3d6e002e5fb49347876767 100644 +index 11a466558c77b43969b8e4be3a3470f84c7fcb1a..ae6e8ab9c1afa31d808f1fce2654a8b95bee6c31 100644 --- a/src/main/java/net/minecraft/network/CompressionEncoder.java +++ b/src/main/java/net/minecraft/network/CompressionEncoder.java -@@ -6,21 +6,36 @@ import io.netty.handler.codec.MessageToByteEncoder; +@@ -6,21 +6,37 @@ import io.netty.handler.codec.MessageToByteEncoder; import java.util.zip.Deflater; 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 11a466558c77b43969b8e4be3a3470f84c7fcb1a..3e648aa2f15708ebec3d6e002e5fb493 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,15 +211,15 @@ index 11a466558c77b43969b8e4be3a3470f84c7fcb1a..3e648aa2f15708ebec3d6e002e5fb493 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); -@@ -33,8 +48,46 @@ public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> { +@@ -33,6 +49,43 @@ public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> { } this.deflater.reset(); ++ // Paper start - Use Velocity cipher + return; + } + @@ -228,11 +230,9 @@ index 11a466558c77b43969b8e4be3a3470f84c7fcb1a..3e648aa2f15708ebec3d6e002e5fb493 + } 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) { @@ -255,12 +255,10 @@ index 11a466558c77b43969b8e4be3a3470f84c7fcb1a..3e648aa2f15708ebec3d6e002e5fb493 + public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { + if (this.compressor != null) { + this.compressor.close(); ++ // Paper end - Use Velocity cipher } } -+ // Paper end - Use Velocity cipher - public int getThreshold() { - return this.threshold; diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java index 7f2aa5e17fe675f3404d67b1794d2ca68b188eb9..fff375fd50fa1a804636a92ded1ae55cff42977d 100644 --- a/src/main/java/net/minecraft/network/Connection.java diff --git a/patches/server/1034-Improve-tag-parser-handling.patch b/patches/server/1034-Improve-tag-parser-handling.patch index 4ce624ebc9..30bd53f874 100644 --- a/patches/server/1034-Improve-tag-parser-handling.patch +++ b/patches/server/1034-Improve-tag-parser-handling.patch @@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..a375ad4ba9db990b24a2b9ff366fcba6 + } +} diff --git a/src/main/java/net/minecraft/nbt/TagParser.java b/src/main/java/net/minecraft/nbt/TagParser.java -index 733303e860560f4c93372326ab4efdaf21e5ace7..39b5850c4be7e61de2a8bcfe781504aa9784674f 100644 +index ebe0efe488357ae895aaf752e9bc008b96db156f..c77860a141064aea6a0b510bb44d35fea90aee42 100644 --- a/src/main/java/net/minecraft/nbt/TagParser.java +++ b/src/main/java/net/minecraft/nbt/TagParser.java @@ -48,6 +48,7 @@ public class TagParser { @@ -97,21 +97,6 @@ index 733303e860560f4c93372326ab4efdaf21e5ace7..39b5850c4be7e61de2a8bcfe781504aa return listTag; } } -@@ -252,11 +257,11 @@ public class TagParser { - } - - if (typeReader == ByteTag.TYPE) { -- list.add((T)((NumericTag)tag).getAsByte()); -+ list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix - } else if (typeReader == LongTag.TYPE) { -- list.add((T)((NumericTag)tag).getAsLong()); -+ list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix - } else { -- list.add((T)((NumericTag)tag).getAsInt()); -+ list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix - } - - if (!this.hasElementSeparator()) { @@ -287,4 +292,11 @@ public class TagParser { this.reader.skipWhitespace(); this.reader.expect(c); |