mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 17:01:56 +01:00
Rebuild patches
This commit is contained in:
parent
845d5e7a06
commit
05f9968013
7 changed files with 43 additions and 102 deletions
|
@ -145,7 +145,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSto
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
|
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@Nullable
|
@Nullable
|
||||||
public CompoundTag read(ChunkPos pos) throws IOException {
|
public CompoundTag read(ChunkPos pos) throws IOException {
|
||||||
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
|
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
|
||||||
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
|
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos);
|
DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos);
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
CompoundTag nbttagcompound;
|
CompoundTag nbttagcompound;
|
||||||
label43:
|
label43:
|
||||||
{
|
{
|
||||||
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
|
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
NbtIo.write(nbt, (DataOutput) dataoutputstream);
|
NbtIo.write(nbt, (DataOutput) dataoutputstream);
|
||||||
|
|
|
@ -22,7 +22,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSto
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
|
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
|
|
||||||
protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException {
|
protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException {
|
||||||
RegionFile regionfile = this.getRegionFile(pos, false); // CraftBukkit
|
RegionFile regionfile = this.getRegionFile(pos, false); // CraftBukkit
|
||||||
|
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
if (nbt == null) {
|
if (nbt == null) {
|
||||||
regionfile.clear(pos);
|
regionfile.clear(pos);
|
||||||
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
|
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
dataoutputstream.close();
|
dataoutputstream.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSto
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
|
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
NbtIo.write(nbt, (DataOutput) dataoutputstream);
|
NbtIo.write(nbt, (DataOutput) dataoutputstream);
|
||||||
|
|
|
@ -329,7 +329,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSto
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
|
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
this.sync = dsync;
|
this.sync = dsync;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSto
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
|
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
NbtIo.write(nbt, (DataOutput) dataoutputstream);
|
NbtIo.write(nbt, (DataOutput) dataoutputstream);
|
||||||
regionfile.setStatus(pos.x, pos.z, ChunkSerializer.getStatus(nbt)); // Paper - cache status on disk
|
regionfile.setStatus(pos.x, pos.z, ChunkSerializer.getStatus(nbt)); // Paper - cache status on disk
|
||||||
regionfile.setOversized(pos.x, pos.z, false); // Paper - We don't do this anymore, mojang stores differently, but clear old meta flag if it exists to get rid of our own meta file once last oversized is gone
|
regionfile.setOversized(pos.x, pos.z, false); // Paper - We don't do this anymore, mojang stores differently, but clear old meta flag if it exists to get rid of our own meta file once last oversized is gone
|
||||||
|
@ -69,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
} catch (Throwable throwable1) {
|
} catch (Throwable throwable1) {
|
||||||
throwable.addSuppressed(throwable1);
|
throwable.addSuppressed(throwable1);
|
||||||
}
|
}
|
||||||
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
|
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
|
|
||||||
throw throwable;
|
throw throwable;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
// Paper start
|
// Paper start
|
||||||
return;
|
return;
|
||||||
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
|
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSto
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
|
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
if (regionfile != null) {
|
if (regionfile != null) {
|
||||||
return regionfile;
|
return regionfile;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -174,73 +174,23 @@ diff --git a/src/main/java/net/minecraft/network/CompressionEncoder.java b/src/m
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/network/CompressionEncoder.java
|
--- a/src/main/java/net/minecraft/network/CompressionEncoder.java
|
||||||
+++ b/src/main/java/net/minecraft/network/CompressionEncoder.java
|
+++ b/src/main/java/net/minecraft/network/CompressionEncoder.java
|
||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@ import io.netty.handler.codec.MessageToByteEncoder;
|
||||||
-package net.minecraft.network;
|
import java.util.zip.Deflater;
|
||||||
-
|
|
||||||
-import io.netty.buffer.ByteBuf;
|
public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> {
|
||||||
-import io.netty.channel.ChannelHandlerContext;
|
|
||||||
-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 = new byte[8192];
|
||||||
- private final Deflater deflater;
|
|
||||||
- private int threshold;
|
|
||||||
-
|
|
||||||
- public CompressionEncoder(int compressionThreshold) {
|
|
||||||
- this.threshold = compressionThreshold;
|
|
||||||
- this.deflater = new Deflater();
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- protected void encode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, ByteBuf byteBuf2) {
|
|
||||||
- int i = byteBuf.readableBytes();
|
|
||||||
- if (i < this.threshold) {
|
|
||||||
- VarInt.write(byteBuf2, 0);
|
|
||||||
- byteBuf2.writeBytes(byteBuf);
|
|
||||||
- } else {
|
|
||||||
- byte[] bs = new byte[i];
|
|
||||||
- byteBuf.readBytes(bs);
|
|
||||||
- VarInt.write(byteBuf2, bs.length);
|
|
||||||
- this.deflater.setInput(bs, 0, i);
|
|
||||||
- this.deflater.finish();
|
|
||||||
-
|
|
||||||
- while(!this.deflater.finished()) {
|
|
||||||
- int j = this.deflater.deflate(this.encodeBuf);
|
|
||||||
- byteBuf2.writeBytes(this.encodeBuf, 0, j);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- this.deflater.reset();
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- public int getThreshold() {
|
|
||||||
- return this.threshold;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- public void setThreshold(int compressionThreshold) {
|
|
||||||
- this.threshold = compressionThreshold;
|
|
||||||
- }
|
|
||||||
-}
|
|
||||||
+package net.minecraft.network;
|
|
||||||
+
|
|
||||||
+import io.netty.buffer.ByteBuf;
|
|
||||||
+import io.netty.channel.ChannelHandlerContext;
|
|
||||||
+import io.netty.handler.codec.MessageToByteEncoder;
|
|
||||||
+import java.util.zip.Deflater;
|
|
||||||
+
|
|
||||||
+public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> {
|
|
||||||
+ private final byte[] encodeBuf; // Paper
|
+ private final byte[] encodeBuf; // Paper
|
||||||
+ private final Deflater deflater;
|
private final Deflater deflater;
|
||||||
+ private final com.velocitypowered.natives.compression.VelocityCompressor compressor; // Paper
|
+ private final com.velocitypowered.natives.compression.VelocityCompressor compressor; // Paper
|
||||||
+ private int threshold;
|
private int threshold;
|
||||||
+
|
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ public CompressionEncoder(int compressionThreshold) {
|
public CompressionEncoder(int compressionThreshold) {
|
||||||
+ this(null, compressionThreshold);
|
+ this(null, compressionThreshold);
|
||||||
+ }
|
+ }
|
||||||
+ public CompressionEncoder(com.velocitypowered.natives.compression.VelocityCompressor compressor, int compressionThreshold) {
|
+ public CompressionEncoder(com.velocitypowered.natives.compression.VelocityCompressor compressor, int compressionThreshold) {
|
||||||
+ this.threshold = compressionThreshold;
|
this.threshold = compressionThreshold;
|
||||||
|
- this.deflater = new Deflater();
|
||||||
+ if (compressor == null) {
|
+ if (compressor == null) {
|
||||||
+ this.encodeBuf = new byte[8192];
|
+ this.encodeBuf = new byte[8192];
|
||||||
+ this.deflater = new Deflater();
|
+ this.deflater = new Deflater();
|
||||||
|
@ -250,28 +200,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+ this.compressor = compressor;
|
+ this.compressor = compressor;
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
|
- protected void encode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, ByteBuf byteBuf2) {
|
||||||
+ protected void encode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, ByteBuf byteBuf2) throws Exception { // Paper
|
+ protected void encode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, ByteBuf byteBuf2) throws Exception { // Paper
|
||||||
+ int i = byteBuf.readableBytes();
|
int i = byteBuf.readableBytes();
|
||||||
+ if (i < this.threshold) {
|
if (i < this.threshold) {
|
||||||
+ VarInt.write(byteBuf2, 0);
|
VarInt.write(byteBuf2, 0);
|
||||||
+ byteBuf2.writeBytes(byteBuf);
|
byteBuf2.writeBytes(byteBuf);
|
||||||
+ } else {
|
} else {
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ if (this.deflater != null) {
|
+ if (this.deflater != null) {
|
||||||
+ byte[] bs = new byte[i];
|
byte[] bs = new byte[i];
|
||||||
+ byteBuf.readBytes(bs);
|
byteBuf.readBytes(bs);
|
||||||
+ VarInt.write(byteBuf2, bs.length);
|
VarInt.write(byteBuf2, bs.length);
|
||||||
+ this.deflater.setInput(bs, 0, i);
|
@@ -0,0 +0,0 @@ public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> {
|
||||||
+ this.deflater.finish();
|
}
|
||||||
+
|
|
||||||
+ while(!this.deflater.finished()) {
|
this.deflater.reset();
|
||||||
+ int j = this.deflater.deflate(this.encodeBuf);
|
|
||||||
+ byteBuf2.writeBytes(this.encodeBuf, 0, j);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ this.deflater.reset();
|
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
@ -283,10 +229,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ compatibleIn.release();
|
+ compatibleIn.release();
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ @Override
|
+ @Override
|
||||||
+ protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) throws Exception{
|
+ protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) throws Exception{
|
||||||
|
@ -314,14 +260,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+
|
+
|
||||||
+ public int getThreshold() {
|
public int getThreshold() {
|
||||||
+ return this.threshold;
|
return this.threshold;
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
+ public void setThreshold(int compressionThreshold) {
|
|
||||||
+ this.threshold = compressionThreshold;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||||
|
|
Loading…
Reference in a new issue