mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-17 05:41:26 +01:00
More more work
This commit is contained in:
parent
24201b38ce
commit
ee2c1caf9b
@ -1262,25 +1262,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.threadingDetector.checkAndUnlock();
|
this.threadingDetector.checkAndUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
- public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idMap, Codec<T> codec, PalettedContainer.Strategy strategy, T object) {
|
- public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) {
|
||||||
- PalettedContainerRO.Unpacker<T, PalettedContainer<T>> unpacker = PalettedContainer::unpack;
|
|
||||||
+ // Paper start - Anti-Xray - Add preset values
|
+ // 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); }
|
+ @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> idMap, Codec<T> codec, PalettedContainer.Strategy strategy, T object, T @org.jetbrains.annotations.Nullable [] presetValues) {
|
+ 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) -> {
|
+ PalettedContainerRO.Unpacker<T, PalettedContainer<T>> unpacker = (idMapx, strategyx, packedData) -> {
|
||||||
+ return unpack(idMapx, strategyx, packedData, object, presetValues);
|
+ return unpack(idMapx, strategyx, packedData, object, presetValues);
|
||||||
+ };
|
+ };
|
||||||
+ // Paper end
|
+ // 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
|
@@ -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> idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData<T> serialized) {
|
||||||
+ 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
|
+ 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 = packedData.paletteEntries();
|
List<T> list = serialized.paletteEntries();
|
||||||
int i = strategy.size();
|
int i = paletteProvider.size();
|
||||||
int j = strategy.calculateBitsForSerialization(idMap, list.size());
|
int j = paletteProvider.calculateBitsForSerialization(idList, list.size());
|
||||||
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
@@ -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<>(idList, paletteProvider, 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, defaultValue, presetValues)); // Paper - Anti-Xray - Add preset values
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1464,7 +1456,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java
|
||||||
@@ -0,0 +0,0 @@ public interface PalettedContainerRO<T> {
|
@@ -0,0 +0,0 @@ public interface PalettedContainerRO<T> {
|
||||||
|
|
||||||
void getAll(Consumer<T> consumer);
|
void getAll(Consumer<T> action);
|
||||||
|
|
||||||
- void write(FriendlyByteBuf buf);
|
- void write(FriendlyByteBuf buf);
|
||||||
+ // Paper start - Anti-Xray - Add chunk packet info
|
+ // Paper start - Anti-Xray - Add chunk packet info
|
@ -522,19 +522,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
});
|
});
|
||||||
private final PacketFlow receiving;
|
private final PacketFlow receiving;
|
||||||
private final Queue<Connection.PacketHolder> queue = Queues.newConcurrentLinkedQueue();
|
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
|
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
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
@ -19,11 +19,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
|
--- a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
|
||||||
+++ b/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 {
|
@@ -0,0 +0,0 @@ public final class DensityFunctions {
|
||||||
int l = j / 2;
|
int j = z / 2;
|
||||||
int m = i % 2;
|
int k = x % 2;
|
||||||
int n = j % 2;
|
int l = z % 2;
|
||||||
- float f = 100.0F - Mth.sqrt((float)(i * i + j * j)) * 8.0F;
|
- float f = 100.0F - Mth.sqrt((float)(x * x + z * z)) * 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
|
+ 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);
|
f = Mth.clamp(f, -100.0F, 80.0F);
|
||||||
|
|
||||||
for(int o = -12; o <= 12; ++o) {
|
for(int m = -12; m <= 12; ++m) {
|
@ -40,17 +40,17 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/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
|
||||||
private static final int NO_BLOCK_UPDATES_TO_ACK = -1;
|
private static final int PENDING_MESSAGE_DISCONNECT_THRESHOLD = 4096;
|
||||||
public final Connection connection;
|
public final Connection connection;
|
||||||
private final MinecraftServer server;
|
private final MinecraftServer server;
|
||||||
+ public Runnable playerJoinReady; // Paper
|
+ public Runnable playerJoinReady; // Paper
|
||||||
public ServerPlayer player;
|
public ServerPlayer player;
|
||||||
private int tickCount;
|
private int tickCount;
|
||||||
private int ackBlockChangesUpTo = -1;
|
private int ackBlockChangesUpTo = -1;
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
+ // Paper start - login async
|
+ // Paper start - login async
|
||||||
+ Runnable playerJoinReady = this.playerJoinReady;
|
+ Runnable playerJoinReady = this.playerJoinReady;
|
||||||
@ -64,7 +64,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
if (this.ackBlockChangesUpTo > -1) {
|
if (this.ackBlockChangesUpTo > -1) {
|
||||||
this.send(new ClientboundBlockChangedAckPacket(this.ackBlockChangesUpTo));
|
this.send(new ClientboundBlockChangedAckPacket(this.ackBlockChangesUpTo));
|
||||||
this.ackBlockChangesUpTo = -1;
|
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.lastVehicle = null;
|
||||||
this.clientVehicleIsFloating = false;
|
this.clientVehicleIsFloating = false;
|
||||||
this.aboveGroundVehicleTickCount = 0;
|
this.aboveGroundVehicleTickCount = 0;
|
||||||
@ -77,7 +77,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListene
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
+++ b/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
|
// Paper end
|
||||||
} else if (this.state == ServerLoginPacketListenerImpl.State.DELAY_ACCEPT) {
|
} else if (this.state == ServerLoginPacketListenerImpl.State.DELAY_ACCEPT) {
|
||||||
@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
if (entityplayer == null) {
|
if (entityplayer == null) {
|
||||||
this.state = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT;
|
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));
|
this.connection.send(new ClientboundGameProfilePacket(this.gameProfile));
|
@ -17,7 +17,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/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.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
|
this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move
|
@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/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) {
|
public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<ClientboundPlayerPositionPacket.RelativeArgument> set, boolean flag) {
|
@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/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
|
@Override
|
||||||
public void handlePickItem(ServerboundPickItemPacket packet) {
|
public void handlePickItem(ServerboundPickItemPacket packet) {
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
@ -61,7 +61,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListene
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
+++ b/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) {
|
} catch (Exception exception) {
|
||||||
ServerLoginPacketListenerImpl.LOGGER.error("Couldn't place player in world", exception);
|
ServerLoginPacketListenerImpl.LOGGER.error("Couldn't place player in world", exception);
|
||||||
MutableComponent ichatmutablecomponent = Component.translatable("multiplayer.disconnect.invalid_player_data");
|
MutableComponent ichatmutablecomponent = Component.translatable("multiplayer.disconnect.invalid_player_data");
|
Loading…
Reference in New Issue
Block a user