13
0
geforkt von Mirrors/Paper
Dieser Commit ist enthalten in:
Nassim Jahnke 2022-07-27 22:17:18 +02:00
Ursprung 24201b38ce
Commit ee2c1caf9b
95 geänderte Dateien mit 30 neuen und 51 gelöschten Zeilen

Datei anzeigen

@ -1262,25 +1262,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.threadingDetector.checkAndUnlock();
}
- public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idMap, Codec<T> codec, PalettedContainer.Strategy strategy, T object) {
- PalettedContainerRO.Unpacker<T, PalettedContainer<T>> unpacker = PalettedContainer::unpack;
- public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) {
+ // Paper start - Anti-Xray - Add preset values
+ @Deprecated @io.papermc.paper.annotation.DoNotUse public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idMap, Codec<T> codec, PalettedContainer.Strategy strategy, T object) { return PalettedContainer.codecRW(idMap, codec, strategy, object, null); }
+ public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idMap, Codec<T> codec, PalettedContainer.Strategy strategy, T object, T @org.jetbrains.annotations.Nullable [] presetValues) {
+ @Deprecated @io.papermc.paper.annotation.DoNotUse public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) {return codecRW(idList, entryCodec, paletteProvider, defaultValue, null);}
+ public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues) {
+ PalettedContainerRO.Unpacker<T, PalettedContainer<T>> unpacker = (idMapx, strategyx, packedData) -> {
+ return unpack(idMapx, strategyx, packedData, object, presetValues);
+ };
+ // Paper end
return codec(idMap, codec, strategy, object, unpacker);
PalettedContainerRO.Unpacker<T, PalettedContainer<T>> unpacker = PalettedContainer::unpack;
return codec(idList, entryCodec, paletteProvider, defaultValue, unpacker);
}
public static <T> Codec<PalettedContainerRO<T>> codecRO(IdMap<T> idMap, Codec<T> codec, PalettedContainer.Strategy strategy, T object) {
PalettedContainerRO.Unpacker<T, PalettedContainerRO<T>> unpacker = (idMapx, strategyx, packedData) -> {
- return unpack(idMapx, strategyx, packedData).map((palettedContainer) -> {
+ return unpack(idMapx, strategyx, packedData, object, null).map((palettedContainer) -> { // Paper - Anti-Xray - Add preset values
return palettedContainer;
});
};
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
});
}
@ -1407,17 +1399,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- private static <T> DataResult<PalettedContainer<T>> unpack(IdMap<T> idMap, PalettedContainer.Strategy strategy, PalettedContainerRO.PackedData<T> packedData) {
+ private static <T> DataResult<PalettedContainer<T>> unpack(IdMap<T> idMap, PalettedContainer.Strategy strategy, PalettedContainerRO.PackedData<T> packedData, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues) { // Paper - Anti-Xray - Add preset values
List<T> list = packedData.paletteEntries();
int i = strategy.size();
int j = strategy.calculateBitsForSerialization(idMap, list.size());
- private static <T> DataResult<PalettedContainer<T>> unpack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData<T> serialized) {
+ private static <T> DataResult<PalettedContainer<T>> unpack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData<T> serialized, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues) { // Paper - Anti-Xray - Add preset values
List<T> list = serialized.paletteEntries();
int i = paletteProvider.size();
int j = paletteProvider.calculateBitsForSerialization(idList, list.size());
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
}
}
- return DataResult.success(new PalettedContainer<>(idMap, strategy, configuration, bitStorage, list));
+ return DataResult.success(new PalettedContainer<>(idMap, strategy, configuration, bitStorage, list, defaultValue, presetValues)); // Paper - Anti-Xray - Add preset values
- return DataResult.success(new PalettedContainer<>(idList, paletteProvider, configuration, bitStorage, list));
+ return DataResult.success(new PalettedContainer<>(idList, paletteProvider, configuration, bitStorage, list, defaultValue, presetValues)); // Paper - Anti-Xray - Add preset values
}
@Override
@ -1464,7 +1456,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java
@@ -0,0 +0,0 @@ public interface PalettedContainerRO<T> {
void getAll(Consumer<T> consumer);
void getAll(Consumer<T> action);
- void write(FriendlyByteBuf buf);
+ // Paper start - Anti-Xray - Add chunk packet info

Datei anzeigen

@ -522,19 +522,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
});
private final PacketFlow receiving;
private final Queue<Connection.PacketHolder> queue = Queues.newConcurrentLinkedQueue();
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
@@ -0,0 +0,0 @@ public class ServerboundChatPacket implements Packet<ServerGamePacketListener> {
// Spigot Start
private static final java.util.concurrent.ExecutorService executors = java.util.concurrent.Executors.newCachedThreadPool(
- new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon( true ).setNameFormat( "Async Chat Thread - #%d" ).build() );
+ new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon( true ).setNameFormat( "Async Chat Thread - #%d" ).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER)).build() ); // Paper
public void handle(final ServerGamePacketListener listener) {
if ( !this.message.startsWith("/") )
{
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java

Datei anzeigen

@ -19,11 +19,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
@@ -0,0 +0,0 @@ public final class DensityFunctions {
int l = j / 2;
int m = i % 2;
int n = j % 2;
- float f = 100.0F - Mth.sqrt((float)(i * i + j * j)) * 8.0F;
+ float f = 100.0F - Mth.sqrt((long) i * (long) i + (long) j * (long) j) * 8.0F; // Paper - cast ints to long to avoid integer overflow
int j = z / 2;
int k = x % 2;
int l = z % 2;
- float f = 100.0F - Mth.sqrt((float)(x * x + z * z)) * 8.0F;
+ float f = 100.0F - Mth.sqrt((long) x * (long) x + (long) z * (long) z) * 8.0F; // Paper - cast ints to long to avoid integer overflow
f = Mth.clamp(f, -100.0F, 80.0F);
for(int o = -12; o <= 12; ++o) {
for(int m = -12; m <= 12; ++m) {

Datei anzeigen

@ -40,17 +40,17 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
private static final int NO_BLOCK_UPDATES_TO_ACK = -1;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private static final int PENDING_MESSAGE_DISCONNECT_THRESHOLD = 4096;
public final Connection connection;
private final MinecraftServer server;
+ public Runnable playerJoinReady; // Paper
public ServerPlayer player;
private int tickCount;
private int ackBlockChangesUpTo = -1;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// CraftBukkit end
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void tick() {
+ // Paper start - login async
+ Runnable playerJoinReady = this.playerJoinReady;
@ -64,7 +64,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.ackBlockChangesUpTo > -1) {
this.send(new ClientboundBlockChangedAckPacket(this.ackBlockChangesUpTo));
this.ackBlockChangesUpTo = -1;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.lastVehicle = null;
this.clientVehicleIsFloating = false;
this.aboveGroundVehicleTickCount = 0;
@ -77,7 +77,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListene
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
}
// Paper end
} else if (this.state == ServerLoginPacketListenerImpl.State.DELAY_ACCEPT) {
@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (entityplayer == null) {
this.state = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT;
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
}
this.connection.send(new ClientboundGameProfilePacket(this.gameProfile));

Datei anzeigen

@ -17,7 +17,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9));
this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move

Datei anzeigen

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<ClientboundPlayerPositionPacket.RelativeArgument> set, boolean flag) {

Datei anzeigen

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handlePickItem(ServerboundPickItemPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());

Datei anzeigen

@ -61,7 +61,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListene
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
} catch (Exception exception) {
ServerLoginPacketListenerImpl.LOGGER.error("Couldn't place player in world", exception);
MutableComponent ichatmutablecomponent = Component.translatable("multiplayer.disconnect.invalid_player_data");