13
0
geforkt von Mirrors/Paper

Add back Anti-Xray patch (#9283)

Dieser Commit ist enthalten in:
Jake Potrebic 2023-06-08 21:29:58 -07:00 committet von GitHub
Ursprung e829a9d8f3
Commit 82c64790f4
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
630 geänderte Dateien mit 285 neuen und 284 gelöschten Zeilen

Datei anzeigen

@ -148,7 +148,7 @@ index 0000000000000000000000000000000000000000..e4540ea278f2dc871cb6a3cb8897559b
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..bd86dc2ad2f87969da4add06de2a629f69d4b5de index 0000000000000000000000000000000000000000..52d2e2b744f91914802506e52a07161729bbcf3a
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
@ -173,7 +173,7 @@ index 0000000000000000000000000000000000000000..bd86dc2ad2f87969da4add06de2a629f
+ +
+ } + }
+ +
+ public BlockState[] getPresetBlockStates(Level level, ChunkPos chunkPos, int bottomBlockY) { + public BlockState[] getPresetBlockStates(Level level, ChunkPos chunkPos, int chunkSectionY) {
+ return null; + return null;
+ } + }
+ +
@ -199,10 +199,10 @@ index 0000000000000000000000000000000000000000..bd86dc2ad2f87969da4add06de2a629f
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..cab91880a08c6fdc545804911d295e0f24f4d983 index 0000000000000000000000000000000000000000..42fdce97d99618a53f2e9c51804ff2205b574f69
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
@@ -0,0 +1,670 @@ @@ -0,0 +1,672 @@
+package com.destroystokyo.paper.antixray; +package com.destroystokyo.paper.antixray;
+ +
+import io.papermc.paper.configuration.WorldConfiguration; +import io.papermc.paper.configuration.WorldConfiguration;
@ -349,8 +349,10 @@ index 0000000000000000000000000000000000000000..cab91880a08c6fdc545804911d295e0f
+ } + }
+ +
+ @Override + @Override
+ public BlockState[] getPresetBlockStates(Level level, ChunkPos chunkPos, int bottomBlockY) { + public BlockState[] getPresetBlockStates(Level level, ChunkPos chunkPos, int chunkSectionY) {
+ // Return the block states to be added to the paletted containers so that they can be used for obfuscation + // Return the block states to be added to the paletted containers so that they can be used for obfuscation
+ int bottomBlockY = chunkSectionY << 4;
+
+ if (bottomBlockY < maxBlockHeight) { + if (bottomBlockY < maxBlockHeight) {
+ if (engineMode == EngineMode.HIDE) { + if (engineMode == EngineMode.HIDE) {
+ return switch (level.getWorld().getEnvironment()) { + return switch (level.getWorld().getEnvironment()) {
@ -995,20 +997,23 @@ index 0000000000000000000000000000000000000000..80a2dfb266ae1221680a7b24fee2f7e2
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java
index 6cff1a98dc7cf33947ec760dbc3d3d0ec5db5f6c..b6df60322ec6f034d5a6d0fbe184d244a0b7b379 100644 index 6cff1a98dc7cf33947ec760dbc3d3d0ec5db5f6c..51f647de153255c919b1440338cf1b3e2d6b5dbf 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java
@@ -64,7 +64,7 @@ public record ClientboundChunksBiomesPacket(List<ClientboundChunksBiomesPacket.C @@ -63,8 +63,10 @@ public record ClientboundChunksBiomesPacket(List<ClientboundChunksBiomesPacket.C
}
public static void extractChunkData(FriendlyByteBuf buf, LevelChunk chunk) { public static void extractChunkData(FriendlyByteBuf buf, LevelChunk chunk) {
+ int chunkSectionIndex = 0; // Paper - Anti-Xray
for(LevelChunkSection levelChunkSection : chunk.getSections()) { for(LevelChunkSection levelChunkSection : chunk.getSections()) {
- levelChunkSection.getBiomes().write(buf); - levelChunkSection.getBiomes().write(buf);
+ levelChunkSection.getBiomes().write(buf, null, levelChunkSection.bottomBlockY()); // Paper - Anti-Xray + levelChunkSection.getBiomes().write(buf, null, chunkSectionIndex); // Paper - Anti-Xray
+ chunkSectionIndex++; // Paper - Anti-Xray
} }
} }
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
index 0ef3e9b472e35bd2572b04722781abf7d4a1094b..40a42a632540d497c1393b112731c41c6e448228 100644 index 0ef3e9b472e35bd2572b04722781abf7d4a1094b..c08440826d84f97412e2587cb98daae04e1bdd32 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
@@ -33,7 +33,10 @@ public class ClientboundLevelChunkPacketData { @@ -33,7 +33,10 @@ public class ClientboundLevelChunkPacketData {
@ -1039,7 +1044,7 @@ index 0ef3e9b472e35bd2572b04722781abf7d4a1094b..40a42a632540d497c1393b112731c41c
this.blockEntitiesData = Lists.newArrayList(); this.blockEntitiesData = Lists.newArrayList();
int totalTileEntities = 0; // Paper int totalTileEntities = 0; // Paper
@@ -103,9 +113,12 @@ public class ClientboundLevelChunkPacketData { @@ -103,9 +113,15 @@ public class ClientboundLevelChunkPacketData {
return byteBuf; return byteBuf;
} }
@ -1047,15 +1052,18 @@ index 0ef3e9b472e35bd2572b04722781abf7d4a1094b..40a42a632540d497c1393b112731c41c
+ // Paper start - Anti-Xray - Add chunk packet info + // Paper start - Anti-Xray - Add chunk packet info
+ @Deprecated @io.papermc.paper.annotation.DoNotUse public static void extractChunkData(FriendlyByteBuf buf, LevelChunk chunk) { ClientboundLevelChunkPacketData.extractChunkData(buf, chunk, null); } + @Deprecated @io.papermc.paper.annotation.DoNotUse public static void extractChunkData(FriendlyByteBuf buf, LevelChunk chunk) { ClientboundLevelChunkPacketData.extractChunkData(buf, chunk, null); }
+ public static void extractChunkData(FriendlyByteBuf buf, LevelChunk chunk, com.destroystokyo.paper.antixray.ChunkPacketInfo<net.minecraft.world.level.block.state.BlockState> chunkPacketInfo) { + public static void extractChunkData(FriendlyByteBuf buf, LevelChunk chunk, com.destroystokyo.paper.antixray.ChunkPacketInfo<net.minecraft.world.level.block.state.BlockState> chunkPacketInfo) {
+ int chunkSectionIndex = 0;
+
for(LevelChunkSection levelChunkSection : chunk.getSections()) { for(LevelChunkSection levelChunkSection : chunk.getSections()) {
- levelChunkSection.write(buf); - levelChunkSection.write(buf);
+ levelChunkSection.write(buf, chunkPacketInfo); + levelChunkSection.write(buf, chunkPacketInfo, chunkSectionIndex);
+ chunkSectionIndex++;
+ // Paper end + // Paper end
} }
} }
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
index 7825d6f0fdcfda6212cff8033ec55fb7db236154..000853110c7a89f2d0403a7a2737025a5ac28240 100644 index ff42a3e76500ad6e087b7f1cd6ec45acde124180..978fc83b209ae831ba1d6315cad1adeefe58a98c 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
@@ -13,13 +13,30 @@ public class ClientboundLevelChunkWithLightPacket implements Packet<ClientGamePa @@ -13,13 +13,30 @@ public class ClientboundLevelChunkWithLightPacket implements Packet<ClientGamePa
@ -1065,7 +1073,7 @@ index 7825d6f0fdcfda6212cff8033ec55fb7db236154..000853110c7a89f2d0403a7a2737025a
+ // Paper start - Async-Anti-Xray - Ready flag for the connection + // Paper start - Async-Anti-Xray - Ready flag for the connection
+ private volatile boolean ready; + private volatile boolean ready;
- public ClientboundLevelChunkWithLightPacket(LevelChunk chunk, LevelLightEngine lightProvider, @Nullable BitSet skyBits, @Nullable BitSet blockBits, boolean nonEdge) { - public ClientboundLevelChunkWithLightPacket(LevelChunk chunk, LevelLightEngine lightProvider, @Nullable BitSet skyBits, @Nullable BitSet blockBits) {
+ @Override + @Override
+ public boolean isReady() { + public boolean isReady() {
+ return this.ready; + return this.ready;
@ -1077,8 +1085,8 @@ index 7825d6f0fdcfda6212cff8033ec55fb7db236154..000853110c7a89f2d0403a7a2737025a
+ // Paper end + // Paper end
+ +
+ // Paper start - Anti-Xray - Add chunk packet info + // Paper start - Anti-Xray - Add chunk packet info
+ @Deprecated @io.papermc.paper.annotation.DoNotUse public ClientboundLevelChunkWithLightPacket(LevelChunk chunk, LevelLightEngine lightProvider, @Nullable BitSet skyBits, @Nullable BitSet blockBits, boolean nonEdge) { this(chunk, lightProvider, skyBits, blockBits, nonEdge, true); } + @Deprecated @io.papermc.paper.annotation.DoNotUse public ClientboundLevelChunkWithLightPacket(LevelChunk chunk, LevelLightEngine lightProvider, @Nullable BitSet skyBits, @Nullable BitSet blockBits) { this(chunk, lightProvider, skyBits, blockBits, true); }
+ public ClientboundLevelChunkWithLightPacket(LevelChunk chunk, LevelLightEngine lightProvider, @Nullable BitSet skyBits, @Nullable BitSet blockBits, boolean nonEdge, boolean modifyBlocks) { + public ClientboundLevelChunkWithLightPacket(LevelChunk chunk, LevelLightEngine lightProvider, @Nullable BitSet skyBits, @Nullable BitSet blockBits, boolean modifyBlocks) {
ChunkPos chunkPos = chunk.getPos(); ChunkPos chunkPos = chunk.getPos();
this.x = chunkPos.x; this.x = chunkPos.x;
this.z = chunkPos.z; this.z = chunkPos.z;
@ -1086,31 +1094,31 @@ index 7825d6f0fdcfda6212cff8033ec55fb7db236154..000853110c7a89f2d0403a7a2737025a
+ com.destroystokyo.paper.antixray.ChunkPacketInfo<net.minecraft.world.level.block.state.BlockState> chunkPacketInfo = modifyBlocks ? chunk.getLevel().chunkPacketBlockController.getChunkPacketInfo(this, chunk) : null; + com.destroystokyo.paper.antixray.ChunkPacketInfo<net.minecraft.world.level.block.state.BlockState> chunkPacketInfo = modifyBlocks ? chunk.getLevel().chunkPacketBlockController.getChunkPacketInfo(this, chunk) : null;
+ this.chunkData = new ClientboundLevelChunkPacketData(chunk, chunkPacketInfo); + this.chunkData = new ClientboundLevelChunkPacketData(chunk, chunkPacketInfo);
+ // Paper end + // Paper end
this.lightData = new ClientboundLightUpdatePacketData(chunkPos, lightProvider, skyBits, blockBits, nonEdge); this.lightData = new ClientboundLightUpdatePacketData(chunkPos, lightProvider, skyBits, blockBits);
+ chunk.getLevel().chunkPacketBlockController.modifyBlocks(this, chunkPacketInfo); // Paper - Anti-Xray - Modify blocks + chunk.getLevel().chunkPacketBlockController.modifyBlocks(this, chunkPacketInfo); // Paper - Anti-Xray - Modify blocks
} }
public ClientboundLevelChunkWithLightPacket(FriendlyByteBuf buf) { public ClientboundLevelChunkWithLightPacket(FriendlyByteBuf buf) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 430be10a2b0487dc26f21793592ca08d01a39e53..bba77d5001638307fe640b2e656df0a2b3cb4c43 100644 index 5cc0a39622a265e42e6b7d20e81144d1acce59b7..e0c9b9b61fa718d81d6e4438d7c12a833dfd7b64 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -633,7 +633,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -677,7 +677,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
- public void updateChunkTracking(ServerPlayer player, ChunkPos pos, MutableObject<ClientboundLevelChunkWithLightPacket> packet, boolean oldWithinViewDistance, boolean newWithinViewDistance) { // Paper - public - public void updateChunkTracking(ServerPlayer player, ChunkPos pos, MutableObject<ClientboundLevelChunkWithLightPacket> packet, boolean oldWithinViewDistance, boolean newWithinViewDistance) { // Paper - public
+ public void updateChunkTracking(ServerPlayer player, ChunkPos pos, MutableObject<java.util.Map<Object, ClientboundLevelChunkWithLightPacket>> packet, boolean oldWithinViewDistance, boolean newWithinViewDistance) { // Paper - public // Paper - Anti-Xray - Bypass + public void updateChunkTracking(ServerPlayer player, ChunkPos pos, MutableObject<java.util.Map<Object, ClientboundLevelChunkWithLightPacket>> packet, boolean oldWithinViewDistance, boolean newWithinViewDistance) { // Paper - public // Paper - Anti-Xray - Bypass
if (player.level == this.level) { io.papermc.paper.util.TickThread.ensureTickThread(this.level, pos, "May not update chunk tracking for chunk async"); // Paper - replace chunk loader system
if (newWithinViewDistance && !oldWithinViewDistance) { io.papermc.paper.util.TickThread.ensureTickThread(player, "May not update chunk tracking for player async"); // Paper - replace chunk loader system
ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos.toLong()); if (player.level() == this.level) {
@@ -1145,12 +1145,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1185,12 +1185,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}); });
} }
- private void playerLoadedChunk(ServerPlayer player, MutableObject<ClientboundLevelChunkWithLightPacket> cachedDataPacket, LevelChunk chunk) { - private void playerLoadedChunk(ServerPlayer player, MutableObject<ClientboundLevelChunkWithLightPacket> cachedDataPacket, LevelChunk chunk) {
- if (cachedDataPacket.getValue() == null) { - if (cachedDataPacket.getValue() == null) {
- cachedDataPacket.setValue(new ClientboundLevelChunkWithLightPacket(chunk, this.lightEngine, (BitSet) null, (BitSet) null, true)); - cachedDataPacket.setValue(new ClientboundLevelChunkWithLightPacket(chunk, this.lightEngine, (BitSet) null, (BitSet) null));
+ // Paper start - Anti-Xray - Bypass + // Paper start - Anti-Xray - Bypass
+ private void playerLoadedChunk(ServerPlayer player, MutableObject<java.util.Map<Object, ClientboundLevelChunkWithLightPacket>> cachedDataPackets, LevelChunk chunk) { + private void playerLoadedChunk(ServerPlayer player, MutableObject<java.util.Map<Object, ClientboundLevelChunkWithLightPacket>> cachedDataPackets, LevelChunk chunk) {
+ if (cachedDataPackets.getValue() == null) { + if (cachedDataPackets.getValue() == null) {
@ -1120,17 +1128,17 @@ index 430be10a2b0487dc26f21793592ca08d01a39e53..bba77d5001638307fe640b2e656df0a2
- player.trackChunk(chunk.getPos(), (Packet) cachedDataPacket.getValue()); - player.trackChunk(chunk.getPos(), (Packet) cachedDataPacket.getValue());
+ Boolean shouldModify = chunk.getLevel().chunkPacketBlockController.shouldModify(player, chunk); + Boolean shouldModify = chunk.getLevel().chunkPacketBlockController.shouldModify(player, chunk);
+ player.trackChunk(chunk.getPos(), (Packet) cachedDataPackets.getValue().computeIfAbsent(shouldModify, (s) -> { + player.trackChunk(chunk.getPos(), (Packet) cachedDataPackets.getValue().computeIfAbsent(shouldModify, (s) -> {
+ return new ClientboundLevelChunkWithLightPacket(chunk, this.lightEngine, (BitSet) null, (BitSet) null, true, (Boolean) s); + return new ClientboundLevelChunkWithLightPacket(chunk, this.lightEngine, (BitSet) null, (BitSet) null, (Boolean) s);
+ })); + }));
+ // Paper end + // Paper end
DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos()); DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos());
List<Entity> list = Lists.newArrayList(); List<Entity> list = Lists.newArrayList();
List<Entity> list1 = Lists.newArrayList(); List<Entity> list1 = Lists.newArrayList();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 5ad746ae673ef09f5581cf9fbbf1c9afa0ff0cd9..5ae321dc30d48f838c49322b5beef89bcbc952bc 100644 index b12e9da3eebda396769b30f4b7e37a78f3bcb060..62ea2bb2fdd1f2de31b08c88193887989fbd3ece 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -438,7 +438,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -564,7 +564,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error // Holder holder = worlddimension.type(); // CraftBukkit - decompile error
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
@ -1140,7 +1148,7 @@ index 5ad746ae673ef09f5581cf9fbbf1c9afa0ff0cd9..5ae321dc30d48f838c49322b5beef89b
this.convertable = convertable_conversionsession; this.convertable = convertable_conversionsession;
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile()); this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 618888eac8381b174850e351577601f1d881528d..051cbce8394c7a629a7ea8ac422308d96bbad6a6 100644 index 562534d15f6f70ff286be90fb512b807e00ad807..84ffc86e2eba089d0200183847e879d638e8460d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -49,7 +49,7 @@ import org.bukkit.event.player.PlayerInteractEvent; @@ -49,7 +49,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
@ -1162,10 +1170,10 @@ index 618888eac8381b174850e351577601f1d881528d..051cbce8394c7a629a7ea8ac422308d9
public void destroyAndAck(BlockPos pos, int sequence, String reason) { public void destroyAndAck(BlockPos pos, int sequence, String reason) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 48aef158ace14d3ca1f05ba2c6e5681e3ef9be59..637092303bbce94fd37f193367264d51b855847d 100644 index 9d1c3859e54af9b42665e7ca2fc50e83e7784148..09a572a054bd4cf1014e11a51caa68c6fa4bb384 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -176,6 +176,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -175,6 +175,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
} }
// Paper end // Paper end
@ -1173,7 +1181,7 @@ index 48aef158ace14d3ca1f05ba2c6e5681e3ef9be59..637092303bbce94fd37f193367264d51
public final co.aikar.timings.WorldTimingsHandler timings; // Paper public final co.aikar.timings.WorldTimingsHandler timings; // Paper
public static BlockPos lastPhysicsProblem; // Spigot public static BlockPos lastPhysicsProblem; // Spigot
private org.spigotmc.TickLimiter entityLimiter; private org.spigotmc.TickLimiter entityLimiter;
@@ -194,7 +195,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -193,7 +194,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public abstract ResourceKey<LevelStem> getTypeKey(); public abstract ResourceKey<LevelStem> getTypeKey();
@ -1182,7 +1190,7 @@ index 48aef158ace14d3ca1f05ba2c6e5681e3ef9be59..637092303bbce94fd37f193367264d51
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper
this.generator = gen; this.generator = gen;
@@ -280,6 +281,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -279,6 +280,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
@ -1190,7 +1198,7 @@ index 48aef158ace14d3ca1f05ba2c6e5681e3ef9be59..637092303bbce94fd37f193367264d51
} }
// Paper start // Paper start
@@ -461,6 +463,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -460,6 +462,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// CraftBukkit end // CraftBukkit end
BlockState iblockdata1 = chunk.setBlockState(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag BlockState iblockdata1 = chunk.setBlockState(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag
@ -1199,37 +1207,35 @@ index 48aef158ace14d3ca1f05ba2c6e5681e3ef9be59..637092303bbce94fd37f193367264d51
if (iblockdata1 == null) { if (iblockdata1 == null) {
// CraftBukkit start - remove blockstate if failed (or the same) // CraftBukkit start - remove blockstate if failed (or the same)
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
index 508c2fff8d8e0c6f37b6c4e3b72ba772c2ab2ee5..e254b2d04e4fc1dc76c26f61ea38aeb27755143f 100644 index 525c89bc926f13af6f94fc46c897525e37477eca..8b96d1b7548d354fbcabe6d1b5e9d6c3e2a5cb9d 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -140,17 +140,19 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom @@ -146,17 +146,17 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
} }
} }
- ChunkAccess.replaceMissingSections(heightLimitView, biome, this.sections); - ChunkAccess.replaceMissingSections(biomeRegistry, this.sections);
+ ChunkAccess.replaceMissingSections(heightLimitView, biome, this.sections, pos); // Paper - Anti-Xray - Add parameters + this.replaceMissingSections(biomeRegistry, this.sections); // Paper - Anti-Xray - make it a non-static method
// CraftBukkit start // CraftBukkit start
this.biomeRegistry = biome; this.biomeRegistry = biomeRegistry;
} }
public final Registry<Biome> biomeRegistry; public final Registry<Biome> biomeRegistry;
// CraftBukkit end // CraftBukkit end
- private static void replaceMissingSections(LevelHeightAccessor world, Registry<Biome> biome, LevelChunkSection[] sectionArray) { - private static void replaceMissingSections(Registry<Biome> biomeRegistry, LevelChunkSection[] sectionArray) {
+ // Paper start - Anti-Xray - Add parameters + private void replaceMissingSections(Registry<Biome> biomeRegistry, LevelChunkSection[] sectionArray) { // Paper - Anti-Xray - static -> non-static
+ private static void replaceMissingSections(LevelHeightAccessor world, Registry<Biome> biome, LevelChunkSection[] sectionArray, ChunkPos pos) {
for (int i = 0; i < sectionArray.length; ++i) { for (int i = 0; i < sectionArray.length; ++i) {
if (sectionArray[i] == null) { if (sectionArray[i] == null) {
- sectionArray[i] = new LevelChunkSection(world.getSectionYFromSectionIndex(i), biome); - sectionArray[i] = new LevelChunkSection(biomeRegistry);
+ sectionArray[i] = new LevelChunkSection(world.getSectionYFromSectionIndex(i), biome, pos, world instanceof net.minecraft.world.level.Level ? (net.minecraft.world.level.Level) world : null); + sectionArray[i] = new LevelChunkSection(biomeRegistry, this.levelHeightAccessor instanceof net.minecraft.world.level.Level ? (net.minecraft.world.level.Level) this.levelHeightAccessor : null, this.chunkPos, this.levelHeightAccessor.getSectionYFromSectionIndex(i)); // Paper start - Anti-Xray - Add parameters
+ // Paper end
} }
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index f5dcd970fc2828a4ba9ff2c0d495aa8d8cd4ed74..b1471b43392863ce1f2861d07baddbd711e761dc 100644 index 704f0500649acdbff2caf94f702a6685ecf4c986..24a1d04d01d01262facbac9c3683c21b7f54fd6d 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -93,7 +93,7 @@ public class LevelChunk extends ChunkAccess { @@ -90,7 +90,7 @@ public class LevelChunk extends ChunkAccess {
} }
public LevelChunk(Level world, ChunkPos pos, UpgradeData upgradeData, LevelChunkTicks<Block> blockTickScheduler, LevelChunkTicks<Fluid> fluidTickScheduler, long inhabitedTime, @Nullable LevelChunkSection[] sectionArrayInitializer, @Nullable LevelChunk.PostLoadProcessor entityLoader, @Nullable BlendingData blendingData) { public LevelChunk(Level world, ChunkPos pos, UpgradeData upgradeData, LevelChunkTicks<Block> blockTickScheduler, LevelChunkTicks<Fluid> fluidTickScheduler, long inhabitedTime, @Nullable LevelChunkSection[] sectionArrayInitializer, @Nullable LevelChunk.PostLoadProcessor entityLoader, @Nullable BlendingData blendingData) {
@ -1239,45 +1245,44 @@ index f5dcd970fc2828a4ba9ff2c0d495aa8d8cd4ed74..b1471b43392863ce1f2861d07baddbd7
this.setBlockNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world)); this.setBlockNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world));
this.setSkyNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world)); this.setSkyNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world));
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
index becc4c101e40d9b11e5e89a69e25dc0160bfaa32..8823751cde27bf195177282e99e9a69888441e35 100644 index 2c3ea88bac229df67bd742e16d2106d80bcc8889..4eeb719b40ff1c18a7cdda7ecc6b135dbedd626e 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -36,10 +36,13 @@ public class LevelChunkSection { @@ -33,9 +33,12 @@ public class LevelChunkSection {
this.recalcBlockCounts(); this.recalcBlockCounts();
} }
- public LevelChunkSection(int chunkPos, Registry<Biome> biomeRegistry) { - public LevelChunkSection(Registry<Biome> biomeRegistry) {
+ // Paper start - Anti-Xray - Add parameters
+ @Deprecated @io.papermc.paper.annotation.DoNotUse public LevelChunkSection(int chunkPos, Registry<Biome> biomeRegistry) { this(chunkPos, biomeRegistry, null, null); }
+ public LevelChunkSection(int chunkPos, Registry<Biome> biomeRegistry, net.minecraft.world.level.ChunkPos pos, net.minecraft.world.level.Level level) {
+ // Paper end
this.bottomBlockY = LevelChunkSection.getBottomBlockY(chunkPos);
- this.states = new PalettedContainer<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES); - this.states = new PalettedContainer<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES);
- this.biomes = new PalettedContainer<>(biomeRegistry.asHolderIdMap(), biomeRegistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); - this.biomes = new PalettedContainer<>(biomeRegistry.asHolderIdMap(), biomeRegistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES);
+ this.states = new PalettedContainer<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES, level == null || level.chunkPacketBlockController == null ? null : level.chunkPacketBlockController.getPresetBlockStates(level, pos, this.bottomBlockY())); // Paper - Anti-Xray - Add preset block states + // Paper start - Anti-Xray - Add parameters
+ @Deprecated @io.papermc.paper.annotation.DoNotUse public LevelChunkSection(Registry<Biome> biomeRegistry) { this(biomeRegistry, null, null, 0); }
+ public LevelChunkSection(Registry<Biome> biomeRegistry, net.minecraft.world.level.Level level, net.minecraft.world.level.ChunkPos chunkPos, int chunkSectionY) {
+ // Paper end
+ this.states = new PalettedContainer<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES, level == null || level.chunkPacketBlockController == null ? null : level.chunkPacketBlockController.getPresetBlockStates(level, chunkPos, chunkSectionY)); // Paper - Anti-Xray - Add preset block states
+ this.biomes = new PalettedContainer<>(biomeRegistry.asHolderIdMap(), biomeRegistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES, null); // Paper - Anti-Xray - Add preset biomes + this.biomes = new PalettedContainer<>(biomeRegistry.asHolderIdMap(), biomeRegistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES, null); // Paper - Anti-Xray - Add preset biomes
} }
public static int getBottomBlockY(int chunkPos) { public BlockState getBlockState(int x, int y, int z) {
@@ -184,10 +187,13 @@ public class LevelChunkSection { @@ -172,10 +175,13 @@ public class LevelChunkSection {
this.biomes = datapaletteblock; this.biomes = datapaletteblock;
} }
- public void write(FriendlyByteBuf buf) { - public void write(FriendlyByteBuf buf) {
+ // Paper start - Anti-Xray - Add chunk packet info + // Paper start - Anti-Xray - Add chunk packet info
+ @Deprecated @io.papermc.paper.annotation.DoNotUse public void write(FriendlyByteBuf buf) { this.write(buf, null); } + @Deprecated @io.papermc.paper.annotation.DoNotUse public void write(FriendlyByteBuf buf) { this.write(buf, null, 0); }
+ public void write(FriendlyByteBuf buf, com.destroystokyo.paper.antixray.ChunkPacketInfo<BlockState> chunkPacketInfo) { + public void write(FriendlyByteBuf buf, com.destroystokyo.paper.antixray.ChunkPacketInfo<BlockState> chunkPacketInfo, int chunkSectionIndex) {
buf.writeShort(this.nonEmptyBlockCount); buf.writeShort(this.nonEmptyBlockCount);
- this.states.write(buf); - this.states.write(buf);
- this.biomes.write(buf); - this.biomes.write(buf);
+ this.states.write(buf, chunkPacketInfo, this.bottomBlockY()); + this.states.write(buf, chunkPacketInfo, chunkSectionIndex);
+ this.biomes.write(buf, null, this.bottomBlockY()); + this.biomes.write(buf, null, chunkSectionIndex);
+ // Paper end + // Paper end
} }
public int getSerializedSize() { public int getSerializedSize() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
index cd82985b0aa821dccc0484f328407381d58ec81f..34804dc42c7a18108126c14c1b5f3d5a9a46f83d 100644 index cd82985b0aa821dccc0484f328407381d58ec81f..5f832a684067f4770ade1f24a29047f0f1fe0860 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -29,6 +29,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -29,6 +29,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@ -1402,7 +1407,7 @@ index cd82985b0aa821dccc0484f328407381d58ec81f..34804dc42c7a18108126c14c1b5f3d5a
public T getAndSet(int x, int y, int z, T value) { public T getAndSet(int x, int y, int z, T value) {
this.acquire(); this.acquire();
@@ -166,25 +227,36 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -166,25 +227,34 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
data.palette.read(buf); data.palette.read(buf);
buf.readLongArray(data.storage.getRaw()); buf.readLongArray(data.storage.getRaw());
this.data = data; this.data = data;
@ -1418,16 +1423,14 @@ index cd82985b0aa821dccc0484f328407381d58ec81f..34804dc42c7a18108126c14c1b5f3d5a
+ @Deprecated @io.papermc.paper.annotation.DoNotUse public void write(FriendlyByteBuf buf) { this.write(buf, null, 0); } + @Deprecated @io.papermc.paper.annotation.DoNotUse public void write(FriendlyByteBuf buf) { this.write(buf, null, 0); }
@Override @Override
- public void write(FriendlyByteBuf buf) { - public void write(FriendlyByteBuf buf) {
+ public void write(FriendlyByteBuf buf, @Nullable com.destroystokyo.paper.antixray.ChunkPacketInfo<T> chunkPacketInfo, int bottomBlockY) { + public void write(FriendlyByteBuf buf, @Nullable com.destroystokyo.paper.antixray.ChunkPacketInfo<T> chunkPacketInfo, int chunkSectionIndex) {
this.acquire(); this.acquire();
try { try {
- this.data.write(buf); - this.data.write(buf);
+ this.data.write(buf, chunkPacketInfo, bottomBlockY); + this.data.write(buf, chunkPacketInfo, chunkSectionIndex);
+ +
+ if (chunkPacketInfo != null) { + if (chunkPacketInfo != null) {
+ // Bottom block to 0 based chunk section index
+ int chunkSectionIndex = (bottomBlockY >> 4) - chunkPacketInfo.getChunk().getMinSection();
+ chunkPacketInfo.setPresetValues(chunkSectionIndex, this.presetValues); + chunkPacketInfo.setPresetValues(chunkSectionIndex, this.presetValues);
+ } + }
+ // Paper end + // Paper end
@ -1442,7 +1445,7 @@ index cd82985b0aa821dccc0484f328407381d58ec81f..34804dc42c7a18108126c14c1b5f3d5a
List<T> list = serialized.paletteEntries(); List<T> list = serialized.paletteEntries();
int i = paletteProvider.size(); int i = paletteProvider.size();
int j = paletteProvider.calculateBitsForSerialization(idList, list.size()); int j = paletteProvider.calculateBitsForSerialization(idList, list.size());
@@ -224,7 +296,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -224,7 +294,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
} }
} }
@ -1451,7 +1454,7 @@ index cd82985b0aa821dccc0484f328407381d58ec81f..34804dc42c7a18108126c14c1b5f3d5a
} }
@Override @Override
@@ -284,12 +356,12 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -284,12 +354,12 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
} }
public PalettedContainer<T> copy() { public PalettedContainer<T> copy() {
@ -1466,19 +1469,17 @@ index cd82985b0aa821dccc0484f328407381d58ec81f..34804dc42c7a18108126c14c1b5f3d5a
} }
@Override @Override
@@ -333,9 +405,20 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -333,9 +403,18 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
return 1 + this.palette.getSerializedSize() + FriendlyByteBuf.getVarIntSize(this.storage.getSize()) + this.storage.getRaw().length * 8; return 1 + this.palette.getSerializedSize() + FriendlyByteBuf.getVarIntSize(this.storage.getSize()) + this.storage.getRaw().length * 8;
} }
- public void write(FriendlyByteBuf buf) { - public void write(FriendlyByteBuf buf) {
+ // Paper start - Anti-Xray - Add chunk packet info + // Paper start - Anti-Xray - Add chunk packet info
+ public void write(FriendlyByteBuf buf, @Nullable com.destroystokyo.paper.antixray.ChunkPacketInfo<T> chunkPacketInfo, int bottomBlockY) { + public void write(FriendlyByteBuf buf, @Nullable com.destroystokyo.paper.antixray.ChunkPacketInfo<T> chunkPacketInfo, int chunkSectionIndex) {
buf.writeByte(this.storage.getBits()); buf.writeByte(this.storage.getBits());
this.palette.write(buf); this.palette.write(buf);
+ +
+ if (chunkPacketInfo != null) { + if (chunkPacketInfo != null) {
+ // Bottom block to 0 based chunk section index
+ int chunkSectionIndex = (bottomBlockY >> 4) - chunkPacketInfo.getChunk().getMinSection();
+ chunkPacketInfo.setBits(chunkSectionIndex, this.configuration.bits()); + chunkPacketInfo.setBits(chunkSectionIndex, this.configuration.bits());
+ chunkPacketInfo.setPalette(chunkSectionIndex, this.palette); + chunkPacketInfo.setPalette(chunkSectionIndex, this.palette);
+ chunkPacketInfo.setIndex(chunkSectionIndex, buf.writerIndex() + FriendlyByteBuf.getVarIntSize(this.storage.getRaw().length)); + chunkPacketInfo.setIndex(chunkSectionIndex, buf.writerIndex() + FriendlyByteBuf.getVarIntSize(this.storage.getRaw().length));
@ -1489,7 +1490,7 @@ index cd82985b0aa821dccc0484f328407381d58ec81f..34804dc42c7a18108126c14c1b5f3d5a
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java
index 9a2bf744abd8916d492e901be889223591bac3fd..a27fce0f1af9776a713bf1b5277869ed5d3e0c8e 100644 index 9a2bf744abd8916d492e901be889223591bac3fd..1dd415c96d17eff8e7555c33d3c52e57f2559fa5 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java
@@ -14,7 +14,10 @@ public interface PalettedContainerRO<T> { @@ -14,7 +14,10 @@ public interface PalettedContainerRO<T> {
@ -1499,13 +1500,13 @@ index 9a2bf744abd8916d492e901be889223591bac3fd..a27fce0f1af9776a713bf1b5277869ed
- void write(FriendlyByteBuf buf); - void write(FriendlyByteBuf buf);
+ // Paper start - Anti-Xray - Add chunk packet info + // Paper start - Anti-Xray - Add chunk packet info
+ @Deprecated @io.papermc.paper.annotation.DoNotUse void write(FriendlyByteBuf buf); + @Deprecated @io.papermc.paper.annotation.DoNotUse void write(FriendlyByteBuf buf);
+ void write(FriendlyByteBuf buf, @javax.annotation.Nullable com.destroystokyo.paper.antixray.ChunkPacketInfo<T> chunkPacketInfo, int bottomBlockY); + void write(FriendlyByteBuf buf, @javax.annotation.Nullable com.destroystokyo.paper.antixray.ChunkPacketInfo<T> chunkPacketInfo, int chunkSectionIndex);
+ // Paper end + // Paper end
int getSerializedSize(); int getSerializedSize();
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index b1c5e5ecf2488d1a6f0a5261d4ba8958de9659ae..4138ba8bdf6f359327dfc86d3402b787ae58c818 100644 index 0d8cfc0808a8f204d57cec40929b489099eca815..dec862552b08e6b9f9ad1f88db1e07dcc43d7fa3 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -71,7 +71,7 @@ import org.slf4j.Logger; @@ -71,7 +71,7 @@ import org.slf4j.Logger;
@ -1517,12 +1518,12 @@ index b1c5e5ecf2488d1a6f0a5261d4ba8958de9659ae..4138ba8bdf6f359327dfc86d3402b787
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
private static final String TAG_UPGRADE_DATA = "UpgradeData"; private static final String TAG_UPGRADE_DATA = "UpgradeData";
private static final String BLOCK_TICKS_TAG = "block_ticks"; private static final String BLOCK_TICKS_TAG = "block_ticks";
@@ -166,16 +166,20 @@ public class ChunkSerializer { @@ -162,16 +162,20 @@ public class ChunkSerializer {
if (k >= 0 && k < achunksection.length) { if (k >= 0 && k < achunksection.length) {
Logger logger; Logger logger;
PalettedContainer datapaletteblock; PalettedContainer datapaletteblock;
+ // Paper start - Anti-Xray - Add preset block states + // Paper start - Anti-Xray - Add preset block states
+ BlockState[] presetBlockStates = world.chunkPacketBlockController.getPresetBlockStates(world, chunkPos, b0 << 4); + BlockState[] presetBlockStates = world.chunkPacketBlockController.getPresetBlockStates(world, chunkPos, b0);
if (nbttagcompound1.contains("block_states", 10)) { if (nbttagcompound1.contains("block_states", 10)) {
- dataresult = ChunkSerializer.BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, nbttagcompound1.getCompound("block_states")).promotePartial((s) -> { - dataresult = ChunkSerializer.BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, nbttagcompound1.getCompound("block_states")).promotePartial((s) -> {
@ -1540,7 +1541,7 @@ index b1c5e5ecf2488d1a6f0a5261d4ba8958de9659ae..4138ba8bdf6f359327dfc86d3402b787
} }
PalettedContainer object; // CraftBukkit - read/write PalettedContainer object; // CraftBukkit - read/write
@@ -188,7 +192,7 @@ public class ChunkSerializer { @@ -184,7 +188,7 @@ public class ChunkSerializer {
Objects.requireNonNull(logger); Objects.requireNonNull(logger);
object = ((DataResult<PalettedContainer<Holder<Biome>>>) dataresult).getOrThrow(false, logger::error); // CraftBukkit - decompile error object = ((DataResult<PalettedContainer<Holder<Biome>>>) dataresult).getOrThrow(false, logger::error); // CraftBukkit - decompile error
} else { } else {
@ -1548,8 +1549,8 @@ index b1c5e5ecf2488d1a6f0a5261d4ba8958de9659ae..4138ba8bdf6f359327dfc86d3402b787
+ object = new PalettedContainer<>(iregistry.asHolderIdMap(), iregistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES, null); // Paper - Anti-Xray - Add preset biomes + object = new PalettedContainer<>(iregistry.asHolderIdMap(), iregistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES, null); // Paper - Anti-Xray - Add preset biomes
} }
LevelChunkSection chunksection = new LevelChunkSection(b0, datapaletteblock, (PalettedContainer) object); // CraftBukkit - read/write LevelChunkSection chunksection = new LevelChunkSection(datapaletteblock, (PalettedContainer) object); // CraftBukkit - read/write
@@ -446,7 +450,7 @@ public class ChunkSerializer { @@ -412,7 +416,7 @@ public class ChunkSerializer {
// CraftBukkit start - read/write // CraftBukkit start - read/write
private static Codec<PalettedContainer<Holder<Biome>>> makeBiomeCodecRW(Registry<Biome> iregistry) { private static Codec<PalettedContainer<Holder<Biome>>> makeBiomeCodecRW(Registry<Biome> iregistry) {
@ -1572,10 +1573,10 @@ index b738e1f7debac7d70910d5ac908ca9d4f60640d5..269ebe8e8826a0c89e471cb59b503900
public CraftChunk(net.minecraft.world.level.chunk.LevelChunk chunk) { public CraftChunk(net.minecraft.world.level.chunk.LevelChunk chunk) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index ca20401d795af96f6d8b9f1c10c854e8355e6899..456bb6cf7278a1418b39b9b2094abad3137bb508 100644 index a0976fd1b142ac7f26da71720ce40b303e1daabe..d7fe84932e25a76105aa7637247fd4d034985efe 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2266,7 +2266,7 @@ public final class CraftServer implements Server { @@ -2264,7 +2264,7 @@ public final class CraftServer implements Server {
public ChunkGenerator.ChunkData createChunkData(World world) { public ChunkGenerator.ChunkData createChunkData(World world) {
Validate.notNull(world, "World cannot be null"); Validate.notNull(world, "World cannot be null");
ServerLevel handle = ((CraftWorld) world).getHandle(); ServerLevel handle = ((CraftWorld) world).getHandle();
@ -1585,14 +1586,14 @@ index ca20401d795af96f6d8b9f1c10c854e8355e6899..456bb6cf7278a1418b39b9b2094abad3
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 87efc9c4d63b7c413b37f1a1a58100bf17615509..ec934c2cb6f183c43c06ba9c4d015890d5992934 100644 index f16ab24c0ff5b51432a8cbf9b5e7274c6b99ede6..62a3e2819510a056707dadf79a8e4fc5a9772fd9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -419,11 +419,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -419,11 +419,16 @@ public class CraftWorld extends CraftRegionAccessor implements World {
List<ServerPlayer> playersInRange = playerChunk.playerProvider.getPlayers(playerChunk.getPos(), false); List<ServerPlayer> playersInRange = playerChunk.playerProvider.getPlayers(playerChunk.getPos(), false);
if (playersInRange.isEmpty()) return true; // Paper - rewrite player chunk loader if (playersInRange.isEmpty()) return true; // Paper - rewrite player chunk loader
- ClientboundLevelChunkWithLightPacket refreshPacket = new ClientboundLevelChunkWithLightPacket(chunk, this.world.getLightEngine(), null, null, true); - ClientboundLevelChunkWithLightPacket refreshPacket = new ClientboundLevelChunkWithLightPacket(chunk, this.world.getLightEngine(), null, null);
+ // Paper start - Anti-Xray - Bypass + // Paper start - Anti-Xray - Bypass
+ Map<Object, ClientboundLevelChunkWithLightPacket> refreshPackets = new HashMap<>(); + Map<Object, ClientboundLevelChunkWithLightPacket> refreshPackets = new HashMap<>();
for (ServerPlayer player : playersInRange) { for (ServerPlayer player : playersInRange) {
@ -1601,14 +1602,14 @@ index 87efc9c4d63b7c413b37f1a1a58100bf17615509..ec934c2cb6f183c43c06ba9c4d015890
- player.connection.send(refreshPacket); - player.connection.send(refreshPacket);
+ Boolean shouldModify = chunk.getLevel().chunkPacketBlockController.shouldModify(player, chunk); + Boolean shouldModify = chunk.getLevel().chunkPacketBlockController.shouldModify(player, chunk);
+ player.connection.send(refreshPackets.computeIfAbsent(shouldModify, s -> { // Use connection to prevent creating firing event + player.connection.send(refreshPackets.computeIfAbsent(shouldModify, s -> { // Use connection to prevent creating firing event
+ return new ClientboundLevelChunkWithLightPacket(chunk, this.world.getLightEngine(), null, null, true, (Boolean) s); + return new ClientboundLevelChunkWithLightPacket(chunk, this.world.getLightEngine(), null, null, (Boolean) s);
+ })); + }));
+ // Paper end + // Paper end
} }
// Paper - rewrite player chunk loader // Paper - rewrite player chunk loader
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java diff --git a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
index 960405935e395a31c0300773c41413801cf0d290..4a23d03757e1735b9ebb8c003adcc0374a7d672d 100644 index c23ce88cb9693291fec81a99e3a5bcb2615bb897..a9700b750f124b5367c91ac071ee5194e9f7f8d8 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java --- a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
@@ -27,8 +27,13 @@ public final class OldCraftChunkData implements ChunkGenerator.ChunkData { @@ -27,8 +27,13 @@ public final class OldCraftChunkData implements ChunkGenerator.ChunkData {
@ -1630,8 +1631,8 @@ index 960405935e395a31c0300773c41413801cf0d290..4a23d03757e1735b9ebb8c003adcc037
int offset = (y - this.minHeight) >> 4; int offset = (y - this.minHeight) >> 4;
LevelChunkSection section = this.sections[offset]; LevelChunkSection section = this.sections[offset];
if (create && section == null) { if (create && section == null) {
- this.sections[offset] = section = new LevelChunkSection(offset + (this.minHeight >> 4), this.biomes); - this.sections[offset] = section = new LevelChunkSection(this.biomes);
+ this.sections[offset] = section = new LevelChunkSection(offset + (this.minHeight >> 4), this.biomes, null, this.world instanceof org.bukkit.craftbukkit.CraftWorld ? ((org.bukkit.craftbukkit.CraftWorld) this.world).getHandle() : null); // Paper - Anti-Xray - Add parameters + this.sections[offset] = section = new LevelChunkSection(this.biomes, this.world instanceof org.bukkit.craftbukkit.CraftWorld ? ((org.bukkit.craftbukkit.CraftWorld) this.world).getHandle() : null, null, offset + (this.minHeight >> 4)); // Paper - Anti-Xray - Add parameters
} }
return section; return section;
} }

Datei anzeigen

@ -312,7 +312,7 @@ index 603f9d1f501a18214f11a6e401f2c43d9c3cf8eb..1c327067d488cc916d082a797b161cb7
chunkproviderserver_b.managedBlock(completablefuture::isDone); chunkproviderserver_b.managedBlock(completablefuture::isDone);
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.popChunkWait(); // Paper - async chunk debug // Paper - rewrite chunk system io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.popChunkWait(); // Paper - async chunk debug // Paper - rewrite chunk system
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index b12e9da3eebda396769b30f4b7e37a78f3bcb060..e61781d7ac9ec8828b4968e6e3824f5212bf6dea 100644 index 62ea2bb2fdd1f2de31b08c88193887989fbd3ece..fc6cf61664b4c64c9319c61b447a02e2cc38558f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -651,6 +651,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -651,6 +651,13 @@ public class ServerLevel extends Level implements WorldGenLevel {

Datei anzeigen

@ -8,7 +8,7 @@ faster on its own, however removing the try catch makes it
easier to inline due to code size easier to inline due to code size
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 704f0500649acdbff2caf94f702a6685ecf4c986..8d6e3c60035ba2e7e05d081aec66274bdeedf3ea 100644 index 24a1d04d01d01262facbac9c3683c21b7f54fd6d..c3760f22fcc56ccb25e3315823054416c2172386 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -380,18 +380,20 @@ public class LevelChunk extends ChunkAccess { @@ -380,18 +380,20 @@ public class LevelChunk extends ChunkAccess {
@ -47,10 +47,10 @@ index 704f0500649acdbff2caf94f702a6685ecf4c986..8d6e3c60035ba2e7e05d081aec66274b
// CraftBukkit start // CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
index 2c3ea88bac229df67bd742e16d2106d80bcc8889..789664d53584c7d958572c63db22f904fb411a58 100644 index 4eeb719b40ff1c18a7cdda7ecc6b135dbedd626e..b8fee4f8a0cfe32b9ef7f3f3cf818cbaec0d3fca 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -43,7 +43,7 @@ public class LevelChunkSection { @@ -46,7 +46,7 @@ public class LevelChunkSection {
} }
public FluidState getFluidState(int x, int y, int z) { public FluidState getFluidState(int x, int y, int z) {

Datei anzeigen

@ -184,7 +184,7 @@ index 798a9083d78d49bc7c9e1d3dfb70c30e63e79a48..b2b7f5f30b3967a9f8a32e27557639da
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index a0976fd1b142ac7f26da71720ce40b303e1daabe..aabd79ef5cc502b5b1b1e5bb6f6427f1224026fd 100644 index d7fe84932e25a76105aa7637247fd4d034985efe..fb422d7f6639aa66cc6bd2d458eb3797d3dba702 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2514,6 +2514,16 @@ public final class CraftServer implements Server { @@ -2514,6 +2514,16 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Expose MinecraftServer#isRunning
This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading. This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index aabd79ef5cc502b5b1b1e5bb6f6427f1224026fd..2f7e8c0926aabc373479edc46d8fb160fa653980 100644 index fb422d7f6639aa66cc6bd2d458eb3797d3dba702..db67c80e5e42a71aee4a53ba7486031a7b1e6498 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2745,5 +2745,10 @@ public final class CraftServer implements Server { @@ -2745,5 +2745,10 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -7,7 +7,7 @@ Suspected case would be around the technique used in .stopRiding
Stack will identify any causer of this and warn instead of crashing. Stack will identify any causer of this and warn instead of crashing.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 5cc0a39622a265e42e6b7d20e81144d1acce59b7..f1a6827a8a23795f810279597b8eefb948d4fcff 100644 index e0c9b9b61fa718d81d6e4438d7c12a833dfd7b64..a8c4c7298e127e5b60a3b43ad168976d29901bc5 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1031,6 +1031,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1031,6 +1031,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -25,7 +25,7 @@ index 5cc0a39622a265e42e6b7d20e81144d1acce59b7..f1a6827a8a23795f810279597b8eefb9
EntityType<?> entitytypes = entity.getType(); EntityType<?> entitytypes = entity.getType();
int i = entitytypes.clientTrackingRange() * 16; int i = entitytypes.clientTrackingRange() * 16;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e61781d7ac9ec8828b4968e6e3824f5212bf6dea..faba22ba5b45fbd9463ed2172f5aa9096ed84ba0 100644 index fc6cf61664b4c64c9319c61b447a02e2cc38558f..2838e035204e95defce0d7488248b2e57bf71fab 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2473,7 +2473,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2473,7 +2473,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

Datei anzeigen

@ -295,10 +295,10 @@ index f5829ae484d93b547a5437b85a9621346384a11b..83701fbfaa56a232593ee8f11a3afb89
} }
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 9d1c3859e54af9b42665e7ca2fc50e83e7784148..904ffb532ecfa45ef8dfc318d7672d19e99934cd 100644 index 09a572a054bd4cf1014e11a51caa68c6fa4bb384..fd4de9ace0cce48b7c73bbe1d351db4053915a9a 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -817,6 +817,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -820,6 +820,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
try { try {
tickConsumer.accept(entity); tickConsumer.accept(entity);
} catch (Throwable throwable) { } catch (Throwable throwable) {
@ -307,7 +307,7 @@ index 9d1c3859e54af9b42665e7ca2fc50e83e7784148..904ffb532ecfa45ef8dfc318d7672d19
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
MinecraftServer.LOGGER.error(msg, throwable); MinecraftServer.LOGGER.error(msg, throwable);
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 8d6e3c60035ba2e7e05d081aec66274bdeedf3ea..f1c9dd86f62243ece7e81e820d1dbcae72d2598c 100644 index c3760f22fcc56ccb25e3315823054416c2172386..246606164117e8140ab0892ec1326503b414a1ab 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1180,6 +1180,7 @@ public class LevelChunk extends ChunkAccess { @@ -1180,6 +1180,7 @@ public class LevelChunk extends ChunkAccess {

Datei anzeigen

@ -31,7 +31,7 @@ delays anymore.
public net.minecraft.server.level.ChunkMap addEntity(Lnet/minecraft/world/entity/Entity;)V public net.minecraft.server.level.ChunkMap addEntity(Lnet/minecraft/world/entity/Entity;)V
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f1a6827a8a23795f810279597b8eefb948d4fcff..6ad8b10e47e33221513f57c424431793177fc140 100644 index a8c4c7298e127e5b60a3b43ad168976d29901bc5..48586780da5d260894fe59efaa97cb1facfe73fe 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1037,6 +1037,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1037,6 +1037,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Expose game version
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2f7e8c0926aabc373479edc46d8fb160fa653980..8a05200d5758b04d805352c156c01fa1d8c7509c 100644 index db67c80e5e42a71aee4a53ba7486031a7b1e6498..387dd679057b4968a3b6288e52d812ba9eefd1eb 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -577,6 +577,13 @@ public final class CraftServer implements Server { @@ -577,6 +577,13 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -74,7 +74,7 @@ index 0c7f280bae81bbb492d5780a43e5ffda0f58756a..238a7bc87ab49da1f0fa3c733dd512fd
this.connection.send(new ClientboundDisconnectPacket(ichatmutablecomponent)); this.connection.send(new ClientboundDisconnectPacket(ichatmutablecomponent));
this.connection.disconnect(ichatmutablecomponent); this.connection.disconnect(ichatmutablecomponent);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 8a05200d5758b04d805352c156c01fa1d8c7509c..c36946f68f8e595650c6cbae0c353987799c08dd 100644 index 387dd679057b4968a3b6288e52d812ba9eefd1eb..ec0d03aedac540f67552a5a8371518d673519d87 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1015,6 +1015,7 @@ public final class CraftServer implements Server { @@ -1015,6 +1015,7 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -516,7 +516,7 @@ index 71b395db734c257a64ec3297eebbe52883ea4cc7..072888f891c8e25a2b4daaf561e12493
paperConfigurations.initializeWorldDefaultsConfiguration(); paperConfigurations.initializeWorldDefaultsConfiguration();
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index faba22ba5b45fbd9463ed2172f5aa9096ed84ba0..345db2f58f52a465d04f46e43403ced57a1bae34 100644 index 2838e035204e95defce0d7488248b2e57bf71fab..e96890be7f03b7cc846fe850d4169e09b5d40eab 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -221,7 +221,9 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -221,7 +221,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -592,7 +592,7 @@ index 6599f874d9f97e9ef4862039ecad7277bbc5fd91..7edd4b88eb0476f0630630bc4681e859
} }
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index f1c9dd86f62243ece7e81e820d1dbcae72d2598c..b90697fbf292f73fc661c46edcc71c1bbce99d94 100644 index 246606164117e8140ab0892ec1326503b414a1ab..4d052f4cde791100f04b822899f0f436feaa23ea 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -603,7 +603,7 @@ public class LevelChunk extends ChunkAccess { @@ -603,7 +603,7 @@ public class LevelChunk extends ChunkAccess {

Datei anzeigen

@ -792,7 +792,7 @@ index 4379b9948f1eecfe6fd7dea98e298ad5f761019a..3f081183521603824430709886a9cc31
LOOK, LOOK,
JUMP, JUMP,
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index c36946f68f8e595650c6cbae0c353987799c08dd..33cc7f55bd4a2b8d6ed0844c21009737d01be82d 100644 index ec0d03aedac540f67552a5a8371518d673519d87..095ee082f73c24a8b1d311e15eed49048c6646d9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2758,5 +2758,11 @@ public final class CraftServer implements Server { @@ -2758,5 +2758,11 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -22,7 +22,7 @@ index 56574a625fb4378997bcc79915dbb083e2c59f70..f6b8426ddc50363991c78ae731898d1a
// CraftBukkit end // CraftBukkit end
if (this.getConnection() != null) { if (this.getConnection() != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 33cc7f55bd4a2b8d6ed0844c21009737d01be82d..7181e0df497d09e8d3d7a336e50a99506af4eb53 100644 index 095ee082f73c24a8b1d311e15eed49048c6646d9..4971e0d7254807a27123721dad24a7985b32cf87 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1025,6 +1025,31 @@ public final class CraftServer implements Server { @@ -1025,6 +1025,31 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -34,10 +34,10 @@ index 75d827f1eecb24f7ab985bdea2bbf65b8478fc8c..d646660f988994d4fdb05901349c5946
this.level.getProfiler().push("explosion_blocks"); this.level.getProfiler().push("explosion_blocks");
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 904ffb532ecfa45ef8dfc318d7672d19e99934cd..2a11411a66ab3e17aec174dc0ff2435ccfc0abfd 100644 index fd4de9ace0cce48b7c73bbe1d351db4053915a9a..7dc9b87c50590422e9912e4385c9983bcac343b8 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -432,6 +432,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -434,6 +434,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) { public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
// CraftBukkit start - tree generation // CraftBukkit start - tree generation
if (this.captureTreeGeneration) { if (this.captureTreeGeneration) {

Datei anzeigen

@ -18,10 +18,10 @@ index 05ac41e136da43284fb24a6b698ebd36318278fb..5ca3ad7b3d7606accd0a58b3c708fadb
@VisibleForTesting @VisibleForTesting
static long encode(double value) { static long encode(double value) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 6ad8b10e47e33221513f57c424431793177fc140..f3bbafb3475ea080826c5c795c37bc21db5622c7 100644 index 48586780da5d260894fe59efaa97cb1facfe73fe..dadf403ac91887f0fae87889170deb6d5732cbc1 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1343,9 +1343,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1348,9 +1348,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void updatePlayer(ServerPlayer player) { public void updatePlayer(ServerPlayer player) {
org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot
if (player != this.entity) { if (player != this.entity) {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Use distance map to optimise entity tracker
Use the distance map to find candidate players for tracking. Use the distance map to find candidate players for tracking.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f3bbafb3475ea080826c5c795c37bc21db5622c7..897205c326f9c8d37e0320c59e09dcc40fa38711 100644 index dadf403ac91887f0fae87889170deb6d5732cbc1..93dea79180ebaef3ffb6abffd47f0026a91406cd 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -157,6 +157,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -157,6 +157,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -187,9 +187,9 @@ index f3bbafb3475ea080826c5c795c37bc21db5622c7..897205c326f9c8d37e0320c59e09dcc4
List<ServerPlayer> list = Lists.newArrayList(); List<ServerPlayer> list = Lists.newArrayList();
List<ServerPlayer> list1 = this.level.players(); List<ServerPlayer> list1 = this.level.players();
ObjectIterator objectiterator = this.entityMap.values().iterator(); ObjectIterator objectiterator = this.entityMap.values().iterator();
@@ -1200,46 +1297,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1205,46 +1302,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}));
player.trackChunk(chunk.getPos(), (Packet) cachedDataPacket.getValue()); // Paper end
DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos()); DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos());
- List<Entity> list = Lists.newArrayList(); - List<Entity> list = Lists.newArrayList();
- List<Entity> list1 = Lists.newArrayList(); - List<Entity> list1 = Lists.newArrayList();
@ -235,7 +235,7 @@ index f3bbafb3475ea080826c5c795c37bc21db5622c7..897205c326f9c8d37e0320c59e09dcc4
} }
@@ -1294,6 +1352,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1299,6 +1357,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.lastSectionPos = SectionPos.of((EntityAccess) entity); this.lastSectionPos = SectionPos.of((EntityAccess) entity);
} }

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add permission for command blocks
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 562534d15f6f70ff286be90fb512b807e00ad807..c185083abf2b4527a7fe046d83c64cd2cc5b5bb9 100644 index 84ffc86e2eba089d0200183847e879d638e8460d..6a45cd61d2590aa25b9cb38028d2dcf3d93952fe 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -402,7 +402,7 @@ public class ServerPlayerGameMode { @@ -404,7 +404,7 @@ public class ServerPlayerGameMode {
BlockEntity tileentity = this.level.getBlockEntity(pos); BlockEntity tileentity = this.level.getBlockEntity(pos);
Block block = iblockdata.getBlock(); Block block = iblockdata.getBlock();

Datei anzeigen

@ -102,7 +102,7 @@ index 04a9cef0a80aaa401ce0ed560a16f3ada6e6a953..391eed0b5631732d799c858d35f0c31b
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 7181e0df497d09e8d3d7a336e50a99506af4eb53..639babbdaf9bf00edfa9d835f845cd3a0d95c088 100644 index 4971e0d7254807a27123721dad24a7985b32cf87..07368f2156c46654b72205cea27c20fd5e0a105b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -964,8 +964,8 @@ public final class CraftServer implements Server { @@ -964,8 +964,8 @@ public final class CraftServer implements Server {
@ -117,10 +117,10 @@ index 7181e0df497d09e8d3d7a336e50a99506af4eb53..639babbdaf9bf00edfa9d835f845cd3a
for (SpawnCategory spawnCategory : SpawnCategory.values()) { for (SpawnCategory spawnCategory : SpawnCategory.values()) {
if (CraftSpawnCategory.isValidForLimits(spawnCategory)) { if (CraftSpawnCategory.isValidForLimits(spawnCategory)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index f16ab24c0ff5b51432a8cbf9b5e7274c6b99ede6..58c9fa9fa6fab3eddb232b48602463d9d67701fc 100644 index 62a3e2819510a056707dadf79a8e4fc5a9772fd9..6fc18bdcaa181b72f4b73041a4eb71757413a204 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1140,7 +1140,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1145,7 +1145,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setDifficulty(Difficulty difficulty) { public void setDifficulty(Difficulty difficulty) {

Datei anzeigen

@ -22,7 +22,7 @@ wants it to collect even faster, they can restore that setting back to 1 instead
Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons. Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 639babbdaf9bf00edfa9d835f845cd3a0d95c088..a71b5269354fcf5074aa2b018abf9e173bce79ae 100644 index 07368f2156c46654b72205cea27c20fd5e0a105b..5cb5b71894597eb59201cfd1d5489d516cb7dbd0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -377,7 +377,7 @@ public final class CraftServer implements Server { @@ -377,7 +377,7 @@ public final class CraftServer implements Server {
@ -44,7 +44,7 @@ index 639babbdaf9bf00edfa9d835f845cd3a0d95c088..a71b5269354fcf5074aa2b018abf9e17
this.printSaveWarning = false; this.printSaveWarning = false;
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave"); console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 58c9fa9fa6fab3eddb232b48602463d9d67701fc..5200c13f33761b4e6a072b324d804d6766bad80b 100644 index 6fc18bdcaa181b72f4b73041a4eb71757413a204..a70ba15318f70798e5c3d1c458d52ca13193acee 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -280,7 +280,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -280,7 +280,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -84,7 +84,7 @@ index 58c9fa9fa6fab3eddb232b48602463d9d67701fc..5200c13f33761b4e6a072b324d804d67
} }
return true; return true;
@@ -440,9 +452,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -445,9 +457,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot
// Paper start - Optimize this method // Paper start - Optimize this method
ChunkPos chunkPos = new ChunkPos(x, z); ChunkPos chunkPos = new ChunkPos(x, z);
@ -98,7 +98,7 @@ index 58c9fa9fa6fab3eddb232b48602463d9d67701fc..5200c13f33761b4e6a072b324d804d67
if (immediate == null) { if (immediate == null) {
immediate = world.getChunkSource().chunkMap.getUnloadingChunk(x, z); immediate = world.getChunkSource().chunkMap.getUnloadingChunk(x, z);
} }
@@ -450,7 +465,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -455,7 +470,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
if (!(immediate instanceof ImposterProtoChunk) && !(immediate instanceof net.minecraft.world.level.chunk.LevelChunk)) { if (!(immediate instanceof ImposterProtoChunk) && !(immediate instanceof net.minecraft.world.level.chunk.LevelChunk)) {
return false; // not full status return false; // not full status
} }
@ -107,7 +107,7 @@ index 58c9fa9fa6fab3eddb232b48602463d9d67701fc..5200c13f33761b4e6a072b324d804d67
world.getChunk(x, z); // make sure we're at ticket level 32 or lower world.getChunk(x, z); // make sure we're at ticket level 32 or lower
return true; return true;
} }
@@ -476,7 +491,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -481,7 +496,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// we do this so we do not re-read the chunk data on disk // we do this so we do not re-read the chunk data on disk
} }
@ -116,7 +116,7 @@ index 58c9fa9fa6fab3eddb232b48602463d9d67701fc..5200c13f33761b4e6a072b324d804d67
world.getChunkSource().getChunk(x, z, ChunkStatus.FULL, true); world.getChunkSource().getChunk(x, z, ChunkStatus.FULL, true);
return true; return true;
// Paper end // Paper end
@@ -2196,6 +2211,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2201,6 +2216,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> { io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> {
net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> { net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)c; net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)c;

Datei anzeigen

@ -73,7 +73,7 @@ index 1c327067d488cc916d082a797b161cb7836ffa2e..3f5d572994bc8b3f1e106105dc0bb202
public void close() throws IOException { public void close() throws IOException {
// CraftBukkit start // CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 345db2f58f52a465d04f46e43403ced57a1bae34..d02f9030d47764f8f3f71f27f133b676b42efe59 100644 index e96890be7f03b7cc846fe850d4169e09b5d40eab..02ba7e25c649832aba2e742cb76be9d2b6b6f954 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1281,6 +1281,37 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1281,6 +1281,37 @@ public class ServerLevel extends Level implements WorldGenLevel {

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen