Skip to content

Commit 7c923b7

Browse files
Lulu13022002kennytv
authored andcommitted
[ci skip] migrate remaining patches to jspecify
1 parent 8650896 commit 7c923b7

5 files changed

Lines changed: 55 additions & 63 deletions

File tree

paper-server/patches/features/0001-Moonrise-optimisation-patches.patch

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33466,7 +33466,7 @@ index 8d3eb23eb607c862e15fb9e2e7f71a2019b02d04..6eb1a3a83c5bae8935c042396d676f7a
3346633466
}
3346733467
}
3346833468
diff --git a/net/minecraft/world/level/chunk/status/ChunkStep.java b/net/minecraft/world/level/chunk/status/ChunkStep.java
33469-
index 3e381c26fe9a646c73704515f57ba09d9533f37e..06d5de6ccdd07b1645f656170863b419d8d23fc5 100644
33469+
index 3e381c26fe9a646c73704515f57ba09d9533f37e..554faa6ebfc7c7db11634fc9a8cac846df9b92fb 100644
3347033470
--- a/net/minecraft/world/level/chunk/status/ChunkStep.java
3347133471
+++ b/net/minecraft/world/level/chunk/status/ChunkStep.java
3347233472
@@ -11,9 +11,50 @@ import net.minecraft.world.level.chunk.ChunkAccess;
@@ -33476,7 +33476,7 @@ index 3e381c26fe9a646c73704515f57ba09d9533f37e..06d5de6ccdd07b1645f656170863b419
3347633476
-public record ChunkStep(
3347733477
- ChunkStatus targetStatus, ChunkDependencies directDependencies, ChunkDependencies accumulatedDependencies, int blockStateWriteRadius, ChunkStatusTask task
3347833478
-) {
33479-
+// Paper start - rewerite chunk system - convert record to class
33479+
+// Paper start - rewrite chunk system - convert record to class
3348033480
+public final class ChunkStep implements ca.spottedleaf.moonrise.patches.chunk_system.status.ChunkSystemChunkStep { // Paper - rewrite chunk system
3348133481
+ private final ChunkStatus targetStatus;
3348233482
+ private final ChunkDependencies directDependencies;
@@ -33518,16 +33518,16 @@ index 3e381c26fe9a646c73704515f57ba09d9533f37e..06d5de6ccdd07b1645f656170863b419
3351833518
+ }
3351933519
+ // Paper end - rewrite chunk system
3352033520
+
33521-
+ // Paper end - rewerite chunk system - convert record to class
33521+
+ // Paper end - rewrite chunk system - convert record to class
3352233522
+
3352333523
public int getAccumulatedRadiusOf(final ChunkStatus status) {
3352433524
return status == this.targetStatus ? 0 : this.accumulatedDependencies.getRadiusOf(status);
3352533525
}
33526-
@@ -39,6 +80,56 @@ public record ChunkStep(
33526+
@@ -39,6 +80,55 @@ public record ChunkStep(
3352733527
return newCenterChunk;
3352833528
}
3352933529

33530-
+ // Paper start - rewerite chunk system - convert record to class
33530+
+ // Paper start - rewrite chunk system - convert record to class
3353133531
+ public ChunkStatus targetStatus() {
3353233532
+ return targetStatus;
3353333533
+ }
@@ -33574,8 +33574,7 @@ index 3e381c26fe9a646c73704515f57ba09d9533f37e..06d5de6ccdd07b1645f656170863b419
3357433574
+ "blockStateWriteRadius=" + blockStateWriteRadius + ", " +
3357533575
+ "task=" + task + ']';
3357633576
+ }
33577-
+ // Paper end - rewerite chunk system - convert record to class
33578-
+
33577+
+ // Paper end - rewrite chunk system - convert record to class
3357933578
+
3358033579
public static class Builder {
3358133580
private final ChunkStatus status;
@@ -34157,7 +34156,7 @@ index b0b7af7e541eef20063c11ee94d7a6ceaec1626a..18be8647455dee182622f3bbefa91225
3415734156

3415834157
private record PackedChunk<T>(Int2ObjectMap<T> sectionsByY, boolean versionChanged) {
3415934158
diff --git a/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
34160-
index 480623c30777fd230bf8428b16364db09806562b..22a83f312d357176a5489e5b6b71c3ef3e737df7 100644
34159+
index 480623c30777fd230bf8428b16364db09806562b..1e0afa9590de7fe492cf29aded96be3db498c51e 100644
3416134160
--- a/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
3416234161
+++ b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
3416334162
@@ -145,7 +145,7 @@ public record SerializableChunkData(
@@ -34368,20 +34367,17 @@ index 480623c30777fd230bf8428b16364db09806562b..22a83f312d357176a5489e5b6b71c3ef
3436834367
return tag;
3436934368
}
3437034369

34371-
@@ -668,6 +775,66 @@ public record SerializableChunkData(
34370+
@@ -668,6 +775,60 @@ public record SerializableChunkData(
3437234371
}
3437334372
}
3437434373

3437534374
- public record SectionData(int y, @Nullable LevelChunkSection chunkSection, @Nullable DataLayer blockLight, @Nullable DataLayer skyLight) {
3437634375
+ // Paper start - starlight - convert from record
3437734376
+ public static final class SectionData implements ca.spottedleaf.moonrise.patches.starlight.storage.StarlightSectionData { // Paper - starlight - our diff
3437834377
+ private final int y;
34379-
+ @javax.annotation.Nullable
34380-
+ private final net.minecraft.world.level.chunk.LevelChunkSection chunkSection;
34381-
+ @javax.annotation.Nullable
34382-
+ private final net.minecraft.world.level.chunk.DataLayer blockLight;
34383-
+ @javax.annotation.Nullable
34384-
+ private final net.minecraft.world.level.chunk.DataLayer skyLight;
34378+
+ private final @Nullable LevelChunkSection chunkSection;
34379+
+ private final @Nullable DataLayer blockLight;
34380+
+ private final @Nullable DataLayer skyLight;
3438534381
+
3438634382
+ // Paper start - starlight - our diff
3438734383
+ private int blockLightState = -1;
@@ -34408,30 +34404,27 @@ index 480623c30777fd230bf8428b16364db09806562b..22a83f312d357176a5489e5b6b71c3ef
3440834404
+ }
3440934405
+ // Paper end - starlight - our diff
3441034406
+
34411-
+ public SectionData(int y, @javax.annotation.Nullable net.minecraft.world.level.chunk.LevelChunkSection chunkSection, @javax.annotation.Nullable net.minecraft.world.level.chunk.DataLayer blockLight, @javax.annotation.Nullable net.minecraft.world.level.chunk.DataLayer skyLight) {
34407+
+ public SectionData(int y, @Nullable LevelChunkSection chunkSection, @Nullable DataLayer blockLight, @Nullable DataLayer skyLight) {
3441234408
+ this.y = y;
3441334409
+ this.chunkSection = chunkSection;
3441434410
+ this.blockLight = blockLight;
3441534411
+ this.skyLight = skyLight;
3441634412
+ }
3441734413
+
3441834414
+ public int y() {
34419-
+ return y;
34415+
+ return this.y;
3442034416
+ }
3442134417
+
34422-
+ @javax.annotation.Nullable
34423-
+ public net.minecraft.world.level.chunk.LevelChunkSection chunkSection() {
34424-
+ return chunkSection;
34418+
+ public @Nullable LevelChunkSection chunkSection() {
34419+
+ return this.chunkSection;
3442534420
+ }
3442634421
+
34427-
+ @javax.annotation.Nullable
34428-
+ public net.minecraft.world.level.chunk.DataLayer blockLight() {
34429-
+ return blockLight;
34422+
+ public @Nullable DataLayer blockLight() {
34423+
+ return this.blockLight;
3443034424
+ }
3443134425
+
34432-
+ @javax.annotation.Nullable
34433-
+ public net.minecraft.world.level.chunk.DataLayer skyLight() {
34434-
+ return skyLight;
34426+
+ public @Nullable DataLayer skyLight() {
34427+
+ return this.skyLight;
3443534428
+ }
3443634429
+ // Paper end - starlight - convert from record
3443734430
}

paper-server/patches/features/0003-Optimize-Connection-and-add-advanced-packet-support.patch

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -335,26 +335,26 @@ index 0bc6ab5e498f82c5b3cbdf8dddfed6c8406ad511..9cd6ec17981da310be1d35054af080d6
335335
+ // Paper end - Optimize network
336336
}
337337
diff --git a/net/minecraft/network/protocol/Packet.java b/net/minecraft/network/protocol/Packet.java
338-
index 1480d0db90f5797e3dee19503e52d1e783493ac3..f6cfce2ce30a426cd57a89f3f8ccf144b6050363 100644
338+
index 1480d0db90f5797e3dee19503e52d1e783493ac3..bd76e55ea56dd7c1e232806d1d13a747af157ced 100644
339339
--- a/net/minecraft/network/protocol/Packet.java
340340
+++ b/net/minecraft/network/protocol/Packet.java
341-
@@ -35,4 +35,32 @@ public interface Packet<T extends PacketListener> {
341+
@@ -35,4 +35,31 @@ public interface Packet<T extends PacketListener> {
342342
static <B extends ByteBuf, T extends Packet<?>> StreamCodec<B, T> codec(final StreamMemberEncoder<B, T> writer, final StreamDecoder<B, T> reader) {
343343
return StreamCodec.ofMember(writer, reader);
344344
}
345345
+
346346
+ // Paper start
347347
+ /**
348-
+ * @param player Null if not at PLAY stage yet
348+
+ * @param player null if not at PLAY stage yet
349349
+ */
350-
+ default void onPacketDispatch(@javax.annotation.Nullable net.minecraft.server.level.ServerPlayer player) {
350+
+ default void onPacketDispatch(net.minecraft.server.level.@org.jspecify.annotations.Nullable ServerPlayer player) {
351351
+ }
352352
+
353353
+ /**
354-
+ * @param player Null if not at PLAY stage yet
355-
+ * @param future Can be null if packet was cancelled
354+
+ * @param player null if not at PLAY stage yet
355+
+ * @param future can be null if packet was cancelled
356356
+ */
357-
+ default void onPacketDispatchFinish(@javax.annotation.Nullable net.minecraft.server.level.ServerPlayer player, @javax.annotation.Nullable io.netty.channel.ChannelFuture future) {
357+
+ default void onPacketDispatchFinish(net.minecraft.server.level.@org.jspecify.annotations.Nullable ServerPlayer player, io.netty.channel.@org.jspecify.annotations.Nullable ChannelFuture future) {
358358
+ }
359359
+
360360
+ default boolean hasFinishListener() {
@@ -365,8 +365,7 @@ index 1480d0db90f5797e3dee19503e52d1e783493ac3..f6cfce2ce30a426cd57a89f3f8ccf144
365365
+ return true;
366366
+ }
367367
+
368-
+ @javax.annotation.Nullable
369-
+ default java.util.List<Packet<?>> getExtraPackets() {
368+
+ default java.util.@org.jspecify.annotations.Nullable List<Packet<?>> getExtraPackets() {
370369
+ return null;
371370
+ }
372371
+ // Paper end

paper-server/patches/features/0008-Use-Velocity-compression-and-cipher-natives.patch

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,25 +169,25 @@ index 2f660186f00414b37fa5c01d00c048173feaef13..fe3f0b59561e7b7236aba9cca2a13cee
169169
this.validateDecompressed = validateDecompressed;
170170
}
171171
diff --git a/net/minecraft/network/CompressionEncoder.java b/net/minecraft/network/CompressionEncoder.java
172-
index 319325e741cc314b84844bb49ea569aaf014f319..7d8986fe3c96cef829275ddd113bcd8a8d7ec583 100644
172+
index 319325e741cc314b84844bb49ea569aaf014f319..20b5cfe1ce36d74cd6b2f95566a1bc34fc0aaa7f 100644
173173
--- a/net/minecraft/network/CompressionEncoder.java
174174
+++ b/net/minecraft/network/CompressionEncoder.java
175-
@@ -6,17 +6,31 @@ import io.netty.handler.codec.MessageToByteEncoder;
175+
@@ -6,17 +6,30 @@ import io.netty.handler.codec.MessageToByteEncoder;
176176
import java.util.zip.Deflater;
177177

178178
public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> {
179179
- private final byte[] encodeBuf = new byte[8192];
180-
+ @javax.annotation.Nullable private final byte[] encodeBuf; // Paper - Use Velocity cipher
181-
+ @javax.annotation.Nullable // Paper - Use Velocity cipher
182-
private final Deflater deflater;
183-
+ @javax.annotation.Nullable private final com.velocitypowered.natives.compression.VelocityCompressor compressor; // Paper - Use Velocity cipher
180+
- private final Deflater deflater;
181+
+ private final byte @org.jspecify.annotations.Nullable [] encodeBuf; // Paper - Use Velocity cipher
182+
+ private final @org.jspecify.annotations.Nullable Deflater deflater; // Paper - Use Velocity cipher
183+
+ private final com.velocitypowered.natives.compression.@org.jspecify.annotations.Nullable VelocityCompressor compressor; // Paper - Use Velocity cipher
184184
private int threshold;
185185

186186
+ // Paper start - Use Velocity cipher
187187
public CompressionEncoder(final int threshold) {
188188
+ this(null, threshold);
189189
+ }
190-
+ public CompressionEncoder(@javax.annotation.Nullable final com.velocitypowered.natives.compression.VelocityCompressor compressor, final int threshold) {
190+
+ public CompressionEncoder(final com.velocitypowered.natives.compression.@org.jspecify.annotations.Nullable VelocityCompressor compressor, final int threshold) {
191191
this.threshold = threshold;
192192
- this.deflater = new Deflater();
193193
+ if (compressor == null) {
@@ -207,15 +207,15 @@ index 319325e741cc314b84844bb49ea569aaf014f319..7d8986fe3c96cef829275ddd113bcd8a
207207
int uncompressedLength = uncompressed.readableBytes();
208208
if (uncompressedLength > 8388608) {
209209
throw new IllegalArgumentException("Packet too big (is " + uncompressedLength + ", should be less than 8388608)");
210-
@@ -25,6 +39,7 @@ public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> {
210+
@@ -25,6 +38,7 @@ public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> {
211211
VarInt.write(out, 0);
212212
out.writeBytes(uncompressed);
213213
} else {
214214
+ if (this.deflater != null) { // Paper - Use Velocity cipher
215215
byte[] input = new byte[uncompressedLength];
216216
uncompressed.readBytes(input);
217217
VarInt.write(out, input.length);
218-
@@ -37,6 +52,17 @@ public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> {
218+
@@ -37,6 +51,17 @@ public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> {
219219
}
220220

221221
this.deflater.reset();
@@ -233,7 +233,7 @@ index 319325e741cc314b84844bb49ea569aaf014f319..7d8986fe3c96cef829275ddd113bcd8a
233233
}
234234
}
235235
}
236-
@@ -48,4 +74,31 @@ public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> {
236+
@@ -48,4 +73,31 @@ public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> {
237237
public void setThreshold(final int threshold) {
238238
this.threshold = threshold;
239239
}

0 commit comments

Comments
 (0)