Port anti x-ray patch

This commit is contained in:
Nassim Jahnke
2021-06-15 15:20:52 +02:00
parent aa6c0aa554
commit 3cf01f9fca
10 changed files with 1528 additions and 63 deletions

View File

@@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ //this.lock.release(); // Paper - disable this
}
public PalettedContainer(Palette<T> fallbackPalette, IdMapper<T> idList, Function<CompoundTag, T> elementDeserializer, Function<T, CompoundTag> elementSerializer, T defaultElement) {
// Paper start - Anti-Xray - Add predefined objects
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T> {
return this.palette.idFor(objectAdded);
}
@@ -64,14 +64,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.acquire();
int i = buf.readByte();
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T> {
@Deprecated public void write(FriendlyByteBuf buf) {
write(buf, null, 0);
}
public void writeDataPaletteBlock(FriendlyByteBuf packetDataSerializer) { this.write(packetDataSerializer); } // Paper - OBFHELPER
- public void write(FriendlyByteBuf buf) {
+ public synchronized void write(FriendlyByteBuf buf) { // Paper - synchronize
- public void write(FriendlyByteBuf buf, com.destroystokyo.paper.antixray.ChunkPacketInfo<T> chunkPacketInfo, int chunkSectionIndex) {
+ public synchronized void write(FriendlyByteBuf buf, com.destroystokyo.paper.antixray.ChunkPacketInfo<T> chunkPacketInfo, int chunkSectionIndex) { // Paper - synchronize
// Paper end
try {
this.acquire();
buf.writeByte(this.bits);
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T> {
}
@@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public synchronized void read(ListTag paletteNbt, long[] data) { // Paper - synchronize
try {
this.acquire();
int i = Math.max(4, Mth.ceillog2(paletteNbt.size()));
// Paper - Anti-Xray - TODO: Should this.predefinedObjects.length just be added here (faster) or should the contents be compared to calculate the size (less RAM)?
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T> {
}