Archiviert
13
0

Port anti x-ray patch

Dieser Commit ist enthalten in:
KennyTV 2021-06-15 15:20:52 +02:00
Ursprung e3fea251a6
Commit 68caddbb73
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
338 geänderte Dateien mit 500 neuen und 661 gelöschten Zeilen

Datei anzeigen

@ -2,12 +2,16 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: stonar96 <minecraft.stonar96@gmail.com> From: stonar96 <minecraft.stonar96@gmail.com>
Date: Mon, 20 Aug 2018 03:03:58 +0200 Date: Mon, 20 Aug 2018 03:03:58 +0200
Subject: [PATCH] Anti-Xray Subject: [PATCH] Anti-Xray
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
stonar96 — Today at 15:49 stonar96 — Today at 15:49
I'm just here to watch you suffer :smile: I'm just here to watch you suffer :smile:
You can skip it if you want and I can do it later. You can skip it if you want and I can do it later.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 1278d09f70c1e97607ef20d87a178dc252c7f723..c45493e88bf7e8811be2759ff9ac19e3fe9d938a 100644 index e29566cad2647da4d9288e912188b57f00e8dd0c..51691d3dedf113d58f340b74d448c5e5375b5bed 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -1,7 +1,9 @@ @@ -1,7 +1,9 @@
@ -20,9 +24,9 @@ index 1278d09f70c1e97607ef20d87a178dc252c7f723..c45493e88bf7e8811be2759ff9ac19e3
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig; import org.spigotmc.SpigotWorldConfig;
@@ -461,4 +463,38 @@ public class PaperWorldConfig { @@ -445,5 +447,39 @@ public class PaperWorldConfig {
private void maxAutoSaveChunksPerTick() { private void lightQueueSize() {
maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24); lightQueueSize = getInt("light-queue-size", lightQueueSize);
} }
+ +
+ public boolean antiXray; + public boolean antiXray;
@ -59,9 +63,10 @@ index 1278d09f70c1e97607ef20d87a178dc252c7f723..c45493e88bf7e8811be2759ff9ac19e3
+ } + }
+ } + }
} }
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..8fb63441fbf9afb6f11e1185a9f29528e1950546 index 0000000000000000000000000000000000000000..fe1a91a3a281dd91e5989bf2282240b03684b500
--- /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 @@
@ -90,11 +95,11 @@ index 0000000000000000000000000000000000000000..8fb63441fbf9afb6f11e1185a9f29528
+ return null; + return null;
+ } + }
+ +
+ public boolean shouldModify(ServerPlayer entityPlayer, LevelChunk chunk, int chunkSectionSelector) { + public boolean shouldModify(ServerPlayer entityPlayer, LevelChunk chunk) {
+ return false; + return false;
+ } + }
+ +
+ public ChunkPacketInfo<BlockState> getChunkPacketInfo(ClientboundLevelChunkPacket packetPlayOutMapChunk, LevelChunk chunk, int chunkSectionSelector) { + public ChunkPacketInfo<BlockState> getChunkPacketInfo(ClientboundLevelChunkPacket packetPlayOutMapChunk, LevelChunk chunk) {
+ return null; + return null;
+ } + }
+ +
@ -112,7 +117,7 @@ index 0000000000000000000000000000000000000000..8fb63441fbf9afb6f11e1185a9f29528
+} +}
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..6d41628444e880dea5c96ad5caf557f4c56dea46 index 0000000000000000000000000000000000000000..e1bc1093a03b931ff2c3870ea1601cd420f71192
--- /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,649 @@ @@ -0,0 +1,649 @@
@ -200,7 +205,7 @@ index 0000000000000000000000000000000000000000..6d41628444e880dea5c96ad5caf557f4
+ for (String id : paperWorldConfig.hiddenBlocks) { + for (String id : paperWorldConfig.hiddenBlocks) {
+ Block block = Registry.BLOCK.getOptional(new ResourceLocation(id)).orElse(null); + Block block = Registry.BLOCK.getOptional(new ResourceLocation(id)).orElse(null);
+ +
+ if (block != null && !block.isEntityBlock()) { + if (block != null && !(block instanceof net.minecraft.world.level.block.EntityBlock)) {
+ toObfuscate.add(id); + toObfuscate.add(id);
+ predefinedBlockDataList.add(block.defaultBlockState()); + predefinedBlockDataList.add(block.defaultBlockState());
+ } + }
@ -284,15 +289,15 @@ index 0000000000000000000000000000000000000000..6d41628444e880dea5c96ad5caf557f4
+ } + }
+ +
+ @Override + @Override
+ public boolean shouldModify(ServerPlayer entityPlayer, LevelChunk chunk, int chunkSectionSelector) { + public boolean shouldModify(ServerPlayer entityPlayer, LevelChunk chunk) {
+ return !usePermission || !entityPlayer.getBukkitEntity().hasPermission("paper.antixray.bypass"); + return !usePermission || !entityPlayer.getBukkitEntity().hasPermission("paper.antixray.bypass");
+ } + }
+ +
+ @Override + @Override
+ public ChunkPacketInfoAntiXray getChunkPacketInfo(ClientboundLevelChunkPacket packetPlayOutMapChunk, LevelChunk chunk, int chunkSectionSelector) { + public ChunkPacketInfoAntiXray getChunkPacketInfo(ClientboundLevelChunkPacket packetPlayOutMapChunk, LevelChunk chunk) {
+ // Return a new instance to collect data and objects in the right state while creating the chunk packet for thread safe access later + // Return a new instance to collect data and objects in the right state while creating the chunk packet for thread safe access later
+ // Note: As of 1.14 this has to be moved later due to the chunk system. + // Note: As of 1.14 this has to be moved later due to the chunk system.
+ ChunkPacketInfoAntiXray chunkPacketInfoAntiXray = new ChunkPacketInfoAntiXray(packetPlayOutMapChunk, chunk, chunkSectionSelector, this); + ChunkPacketInfoAntiXray chunkPacketInfoAntiXray = new ChunkPacketInfoAntiXray(packetPlayOutMapChunk, chunk, this);
+ return chunkPacketInfoAntiXray; + return chunkPacketInfoAntiXray;
+ } + }
+ +
@ -314,7 +319,7 @@ index 0000000000000000000000000000000000000000..6d41628444e880dea5c96ad5caf557f4
+ LevelChunk chunk = chunkPacketInfo.getChunk(); + LevelChunk chunk = chunkPacketInfo.getChunk();
+ int x = chunk.getPos().x; + int x = chunk.getPos().x;
+ int z = chunk.getPos().z; + int z = chunk.getPos().z;
+ ServerLevel world = (ServerLevel)chunk.world; + ServerLevel world = (ServerLevel)chunk.level;
+ ((ChunkPacketInfoAntiXray) chunkPacketInfo).setNearbyChunks( + ((ChunkPacketInfoAntiXray) chunkPacketInfo).setNearbyChunks(
+ (LevelChunk) world.getChunkIfLoadedImmediately(x - 1, z), + (LevelChunk) world.getChunkIfLoadedImmediately(x - 1, z),
+ (LevelChunk) world.getChunkIfLoadedImmediately(x + 1, z), + (LevelChunk) world.getChunkIfLoadedImmediately(x + 1, z),
@ -374,7 +379,7 @@ index 0000000000000000000000000000000000000000..6d41628444e880dea5c96ad5caf557f4
+ int[] predefinedBlockDataBitsTemp; + int[] predefinedBlockDataBitsTemp;
+ +
+ if (chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex) == LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE) { + if (chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex) == LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE) {
+ predefinedBlockDataBitsTemp = engineMode == EngineMode.HIDE ? chunkPacketInfoAntiXray.getChunk().world.getWorld().getEnvironment() == Environment.NETHER ? predefinedBlockDataBitsNetherrackGlobal : chunkPacketInfoAntiXray.getChunk().world.getWorld().getEnvironment() == Environment.THE_END ? predefinedBlockDataBitsEndStoneGlobal : predefinedBlockDataBitsStoneGlobal : predefinedBlockDataBitsGlobal; + predefinedBlockDataBitsTemp = engineMode == EngineMode.HIDE ? chunkPacketInfoAntiXray.getChunk().level.getWorld().getEnvironment() == Environment.NETHER ? predefinedBlockDataBitsNetherrackGlobal : chunkPacketInfoAntiXray.getChunk().level.getWorld().getEnvironment() == Environment.THE_END ? predefinedBlockDataBitsEndStoneGlobal : predefinedBlockDataBitsStoneGlobal : predefinedBlockDataBitsGlobal;
+ } else { + } else {
+ // If it's this.predefinedBlockData, use this.predefinedBlockDataFull instead + // If it's this.predefinedBlockData, use this.predefinedBlockDataFull instead
+ BlockState[] predefinedBlockDataFull = chunkPacketInfoAntiXray.getPredefinedObjects(chunkSectionIndex) == predefinedBlockData ? this.predefinedBlockDataFull : chunkPacketInfoAntiXray.getPredefinedObjects(chunkSectionIndex); + BlockState[] predefinedBlockDataFull = chunkPacketInfoAntiXray.getPredefinedObjects(chunkSectionIndex) == predefinedBlockData ? this.predefinedBlockDataFull : chunkPacketInfoAntiXray.getPredefinedObjects(chunkSectionIndex);
@ -767,10 +772,10 @@ index 0000000000000000000000000000000000000000..6d41628444e880dea5c96ad5caf557f4
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..dc04ffc76e11ab63cd98a84cf95c58dc5cd1efdb index 0000000000000000000000000000000000000000..4d06356d4c183605fdaa9157da02c66990f0fb70
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java
@@ -0,0 +1,81 @@ @@ -0,0 +1,75 @@
+package com.destroystokyo.paper.antixray; +package com.destroystokyo.paper.antixray;
+ +
+import net.minecraft.network.protocol.game.ClientboundLevelChunkPacket; +import net.minecraft.network.protocol.game.ClientboundLevelChunkPacket;
@ -781,17 +786,15 @@ index 0000000000000000000000000000000000000000..dc04ffc76e11ab63cd98a84cf95c58dc
+ +
+ private final ClientboundLevelChunkPacket packetPlayOutMapChunk; + private final ClientboundLevelChunkPacket packetPlayOutMapChunk;
+ private final LevelChunk chunk; + private final LevelChunk chunk;
+ private final int chunkSectionSelector;
+ private byte[] data; + private byte[] data;
+ private final int[] bitsPerObject = new int[16]; + private final int[] bitsPerObject = new int[16];
+ private final Object[] dataPalettes = new Object[16]; + private final Object[] dataPalettes = new Object[16];
+ private final int[] dataBitsIndexes = new int[16]; + private final int[] dataBitsIndexes = new int[16];
+ private final Object[][] predefinedObjects = new Object[16][]; + private final Object[][] predefinedObjects = new Object[16][];
+ +
+ public ChunkPacketInfo(ClientboundLevelChunkPacket packetPlayOutMapChunk, LevelChunk chunk, int chunkSectionSelector) { + public ChunkPacketInfo(ClientboundLevelChunkPacket packetPlayOutMapChunk, LevelChunk chunk) {
+ this.packetPlayOutMapChunk = packetPlayOutMapChunk; + this.packetPlayOutMapChunk = packetPlayOutMapChunk;
+ this.chunk = chunk; + this.chunk = chunk;
+ this.chunkSectionSelector = chunkSectionSelector;
+ } + }
+ +
+ public ClientboundLevelChunkPacket getPacketPlayOutMapChunk() { + public ClientboundLevelChunkPacket getPacketPlayOutMapChunk() {
@ -802,10 +805,6 @@ index 0000000000000000000000000000000000000000..dc04ffc76e11ab63cd98a84cf95c58dc
+ return chunk; + return chunk;
+ } + }
+ +
+ public int getChunkSectionSelector() {
+ return chunkSectionSelector;
+ }
+
+ public byte[] getData() { + public byte[] getData() {
+ return data; + return data;
+ } + }
@ -854,7 +853,7 @@ index 0000000000000000000000000000000000000000..dc04ffc76e11ab63cd98a84cf95c58dc
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..7345f1dc7c5c05f2e1ee09b94f4ebf56dd59bc55 index 0000000000000000000000000000000000000000..2339aa92ecaf3af9c7481ec6c21981c39319c76f
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java
@@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
@ -869,9 +868,9 @@ index 0000000000000000000000000000000000000000..7345f1dc7c5c05f2e1ee09b94f4ebf56
+ private LevelChunk[] nearbyChunks; + private LevelChunk[] nearbyChunks;
+ private final ChunkPacketBlockControllerAntiXray chunkPacketBlockControllerAntiXray; + private final ChunkPacketBlockControllerAntiXray chunkPacketBlockControllerAntiXray;
+ +
+ public ChunkPacketInfoAntiXray(ClientboundLevelChunkPacket packetPlayOutMapChunk, LevelChunk chunk, int chunkSectionSelector, + public ChunkPacketInfoAntiXray(ClientboundLevelChunkPacket packetPlayOutMapChunk, LevelChunk chunk,
+ ChunkPacketBlockControllerAntiXray chunkPacketBlockControllerAntiXray) { + ChunkPacketBlockControllerAntiXray chunkPacketBlockControllerAntiXray) {
+ super(packetPlayOutMapChunk, chunk, chunkSectionSelector); + super(packetPlayOutMapChunk, chunk);
+ this.chunkPacketBlockControllerAntiXray = chunkPacketBlockControllerAntiXray; + this.chunkPacketBlockControllerAntiXray = chunkPacketBlockControllerAntiXray;
+ } + }
+ +
@ -1031,90 +1030,73 @@ index 0000000000000000000000000000000000000000..333763936897befda5bb6c077944d266
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
index b587f774c8f88f2a1c3ea489f7e4fe0bbdeb5a41..10dd582b0fff4df27f1113e41c8ee3e274c6fb65 100644 index c28879f32b004f36ff746ea2274f91ddd9501e71..7762d8ff94f856d613a6f50311006b698f2aa2b0 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
@@ -1,5 +1,6 @@ @@ -37,7 +37,13 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
package net.minecraft.network.protocol.game;
+import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info
import com.google.common.collect.Lists;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
@@ -16,6 +17,7 @@ import net.minecraft.network.protocol.Packet;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.SkullBlockEntity;
+import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkBiomeContainer;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.LevelChunkSection;
@@ -33,7 +35,13 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
private List<CompoundTag> blockEntitiesTags;
private boolean fullChunk;
- public ClientboundLevelChunkPacket() {}
+ // Paper start - Async-Anti-Xray - Set the ready flag to true
+ private volatile boolean ready; // Paper - Async-Anti-Xray - Ready flag for the network manager
+ public ClientboundLevelChunkPacket() {
+ this.ready = true;
+ }
+ // Paper end
+
// Paper start
private final java.util.List<Packet> extraPackets = new java.util.ArrayList<>();
private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750);
@@ -43,12 +51,16 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
return extraPackets;
} }
// Paper end // Paper end
- public ClientboundLevelChunkPacket(LevelChunk chunk, int includedSectionsMask) {
+ // Paper start - Anti-Xray - Add chunk packet info - public ClientboundLevelChunkPacket(LevelChunk chunk) {
+ @Deprecated public ClientboundLevelChunkPacket(LevelChunk chunk, int includedSectionsMask) { this(chunk, includedSectionsMask, true); } // Notice for updates: Please make sure this constructor isn't used anywhere + private volatile boolean ready; // Paper - Async-Anti-Xray - Ready flag for the network manager
+ public ClientboundLevelChunkPacket(LevelChunk chunk, int i, boolean modifyBlocks) { +
+ ChunkPacketInfo<BlockState> chunkPacketInfo = modifyBlocks ? chunk.world.chunkPacketBlockController.getChunkPacketInfo(this, chunk, i) : null; + // Paper start
+ @Deprecated public ClientboundLevelChunkPacket(LevelChunk chunk) { this(chunk, true); } // Notice for updates: Please make sure this constructor isn't used anywhere
+ public ClientboundLevelChunkPacket(LevelChunk chunk, boolean modifyBlocks) {
+ com.destroystokyo.paper.antixray.ChunkPacketInfo<net.minecraft.world.level.block.state.BlockState> chunkPacketInfo = modifyBlocks ? chunk.level.chunkPacketBlockController.getChunkPacketInfo(this, chunk) : null;
+ // Paper end + // Paper end
ChunkPos chunkcoordintpair = chunk.getPos(); ChunkPos chunkPos = chunk.getPos();
this.x = chunkPos.x;
this.z = chunkPos.z;
@@ -51,7 +57,12 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
this.x = chunkcoordintpair.x; this.biomes = chunk.getBiomes().writeBiomes();
this.z = chunkcoordintpair.z; this.buffer = new byte[this.calculateChunkSize(chunk)];
- this.fullChunk = includedSectionsMask == 65535; - this.availableSections = this.extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk);
+ this.fullChunk = i == 65535;
this.heightmaps = new CompoundTag();
Iterator iterator = chunk.getHeightmaps().iterator();
@@ -65,8 +77,13 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
this.biomes = chunk.getBiomes().writeBiomes();
}
- this.buffer = new byte[this.calculateChunkSize(chunk, includedSectionsMask)];
- this.availableSections = this.extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk, includedSectionsMask);
+ this.buffer = new byte[this.calculateChunkSize(chunk, i)];
+ // Paper start - Anti-Xray - Add chunk packet info + // Paper start - Anti-Xray - Add chunk packet info
+ if (chunkPacketInfo != null) { + if (chunkPacketInfo != null) {
+ chunkPacketInfo.setData(this.getData()); + chunkPacketInfo.setData(this.buffer);
+ } + }
+ this.availableSections = this.writeChunk(new FriendlyByteBuf(this.getWriteBuffer()), chunk, i, chunkPacketInfo); + this.availableSections = this.extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk, chunkPacketInfo);
+ // Paper end + // Paper end
this.blockEntitiesTags = Lists.newArrayList(); this.blockEntitiesTags = Lists.newArrayList();
iterator = chunk.getBlockEntities().entrySet().iterator();
int totalTileEntities = 0; // Paper int totalTileEntities = 0; // Paper
@@ -77,7 +94,7 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
BlockEntity tileentity = (BlockEntity) entry.getValue();
int j = blockposition.getY() >> 4;
- if (this.isFullChunk() || (includedSectionsMask & 1 << j) != 0) { @@ -70,7 +81,7 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
+ if (this.isFullChunk() || (i & 1 << j) != 0) { if (blockEntity instanceof net.minecraft.world.level.block.entity.SkullBlockEntity) { net.minecraft.world.level.block.entity.SkullBlockEntity.sanitizeTileEntityUUID(compoundTag); } // Paper
// Paper start - improve oversized chunk data packet handling this.blockEntitiesTags.add(compoundTag);
if (++totalTileEntities > TE_LIMIT) { }
ClientboundBlockEntityDataPacket updatePacket = tileentity.getUpdatePacket(); -
@@ -93,8 +110,19 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe + chunk.level.chunkPacketBlockController.modifyBlocks(this, chunkPacketInfo); // Paper - Anti-Xray - Modify blocks
this.blockEntitiesTags.add(nbttagcompound); }
public ClientboundLevelChunkPacket(FriendlyByteBuf buf) {
@@ -120,7 +131,10 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
return byteBuf;
}
- public BitSet extractChunkData(FriendlyByteBuf buf, LevelChunk chunk) {
+ // Paper start - Anti-Xray - Add chunk packet info
+ @Deprecated public BitSet extractChunkData(FriendlyByteBuf buf, LevelChunk chunk) { return extractChunkData(buf, chunk, null); } // Notice for updates: Please make sure this method isn't used anywhere
+ public BitSet extractChunkData(FriendlyByteBuf buf, LevelChunk chunk, com.destroystokyo.paper.antixray.ChunkPacketInfo<net.minecraft.world.level.block.state.BlockState> chunkPacketInfo) {
+ // Paper end
BitSet bitSet = new BitSet();
LevelChunkSection[] levelChunkSections = chunk.getSections();
int i = 0;
@@ -129,7 +143,7 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
LevelChunkSection levelChunkSection = levelChunkSections[i];
if (levelChunkSection != LevelChunk.EMPTY_SECTION && !levelChunkSection.isEmpty()) {
bitSet.set(i);
- levelChunkSection.write(buf);
+ levelChunkSection.write(buf, chunkPacketInfo); // Paper - Anti-Xray - Add chunk packet info
} }
} }
+ chunk.world.chunkPacketBlockController.modifyBlocks(this, chunkPacketInfo); // Paper - Anti-Xray - Modify blocks
+ }
@@ -174,4 +188,15 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
public int[] getBiomes() {
return this.biomes;
}
+
+ // Paper start - Async-Anti-Xray - Getter and Setter for the ready flag + // Paper start - Async-Anti-Xray - Getter and Setter for the ready flag
+ @Override + @Override
+ public boolean isReady() { + public boolean isReady() {
@ -1123,81 +1105,49 @@ index b587f774c8f88f2a1c3ea489f7e4fe0bbdeb5a41..10dd582b0fff4df27f1113e41c8ee3e2
+ +
+ public void setReady(boolean ready) { + public void setReady(boolean ready) {
+ this.ready = ready; + this.ready = ready;
} + }
+ // Paper end + // Paper end
}
@Override
public void read(FriendlyByteBuf buf) throws IOException {
@@ -160,8 +188,12 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
return bytebuf;
}
- public int writeChunk(FriendlyByteBuf packetDataSerializer, LevelChunk chunk, int chunkSectionSelector) { return this.extractChunkData(packetDataSerializer, chunk, chunkSectionSelector); } // Paper - OBFHELPER
- public int extractChunkData(FriendlyByteBuf packetdataserializer, LevelChunk chunk, int includedSectionsMask) {
+ // Paper start - Anti-Xray - Add chunk packet info
+ @Deprecated public int writeChunk(FriendlyByteBuf packetDataSerializer, LevelChunk chunk, int chunkSectionSelector) { return this.extractChunkData(packetDataSerializer, chunk, chunkSectionSelector); } // OBFHELPER // Notice for updates: Please make sure this method isn't used anywhere
+ @Deprecated public int extractChunkData(FriendlyByteBuf packetdataserializer, LevelChunk chunk, int includedSectionsMask) { return this.writeChunk(packetdataserializer, chunk, includedSectionsMask, null); } // Notice for updates: Please make sure this method isn't used anywhere
+ public int writeChunk(FriendlyByteBuf packetDataSerializer, LevelChunk chunk, int chunkSectionSelector, ChunkPacketInfo<BlockState> chunkPacketInfo) { return this.a(packetDataSerializer, chunk, chunkSectionSelector, chunkPacketInfo); } // OBFHELPER
+ public int a(FriendlyByteBuf packetdataserializer, LevelChunk chunk, int i, ChunkPacketInfo<BlockState> chunkPacketInfo) {
+ // Paper end
int j = 0;
LevelChunkSection[] achunksection = chunk.getSections();
int k = 0;
@@ -169,9 +201,9 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
for (int l = achunksection.length; k < l; ++k) {
LevelChunkSection chunksection = achunksection[k];
- if (chunksection != LevelChunk.EMPTY_SECTION && (!this.isFullChunk() || !chunksection.isEmpty()) && (includedSectionsMask & 1 << k) != 0) {
+ if (chunksection != LevelChunk.EMPTY_SECTION && (!this.isFullChunk() || !chunksection.isEmpty()) && (i & 1 << k) != 0) {
j |= 1 << k;
- chunksection.write(packetdataserializer);
+ chunksection.writeChunkSection(packetdataserializer, chunkPacketInfo); // Paper - Anti-Xray - Add chunk packet info
}
}
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 cfec04e12dfaeb8852dc129a6a7e68c61dac54b6..b2d668607c2b5122d06fa75f77b3cef44100fe28 100644 index 480c361c919bbfbebacf9ac94418eac5ed38e233..56dece64f19009583c94569c5713c2ad0c91ae17 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
@@ -654,7 +654,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1444,7 +1444,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
this.markPositionReplaceable(pos);
- return Either.left(new ProtoChunk(pos, UpgradeData.EMPTY));
+ return Either.left(new ProtoChunk(pos, UpgradeData.EMPTY, this.level)); // Paper - Anti-Xray - Add parameter
}, this.mainThreadExecutor);
}
@@ -1402,9 +1402,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
+ private final void sendChunk(ServerPlayer entityplayer, Packet<?>[] apacket, LevelChunk chunk) { this.playerLoadedChunk(entityplayer, apacket, chunk); } // Paper - OBFHELPER
private void playerLoadedChunk(ServerPlayer player, Packet<?>[] packets, LevelChunk chunk) { private void playerLoadedChunk(ServerPlayer player, Packet<?>[] packets, LevelChunk chunk) {
if (packets[0] == null) { if (packets[0] == null) {
- packets[0] = new ClientboundLevelChunkPacket(chunk, 65535); - packets[0] = new ClientboundLevelChunkPacket(chunk);
+ packets[0] = new ClientboundLevelChunkPacket(chunk, 65535, chunk.world.chunkPacketBlockController.shouldModify(player, chunk, 65535)); // Paper - Anti-Xray - Bypass + packets[0] = new ClientboundLevelChunkPacket(chunk, chunk.level.chunkPacketBlockController.shouldModify(player, chunk)); // Paper - Ani-Xray - Bypass
packets[1] = new ClientboundLightUpdatePacket(chunk.getPos(), this.lightEngine, true); packets[1] = new ClientboundLightUpdatePacket(chunk.getPos(), this.lightEngine, (BitSet) null, (BitSet) null, true);
} }
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 fd7ee4badb383ffb4347d62c00ea2dfa3d76fd12..7a09bc921827958f58290bd3d6f19984bb34a8f6 100644 index e6ef6d9b6e9a674db1180cae6263537e57b843d3..c5070975be1ceeab20ad0b3bab790426adb5e5fa 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
@@ -204,7 +204,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -292,7 +292,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
// Add env and gen to constructor, WorldData -> WorldDataServer // Add env and gen to constructor, WorldData -> WorldDataServer
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey<net.minecraft.world.level.Level> resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey<net.minecraft.world.level.Level> resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
- super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i, gen, env); - super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i, gen, env);
+ super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i, gen, env, executor); // Paper pass executor + super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i, gen, env, executor); // Paper - pass executor
this.pvpMode = minecraftserver.isPvpAllowed(); this.pvpMode = minecraftserver.isPvpAllowed();
convertable = convertable_conversionsession; this.convertable = convertable_conversionsession;
uuid = WorldUUID.getUUID(convertable_conversionsession.levelPath.toFile()); this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelPath.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 d97607f2ded4977b253d3afa3bafcbe6d7f98837..af048ab682612233c01f7087d7b8afbf7e58945b 100644 index f4a056185990181e486f452960159a5287947382..a695e5a0c2e8846333ccb9aea499b5656af35163 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
@@ -308,6 +308,8 @@ public class ServerPlayerGameMode { @@ -49,7 +49,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
public class ServerPlayerGameMode {
private static final Logger LOGGER = LogManager.getLogger();
- protected ServerLevel level;
+ public ServerLevel level; // Paper - protected->public
protected final ServerPlayer player;
private GameType gameModeForPlayer;
@Nullable
@@ -314,6 +314,8 @@ public class ServerPlayerGameMode {
} }
} }
@ -1207,39 +1157,32 @@ index d97607f2ded4977b253d3afa3bafcbe6d7f98837..af048ab682612233c01f7087d7b8afbf
public void destroyAndAck(BlockPos pos, ServerboundPlayerActionPacket.Action action, String reason) { public void destroyAndAck(BlockPos pos, ServerboundPlayerActionPacket.Action action, 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 eb88d830fb45a6b8c990e8bdc1943d80f63c8b93..1377465e3dc062f34be25cac10aa018776fb22e7 100644 index aa198e9f2755734eac591bd3f94679518e9d7270..687e3652d0f36a358a2348df845801ad82d8460c 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
@@ -2,6 +2,8 @@ package net.minecraft.world.level; @@ -164,6 +164,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
import co.aikar.timings.Timing;
import co.aikar.timings.Timings;
+import com.destroystokyo.paper.antixray.ChunkPacketBlockController; // Paper - Anti-Xray
+import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray; // Paper - Anti-Xray
import com.destroystokyo.paper.event.server.ServerExceptionEvent;
import com.destroystokyo.paper.exception.ServerInternalException;
import com.google.common.base.MoreObjects;
@@ -144,6 +146,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper
+ public final ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray + public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
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
@@ -165,9 +168,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -185,9 +186,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return typeKey; return this.typeKey;
} }
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { - protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
+ protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper + protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper
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 = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper
+ this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray + this.chunkPacketBlockController = this.paperConfig.antiXray ?
+ new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor)
+ : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
this.generator = gen; this.generator = gen;
this.world = new CraftWorld((ServerLevel) this, gen, env); this.world = new CraftWorld((ServerLevel) this, gen, env);
this.ticksPerAnimalSpawns = this.getCraftServer().getTicksPerAnimalSpawns(); // CraftBukkit this.ticksPerAnimalSpawns = this.getCraftServer().getTicksPerAnimalSpawns(); // CraftBukkit
@@ -433,6 +437,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -448,6 +452,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// CraftBukkit end // CraftBukkit end
BlockState iblockdata1 = chunk.setType(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag BlockState iblockdata1 = chunk.setType(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag
@ -1247,131 +1190,98 @@ index eb88d830fb45a6b8c990e8bdc1943d80f63c8b93..1377465e3dc062f34be25cac10aa0187
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
index c0075d226331f32e470dae5bf1ce8d79e8b263dc..91f5106cfe7914389b52a1ed001117b13e4f9768 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -75,6 +75,7 @@ public interface ChunkAccess extends BlockGetter, FeatureAccess {
default LevelChunkSection getOrCreateSection(int yIndex) {
LevelChunkSection[] levelChunkSections = this.getSections();
if (levelChunkSections[yIndex] == LevelChunk.EMPTY_SECTION) {
+ // Paper - diff on change in ProtoChunk
levelChunkSections[yIndex] = new LevelChunkSection(this.getSectionYFromSectionIndex(yIndex));
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java
index e369730ac6909ff5343468bd685c9ea2b6b3cfed..2c19d147710a3bbe2e980114161f1cdf81760947 100644 index 69c2454533e6f21c70792b555ec02c6bc6d169b3..2607c7ba5cf1aca5f3e5c22be2e4e8b3007427d4 100644
--- a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java
@@ -8,6 +8,7 @@ import net.minecraft.Util; @@ -86,7 +86,7 @@ public class EmptyLevelChunk extends LevelChunk {
import net.minecraft.core.BlockPos; private static final Biome[] EMPTY_BIOMES = new Biome[0];
import net.minecraft.core.Registry;
import net.minecraft.data.worldgen.biome.Biomes;
+import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ChunkHolder;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ChunkPos;
@@ -28,7 +29,7 @@ public class EmptyLevelChunk extends LevelChunk {
});
public EmptyLevelChunk(Level world, ChunkPos pos) { public EmptyChunkBiomeContainer(Level world) {
- super(world, pos, new ChunkBiomeContainer(world.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), EmptyLevelChunk.BIOMES)); - super(world.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), world, EMPTY_BIOMES);
+ super(world, pos, new ChunkBiomeContainer(MinecraftServer.getServer().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), EmptyLevelChunk.BIOMES)); // Paper - world isnt ready yet for anti xray use here, use server singleton for registry + super(net.minecraft.server.MinecraftServer.getServer().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), world, EMPTY_BIOMES); // Paper - world isnt ready yet for anti xray use here, use server singleton for registry
} }
// Paper start
diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
index 17fa8b23d1000ae53f2b4f1a6e8817c1005c1c81..56ab660e29a0dc7d22eeaa41cc8f50e8a96717ef 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
@@ -27,7 +27,7 @@ public class ImposterProtoChunk extends ProtoChunk {
private final LevelChunk wrapped;
public ImposterProtoChunk(LevelChunk wrapped) {
- super(wrapped.getPos(), UpgradeData.EMPTY);
+ super(wrapped.getPos(), UpgradeData.EMPTY, wrapped.world); // Paper - Anti-Xray - Add parameter
this.wrapped = wrapped;
}
@Override
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 419b4bf0549d798d52d73fbbd9de59313fc05eb1..85861545ec4620a6cfd06876dad091637bd29b0b 100644 index 521f199e495f3bec232cc9ca36e51e0392afe737..d4e11b552988f0ef28059f9aa2ca1f1897653171 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
@@ -464,7 +464,7 @@ public class LevelChunk implements ChunkAccess { @@ -456,7 +456,7 @@ public class LevelChunk implements ChunkAccess {
return null; return null;
} }
- chunksection = new LevelChunkSection(j >> 4 << 4); - chunksection = new LevelChunkSection(SectionPos.blockToSectionCoord(i));
+ chunksection = new LevelChunkSection(j >> 4 << 4, this, this.world, true); // Paper - Anti-Xray - Add parameters + chunksection = new LevelChunkSection(SectionPos.blockToSectionCoord(i), this, this.level, true); // Paper - Anti-Xray - Add parameters
this.sections[j >> 4] = chunksection; this.sections[j] = chunksection;
} }
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 f5db97fb0dac78e1d9aa68d0417aa13f39914f52..38c7c5f18fc84d4a1de2da1ddc6d3ac37c25f341 100644 index 5fd66020a937b641e2a060cf38df731a43f3bf55..b10beabccf5a29098a796e5615eb4632fae95f99 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
@@ -1,9 +1,11 @@ @@ -20,16 +20,25 @@ public class LevelChunkSection {
package net.minecraft.world.level.chunk;
import java.util.function.Predicate;
+import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info
import javax.annotation.Nullable;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.network.FriendlyByteBuf;
+import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
@@ -18,16 +20,22 @@ public class LevelChunkSection {
private short tickingFluidCount; private short tickingFluidCount;
final PalettedContainer<BlockState> states; // Paper - package-private final PalettedContainer<BlockState> states; // Paper - package-private
- public LevelChunkSection(int yOffset) { - public LevelChunkSection(int yOffset) {
- this(yOffset, (short) 0, (short) 0, (short) 0); - this(yOffset, (short)0, (short)0, (short)0);
+ // Paper start - Anti-Xray - Add parameters + // Paper start - Anti-Xray - Add parameters
+ @Deprecated public LevelChunkSection(int yOffset) { this(yOffset, null, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere + @Deprecated public LevelChunkSection(int yOffset) { this(yOffset, null, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere
+ public LevelChunkSection(int i, ChunkAccess chunk, Level world, boolean initializeBlocks) { + public LevelChunkSection(int yOffset, ChunkAccess chunk, net.minecraft.server.level.ServerLevel world, boolean initializeBlocks) {
+ this(i, (short) 0, (short) 0, (short) 0, chunk, world, initializeBlocks);
+ // Paper end + // Paper end
+ this(yOffset, (short) 0, (short) 0, (short) 0, chunk, world, initializeBlocks);
} }
- public LevelChunkSection(int yOffset, short nonEmptyBlockCount, short randomTickableBlockCount, short nonEmptyFluidCount) { - public LevelChunkSection(int yOffset, short nonEmptyBlockCount, short randomTickableBlockCount, short nonEmptyFluidCount) {
- this.bottomBlockY = yOffset;
- this.nonEmptyBlockCount = nonEmptyBlockCount;
- this.tickingBlockCount = randomTickableBlockCount;
- this.tickingFluidCount = nonEmptyFluidCount;
- this.states = new PalettedContainer<>(LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE, Block.BLOCK_STATE_REGISTRY, NbtUtils::readBlockState, NbtUtils::writeBlockState, Blocks.AIR.defaultBlockState());
+ // Paper start - Anti-Xray - Add parameters + // Paper start - Anti-Xray - Add parameters
+ @Deprecated public LevelChunkSection(int yOffset, short nonEmptyBlockCount, short randomTickableBlockCount, short nonEmptyFluidCount) { this(yOffset, nonEmptyBlockCount, randomTickableBlockCount, nonEmptyFluidCount, null, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere + @Deprecated public LevelChunkSection(int yOffset, short nonEmptyBlockCount, short randomTickableBlockCount, short nonEmptyFluidCount) { // Notice for updates: Please make sure this constructor isn't used anywhere
+ public LevelChunkSection(int i, short short0, short short1, short short2, ChunkAccess chunk, Level world, boolean initializeBlocks) { + this(yOffset, nonEmptyBlockCount, randomTickableBlockCount, nonEmptyFluidCount, null, null, true);
+ }
+ public LevelChunkSection(int yOffset, short nonEmptyBlockCount, short randomTickableBlockCount, short nonEmptyFluidCount, ChunkAccess chunk, net.minecraft.server.level.ServerLevel world, boolean initializeBlocks) {
+ // Paper end + // Paper end
+ this.bottomBlockY = i; this.bottomBlockY = getBottomBlockY(yOffset);
+ this.nonEmptyBlockCount = short0; this.nonEmptyBlockCount = nonEmptyBlockCount;
+ this.tickingBlockCount = short1; this.tickingBlockCount = randomTickableBlockCount;
+ this.tickingFluidCount = short2; this.tickingFluidCount = nonEmptyFluidCount;
+ this.states = new PalettedContainer<>(LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE, Block.BLOCK_STATE_REGISTRY, NbtUtils::readBlockState, NbtUtils::writeBlockState, Blocks.AIR.defaultBlockState(), world == null ? null : world.chunkPacketBlockController.getPredefinedBlockData(world, chunk, this, initializeBlocks), initializeBlocks); // Paper - Anti-Xray - Add predefined block data - this.states = new PalettedContainer<>(GLOBAL_BLOCKSTATE_PALETTE, Block.BLOCK_STATE_REGISTRY, NbtUtils::readBlockState, NbtUtils::writeBlockState, Blocks.AIR.defaultBlockState());
+ this.states = new PalettedContainer<>(GLOBAL_BLOCKSTATE_PALETTE, Block.BLOCK_STATE_REGISTRY, NbtUtils::readBlockState, NbtUtils::writeBlockState, Blocks.AIR.defaultBlockState(),
+ world == null ? null : world.chunkPacketBlockController.getPredefinedBlockData(world, chunk, this, initializeBlocks), initializeBlocks); // Paper - Anti-Xray - Add predefined block data
} }
public final BlockState getBlockState(int x, int y, int z) { // Paper public static int getBottomBlockY(int chunkPos) {
@@ -139,10 +147,14 @@ public class LevelChunkSection { @@ -147,9 +156,12 @@ public class LevelChunkSection {
return this.states; this.states.read(buf);
} }
- public void writeChunkSection(FriendlyByteBuf packetDataSerializer) { this.write(packetDataSerializer); } // Paper - OBFHELPER - public void write(FriendlyByteBuf buf) {
- public void write(FriendlyByteBuf packetdataserializer) { + // Paper start
+ // Paper start - Anti-Xray - Add chunk packet info + @Deprecated public void write(FriendlyByteBuf buf) { write(buf, null); } // Notice for updates: Please make sure this method isn't used anywhere
+ @Deprecated public final void writeChunkSection(FriendlyByteBuf packetDataSerializer) { this.write(packetDataSerializer); } // OBFHELPER // Notice for updates: Please make sure this method isn't used anywhere + public void write(FriendlyByteBuf buf, com.destroystokyo.paper.antixray.ChunkPacketInfo<BlockState> chunkPacketInfo) {
+ @Deprecated public final void write(FriendlyByteBuf packetdataserializer) { this.writeChunkSection(packetdataserializer, null); } // Notice for updates: Please make sure this method isn't used anywhere
+ public final void writeChunkSection(FriendlyByteBuf packetDataSerializer, ChunkPacketInfo<BlockState> chunkPacketInfo) { this.b(packetDataSerializer, chunkPacketInfo); } // OBFHELPER
+ public void b(FriendlyByteBuf packetdataserializer, ChunkPacketInfo<BlockState> chunkPacketInfo) {
+ // Paper end + // Paper end
packetdataserializer.writeShort(this.nonEmptyBlockCount); buf.writeShort(this.nonEmptyBlockCount);
- this.states.write(packetdataserializer); - this.states.write(buf);
+ this.states.writeDataPaletteBlock(packetdataserializer, chunkPacketInfo, this.bottomBlockY >> 4); // Paper - Anti-Xray - Add chunk packet info + this.states.write(buf, chunkPacketInfo, this.bottomBlockY >> 4); // Paper - Anti-Xray - Add chunk packet info
} }
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 917b0a64083ebbe24321089b784b91f3af4918b9..dd252372e1e380674b1191e9ea265cbb10de437b 100644 index 5ea60bbb56450502f1ceb41959239ab579458ac2..efe4d45b431890e4821f977b8f9fafdab7de3be2 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
@@ -1,6 +1,7 @@ @@ -28,6 +28,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
package net.minecraft.world.level.chunk;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
+import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info
import java.util.Arrays;
import java.util.Objects;
import java.util.concurrent.locks.ReentrantLock;
@@ -26,6 +27,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
private final Function<CompoundTag, T> reader; private final Function<CompoundTag, T> reader;
private final Function<T, CompoundTag> writer; private final Function<T, CompoundTag> writer;
private final T defaultValue; private final T defaultValue;
@ -1379,26 +1289,23 @@ index 917b0a64083ebbe24321089b784b91f3af4918b9..dd252372e1e380674b1191e9ea265cbb
protected BitStorage storage; public final BitStorage getDataBits() { return this.storage; } // Paper - OBFHELPER protected BitStorage storage; public final BitStorage getDataBits() { return this.storage; } // Paper - OBFHELPER
private Palette<T> palette; private Palette<T> getDataPalette() { return this.palette; } // Paper - OBFHELPER private Palette<T> palette; private Palette<T> getDataPalette() { return this.palette; } // Paper - OBFHELPER
private int bits; private int getBitsPerObject() { return this.bits; } // Paper - OBFHELPER private int bits; private int getBitsPerObject() { return this.bits; } // Paper - OBFHELPER
@@ -50,14 +52,47 @@ public class PalettedContainer<T> implements PaletteResize<T> { @@ -48,15 +49,51 @@ public class PalettedContainer<T> implements PaletteResize<T> {
//this.j.unlock(); // Paper - disable this this.lock.release();
} }
- public PalettedContainer(Palette<T> fallbackPalette, IdMapper<T> idList, Function<CompoundTag, T> elementDeserializer, Function<T, CompoundTag> elementSerializer, T defaultElement) { - public PalettedContainer(Palette<T> fallbackPalette, IdMapper<T> idList, Function<CompoundTag, T> elementDeserializer, Function<T, CompoundTag> elementSerializer, T defaultElement) {
- this.globalPalette = fallbackPalette;
- this.registry = idList;
- this.reader = elementDeserializer;
- this.writer = elementSerializer;
- this.defaultValue = defaultElement;
- this.setBits(4);
+ // Paper start - Anti-Xray - Add predefined objects + // Paper start - Anti-Xray - Add predefined objects
+ @Deprecated public PalettedContainer(Palette<T> fallbackPalette, IdMapper<T> idList, Function<CompoundTag, T> elementDeserializer, Function<T, CompoundTag> elementSerializer, T defaultElement) { this(fallbackPalette, idList, elementDeserializer, elementSerializer, defaultElement, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere + @Deprecated public PalettedContainer(Palette<T> fallbackPalette, IdMapper<T> idList, Function<CompoundTag, T> elementDeserializer, Function<T, CompoundTag> elementSerializer, T defaultElement) { // Notice for updates: Please make sure this constructor isn't used anywhere
+ public PalettedContainer(Palette<T> datapalette, IdMapper<T> registryblockid, Function<CompoundTag, T> function, Function<T, CompoundTag> function1, T t0, T[] predefinedObjects, boolean initialize) { + this(fallbackPalette, idList, elementDeserializer, elementSerializer, defaultElement, null, true);
+ }
+ public PalettedContainer(Palette<T> fallbackPalette, IdMapper<T> idList, Function<CompoundTag, T> elementDeserializer, Function<T, CompoundTag> elementSerializer, T defaultElement, T[] predefinedObjects, boolean initialize) {
+ // Paper end + // Paper end
+ this.globalPalette = datapalette; this.globalPalette = fallbackPalette;
+ this.registry = registryblockid; this.registry = idList;
+ this.reader = function; this.reader = elementDeserializer;
+ this.writer = function1; this.writer = elementSerializer;
+ this.defaultValue = t0; this.defaultValue = defaultElement;
this.setBits(4);
+ // Paper start - Anti-Xray - Add predefined objects + // Paper start - Anti-Xray - Add predefined objects
+ this.predefinedObjects = predefinedObjects; + this.predefinedObjects = predefinedObjects;
+ +
@ -1420,168 +1327,119 @@ index 917b0a64083ebbe24321089b784b91f3af4918b9..dd252372e1e380674b1191e9ea265cbb
+ } + }
+ } + }
+ // Paper end + // Paper end
+ } }
+
+ // Paper start - Anti-Xray - Add predefined objects + // Paper start - Anti-Xray - Add predefined objects
+ private void addPredefinedObjects() { + private void addPredefinedObjects() {
+ if (this.predefinedObjects != null && this.getDataPalette() != this.getDataPaletteGlobal()) { + if (this.predefinedObjects != null && this.palette != this.globalPalette) {
+ for (int i = 0; i < this.predefinedObjects.length; i++) { + for (T predefinedObject : this.predefinedObjects) {
+ this.getDataPalette().getOrCreateIdFor(this.predefinedObjects[i]); + this.palette.getOrCreateIdFor(predefinedObject);
+ } + }
+ } + }
} + }
+ // Paper end + // Paper end
+
private static int getIndex(int x, int y, int z) { private static int getIndex(int x, int y, int z) {
return y << 8 | z << 4 | x; return y << 8 | z << 4 | x;
@@ -92,6 +127,7 @@ public class PalettedContainer<T> implements PaletteResize<T> { }
@@ -86,6 +123,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
int j; Palette<T> palette = this.palette;
this.setBits(newSize);
+ this.addPredefinedObjects(); // Paper - Anti-Xray - Add predefined objects + this.addPredefinedObjects(); // Paper - Anti-Xray - Add predefined objects
for (j = 0; j < databits.getSize(); ++j) { for(int i = 0; i < bitStorage.getSize(); ++i) {
T t1 = datapalette.valueFor(databits.get(j)); T object = palette.valueFor(bitStorage.get(i));
if (object != null) {
@@ -141,24 +177,38 @@ public class PalettedContainer<T> implements PaletteResize<T> { @@ -161,11 +199,24 @@ public class PalettedContainer<T> implements PaletteResize<T> {
return t0 == null ? this.defaultValue : t0;
} }
- public void writeDataPaletteBlock(FriendlyByteBuf packetDataSerializer) { this.write(packetDataSerializer); } // Paper - OBFHELPER public void writeDataPaletteBlock(FriendlyByteBuf packetDataSerializer) { this.write(packetDataSerializer); } // Paper - OBFHELPER
- public synchronized void write(FriendlyByteBuf buf) { // Paper - synchronize - public void write(FriendlyByteBuf buf) {
+ // Paper start - Anti-Xray - Add chunk packet info + // Paper start - Anti-Xray - Add chunk packet info
+ @Deprecated public void writeDataPaletteBlock(FriendlyByteBuf packetDataSerializer) { this.write(packetDataSerializer); } // OBFHELPER // Notice for updates: Please make sure this method isn't used anywhere + @Deprecated public void write(FriendlyByteBuf buf) {
+ @Deprecated public void write(FriendlyByteBuf buf) { this.writeDataPaletteBlock(buf, null, 0); } // Notice for updates: Please make sure this method isn't used anywhere + write(buf, null, 0);
+ public void writeDataPaletteBlock(FriendlyByteBuf packetDataSerializer, ChunkPacketInfo<T> chunkPacketInfo, int chunkSectionIndex) { this.b(packetDataSerializer, chunkPacketInfo, chunkSectionIndex); } // OBFHELPER + }
+ public synchronized void b(FriendlyByteBuf packetdataserializer, ChunkPacketInfo<T> chunkPacketInfo, int chunkSectionIndex) { // Paper - synchronize + public void write(FriendlyByteBuf buf, com.destroystokyo.paper.antixray.ChunkPacketInfo<T> chunkPacketInfo, int chunkSectionIndex) {
+ // Paper end + // Paper end
this.acquire(); try {
- buf.writeByte(this.bits); this.acquire();
- this.palette.write(buf); buf.writeByte(this.bits);
- buf.writeLongArray(this.storage.getRaw()); this.palette.write(buf);
+ packetdataserializer.writeByte(this.bits); + // Paper start - Anti-Xray - Add chunk packet info
+ this.palette.write(packetdataserializer); + if (chunkPacketInfo != null) {
+ // Paper start - Anti-Xray - Add chunk packet info + chunkPacketInfo.setBitsPerObject(chunkSectionIndex, this.bits);
+ if (chunkPacketInfo != null) { + chunkPacketInfo.setDataPalette(chunkSectionIndex, this.palette);
+ chunkPacketInfo.setBitsPerObject(chunkSectionIndex, this.getBitsPerObject()); + chunkPacketInfo.setDataBitsIndex(chunkSectionIndex, buf.writerIndex() + FriendlyByteBuf.getVarIntSize(this.storage.getDataBits().length));
+ chunkPacketInfo.setDataPalette(chunkSectionIndex, this.getDataPalette()); + chunkPacketInfo.setPredefinedObjects(chunkSectionIndex, this.predefinedObjects);
+ chunkPacketInfo.setDataBitsIndex(chunkSectionIndex, packetdataserializer.writerIndex() + FriendlyByteBuf.countBytes(this.getDataBits().getDataBits().length)); + }
+ chunkPacketInfo.setPredefinedObjects(chunkSectionIndex, this.predefinedObjects); + // Paper end
+ } buf.writeLongArray(this.storage.getRaw());
+ // Paper end } finally {
+ packetdataserializer.writeLongArray(this.storage.getRaw()); this.release();
this.release(); @@ -176,12 +227,14 @@ public class PalettedContainer<T> implements PaletteResize<T> {
} public void read(ListTag paletteNbt, long[] data) {
try {
this.acquire();
- int i = Math.max(4, Mth.ceillog2(paletteNbt.size()));
- if (i != this.bits) {
+ // Paper - Anti-Xray - TODO: Should this.predefinedObjects.length just be added here (faster) or should the contents be compared to calculate the size (less RAM)?
+ int i = Math.max(4, Mth.ceillog2(paletteNbt.size() + (this.predefinedObjects == null ? 0 : this.predefinedObjects.length))); // Paper - Anti-Xray - Calculate the size with predefined objects
+ if (true || i != this.bits) { // Paper - Anti-Xray - Not initialized yet
this.setBits(i);
}
public synchronized void read(ListTag paletteTag, long[] data) { // Paper - synchronize this.palette.read(paletteNbt);
this.acquire(); + this.addPredefinedObjects(); // Paper - Anti-Xray - Add predefined objects
- int i = Math.max(4, Mth.ceillog2(paletteTag.size())); int j = data.length * 64 / 4096;
+ // Paper - Anti-Xray - TODO: Should this.predefinedObjects.length just be added here (faster) or should the contents be compared to calculate the size (less RAM)? if (this.palette == this.globalPalette) {
+ int i = Math.max(4, Mth.ceillog2(paletteTag.size() + (this.predefinedObjects == null ? 0 : this.predefinedObjects.length))); // Paper - Anti-Xray - Calculate the size with predefined objects Palette<T> palette = new HashMapPalette<>(this.registry, i, this.dummyPaletteResize, this.reader, this.writer);
- if (i != this.bits) {
+ if (true || i != this.bits) { // Paper - Anti-Xray - Not initialized yet
this.setBits(i);
}
this.palette.read(paletteTag);
+ this.addPredefinedObjects(); // Paper - Anti-Xray - Add predefined objects
int j = data.length * 64 / 4096;
if (this.palette == this.globalPalette) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
index d8b7b210484079c9ca2c34831c84102cba6692f5..87fd585141ad9818fca0b697cb4c87248fe7ce11 100644 index 245998e2cea32cf15ee2659639c647f449704ec0..cd41b9ee682248a9abde1bf046e54c7e6e485470 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
@@ -64,16 +64,24 @@ public class ProtoChunk implements ChunkAccess { @@ -63,7 +63,7 @@ public class ProtoChunk implements ChunkAccess {
private long inhabitedTime; private long inhabitedTime;
private final Map<GenerationStep.Carving, BitSet> carvingMasks; private final Map<GenerationStep.Carving, BitSet> carvingMasks = new Object2ObjectArrayMap<>();
private volatile boolean isLightCorrect; private volatile boolean isLightCorrect;
+ private final Level world; // Paper - Anti-Xray - Add world - final net.minecraft.world.level.Level level; // Paper - Add level
+ final net.minecraft.server.level.ServerLevel level; // Paper - Add level
- public ProtoChunk(ChunkPos pos, UpgradeData upgradeData) { // Paper start - add level
- this(pos, upgradeData, (LevelChunkSection[]) null, new ProtoTickList<>((block) -> { @Deprecated public ProtoChunk(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor world) { this(pos, upgradeData, world, null); }
+ // Paper start - Anti-Xray - Add world @@ -506,4 +506,15 @@ public class ProtoChunk implements ChunkAccess {
+ @Deprecated public ProtoChunk(ChunkPos pos, UpgradeData upgradeData) { this(pos, upgradeData, null); } // Notice for updates: Please make sure this constructor isn't used anywhere public int getHeight() {
+ public ProtoChunk(ChunkPos chunkcoordintpair, UpgradeData chunkconverter, Level world) { return this.levelHeightAccessor.getHeight();
+ // Paper end
+ this(chunkcoordintpair, chunkconverter, (LevelChunkSection[]) null, new ProtoTickList<>((block) -> {
return block == null || block.defaultBlockState().isAir();
- }, pos), new ProtoTickList<>((fluidtype) -> {
+ }, chunkcoordintpair), new ProtoTickList<>((fluidtype) -> {
return fluidtype == null || fluidtype == Fluids.EMPTY;
- }, pos));
+ }, chunkcoordintpair), world); // Paper - Anti-Xray - Add world
} }
+
- public ProtoChunk(ChunkPos pos, UpgradeData upgradeData, @Nullable LevelChunkSection[] sections, ProtoTickList<Block> blockTickScheduler, ProtoTickList<Fluid> fluidTickScheduler) { + @Override
+ // Paper start - Anti-Xray - Add world + public net.minecraft.world.level.chunk.LevelChunkSection getOrCreateSection(final int yIndex) {
+ @Deprecated public ProtoChunk(ChunkPos pos, UpgradeData upgradeData, @Nullable LevelChunkSection[] sections, ProtoTickList<Block> blockTickScheduler, ProtoTickList<Fluid> fluidTickScheduler) { this(pos, upgradeData, sections, blockTickScheduler, fluidTickScheduler, null); } // Notice for updates: Please make sure this constructor isn't used anywhere + LevelChunkSection[] levelChunkSections = this.getSections();
+ public ProtoChunk(ChunkPos chunkcoordintpair, UpgradeData chunkconverter, @Nullable LevelChunkSection[] achunksection, ProtoTickList<Block> protochunkticklist, ProtoTickList<Fluid> protochunkticklist1, Level world) { + if (levelChunkSections[yIndex] == LevelChunk.EMPTY_SECTION) {
+ this.world = world; + // Paper - diff on change in ProtoChunk
+ // Paper end + levelChunkSections[yIndex] = new LevelChunkSection(this.getSectionYFromSectionIndex(yIndex), this, this.level, true); // Paper - Anti-Xray - Add parameters
this.heightmaps = Maps.newEnumMap(Heightmap.Types.class); + }
this.status = ChunkStatus.EMPTY; +
this.blockEntities = Maps.newHashMap(); + return levelChunkSections[yIndex];
@@ -85,15 +93,15 @@ public class ProtoChunk implements ChunkAccess { + }
this.structureStarts = Maps.newHashMap(); }
this.structuresRefences = Maps.newHashMap();
this.carvingMasks = new Object2ObjectArrayMap();
- this.chunkPos = pos;
- this.upgradeData = upgradeData;
- this.blockTicks = blockTickScheduler;
- this.liquidTicks = fluidTickScheduler;
- if (sections != null) {
- if (this.sections.length == sections.length) {
- System.arraycopy(sections, 0, this.sections, 0, this.sections.length);
+ this.chunkPos = chunkcoordintpair;
+ this.upgradeData = chunkconverter;
+ this.blockTicks = protochunkticklist;
+ this.liquidTicks = protochunkticklist1;
+ if (achunksection != null) {
+ if (this.sections.length == achunksection.length) {
+ System.arraycopy(achunksection, 0, this.sections, 0, this.sections.length);
} else {
- ProtoChunk.LOGGER.warn("Could not set level chunk sections, array length is {} instead of {}", sections.length, this.sections.length);
+ ProtoChunk.LOGGER.warn("Could not set level chunk sections, array length is {} instead of {}", achunksection.length, this.sections.length);
}
}
@@ -228,7 +236,7 @@ public class ProtoChunk implements ChunkAccess {
public LevelChunkSection getOrCreateSection(int y) {
if (this.sections[y] == LevelChunk.EMPTY_SECTION) {
- this.sections[y] = new LevelChunkSection(y << 4);
+ this.sections[y] = new LevelChunkSection(y << 4, this, this.world, true); // Paper - Anti-Xray - Add parameters
}
return this.sections[y];
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 969130442b529eaac6f708107ff129f89cc0af90..8dbd1dc2de400ad0c6c2be49ba09dfc03216ffd2 100644 index 7c04aef3eac54981ca1e34cb87d97104c3c9685b..097d38f12ef324dbb529a833383e2da949377f9c 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
@@ -101,7 +101,7 @@ public class ChunkSerializer { @@ -136,7 +136,7 @@ public class ChunkSerializer {
byte b0 = nbttagcompound2.getByte("Y"); byte b0 = nbttagcompound2.getByte("Y");
if (nbttagcompound2.contains("Palette", 9) && nbttagcompound2.contains("BlockStates", 12)) { if (nbttagcompound2.contains("Palette", 9) && nbttagcompound2.contains("BlockStates", 12)) {
- LevelChunkSection chunksection = new LevelChunkSection(b0 << 4); - LevelChunkSection chunksection = new LevelChunkSection(b0);
+ LevelChunkSection chunksection = new LevelChunkSection(b0 << 4, null, world, false); // Paper - Anti-Xray - Add parameters + LevelChunkSection chunksection = new LevelChunkSection(b0, null, world, false); // Paper - Anti-Xray - Add parameters
chunksection.getStates().read(nbttagcompound2.getList("Palette", 10), nbttagcompound2.getLongArray("BlockStates")); chunksection.getStates().read(nbttagcompound2.getList("Palette", 10), nbttagcompound2.getLongArray("BlockStates"));
chunksection.recalcBlockCounts(); chunksection.recalcBlockCounts();
@@ -165,7 +165,7 @@ public class ChunkSerializer {
// CraftBukkit end
});
} else {
- ProtoChunk protochunk = new ProtoChunk(pos, chunkconverter, achunksection, protochunkticklist, protochunkticklist1);
+ ProtoChunk protochunk = new ProtoChunk(pos, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, world); // Paper - Anti-Xray - Add parameter
protochunk.setBiomes(biomestorage);
object = protochunk;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index 423594177fe78600755d913f169f28dd1bfa2b37..74bad15034d9d55fb70931f38868f812160c6305 100644 index 245d764d3dcc549fa8acbd7c9024a3c88d2d2a74..4dd7cea1eec5ec55a3700ce9786da8a513e72a28 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -43,7 +43,7 @@ public class CraftChunk implements Chunk { @@ -46,7 +46,7 @@ public class CraftChunk implements Chunk {
private final ServerLevel worldServer; private final ServerLevel worldServer;
private final int x; private final int x;
private final int z; private final int z;
@ -1590,7 +1448,7 @@ index 423594177fe78600755d913f169f28dd1bfa2b37..74bad15034d9d55fb70931f38868f812
private static final byte[] emptyLight = new byte[2048]; private static final byte[] emptyLight = new byte[2048];
public CraftChunk(net.minecraft.world.level.chunk.LevelChunk chunk) { public CraftChunk(net.minecraft.world.level.chunk.LevelChunk chunk) {
@@ -287,7 +287,7 @@ public class CraftChunk implements Chunk { @@ -275,7 +275,7 @@ public class CraftChunk implements Chunk {
CompoundTag data = new CompoundTag(); CompoundTag data = new CompoundTag();
cs[i].getStates().write(data, "Palette", "BlockStates"); cs[i].getStates().write(data, "Palette", "BlockStates");
@ -1600,27 +1458,27 @@ index 423594177fe78600755d913f169f28dd1bfa2b37..74bad15034d9d55fb70931f38868f812
sectionBlockIDs[i] = blockids; sectionBlockIDs[i] = blockids;
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
index a94c65f4d63a06be099fd67b0b7756c5b45b84a0..8d72cd6a44cf462cfe3adac9bf99a16883a587df 100644 index 3d905c98704da64cefd009b2c796b24e729396a5..fe7851476636dfed02339d4d9f93824b96086769 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java --- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
@@ -21,9 +21,11 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData { @@ -22,9 +22,11 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
private final int maxHeight; private final int maxHeight;
private final LevelChunkSection[] sections; private final LevelChunkSection[] sections;
private Set<BlockPos> tiles; private Set<BlockPos> tiles;
+ private World world; // Paper - Anti-Xray - Add world + private World world; // Paper - Anti-Xray - Add world
public CraftChunkData(World world) { public CraftChunkData(World world) {
this(world.getMaxHeight()); this(world.getMinHeight(), world.getMaxHeight());
+ this.world = world; // Paper - Anti-Xray - Add world + this.world = world; // Paper - Anti-Xray - Add world
} }
/* pp for tests */ CraftChunkData(int maxHeight) { /* pp for tests */ CraftChunkData(int minHeight, int maxHeight) {
@@ -157,7 +159,7 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData { @@ -162,7 +164,7 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
private LevelChunkSection getChunkSection(int y, boolean create) { int offset = (y - this.minHeight) >> 4;
LevelChunkSection section = sections[y >> 4]; LevelChunkSection section = this.sections[offset];
if (create && section == null) { if (create && section == null) {
- sections[y >> 4] = section = new LevelChunkSection(y >> 4 << 4); - this.sections[offset] = section = new LevelChunkSection(offset + (this.minHeight >> 4));
+ sections[y >> 4] = section = new LevelChunkSection(y >> 4 << 4, null, world instanceof org.bukkit.craftbukkit.CraftWorld ? ((org.bukkit.craftbukkit.CraftWorld) world).getHandle() : null, true); // Paper - Anti-Xray - Add parameters + this.sections[offset] = section = new LevelChunkSection(offset + (this.minHeight >> 4), null, world instanceof org.bukkit.craftbukkit.CraftWorld ? ((org.bukkit.craftbukkit.CraftWorld) world).getHandle() : null, true); // Paper - Anti-Xray - Add parameters
} }
return section; return section;
} }

Datei anzeigen

@ -23,20 +23,21 @@ index f27fadc15cb7f5c782e45885ec6a5a69963beade..2ff4d4921e2076abf415bd3c8f5173ec
})); }));
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index e29566cad2647da4d9288e912188b57f00e8dd0c..3cd8895adecd345c3bdfb8b5e3e9fdf0ef9097db 100644 index 51691d3dedf113d58f340b74d448c5e5375b5bed..b2f0102c2a15eb4324367f52e03e534bff883f9b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -445,5 +445,10 @@ public class PaperWorldConfig { @@ -448,6 +448,11 @@ public class PaperWorldConfig {
private void lightQueueSize() {
lightQueueSize = getInt("light-queue-size", lightQueueSize); lightQueueSize = getInt("light-queue-size", lightQueueSize);
} }
+
+ public int noTickViewDistance; + public int noTickViewDistance;
+ private void viewDistance() { + private void viewDistance() {
+ this.noTickViewDistance = this.getInt("viewdistances.no-tick-view-distance", -1); + this.noTickViewDistance = this.getInt("viewdistances.no-tick-view-distance", -1);
+ } + }
} +
public boolean antiXray;
public EngineMode engineMode;
public int maxChunkSectionIndex;
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index bb0a07a280c7d4885165e9d6488e7741aaa7b47c..9c88426ab1275ee5fb6e28be8b213533dc4ab859 100644 index bb0a07a280c7d4885165e9d6488e7741aaa7b47c..9c88426ab1275ee5fb6e28be8b213533dc4ab859 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java --- a/src/main/java/net/minecraft/server/MCUtil.java
@ -144,7 +145,7 @@ index 3653ec6f93d627092e63cede51f4db2e12b10613..995d7977233f0d7683c00a75c3833f9a
public CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getOrScheduleFuture(ChunkStatus targetStatus, ChunkMap chunkStorage) { public CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getOrScheduleFuture(ChunkStatus targetStatus, ChunkMap chunkStorage) {
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 480c361c919bbfbebacf9ac94418eac5ed38e233..fdf5d8ede4b01e399272ddebfbd49258b166f00b 100644 index 56dece64f19009583c94569c5713c2ad0c91ae17..b0cf6e186d7030b1aa9296671683bd33e2d15579 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
@@ -122,7 +122,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -122,7 +122,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -486,7 +487,7 @@ index 480c361c919bbfbebacf9ac94418eac5ed38e233..fdf5d8ede4b01e399272ddebfbd49258
+ +
+ public void playerLoadedChunk(ServerPlayer player, Packet<?>[] packets, LevelChunk chunk) { // Paper - private -> public + public void playerLoadedChunk(ServerPlayer player, Packet<?>[] packets, LevelChunk chunk) { // Paper - private -> public
if (packets[0] == null) { if (packets[0] == null) {
packets[0] = new ClientboundLevelChunkPacket(chunk); packets[0] = new ClientboundLevelChunkPacket(chunk, chunk.level.chunkPacketBlockController.shouldModify(player, chunk)); // Paper - Ani-Xray - Bypass
packets[1] = new ClientboundLightUpdatePacket(chunk.getPos(), this.lightEngine, (BitSet) null, (BitSet) null, true); packets[1] = new ClientboundLightUpdatePacket(chunk.getPos(), this.lightEngine, (BitSet) null, (BitSet) null, true);
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
index 45c7ebe67019cdbe88b6617a95d5c40d3a68286c..38eebda226e007c8910e04f502ce218cdfe1d456 100644 index 45c7ebe67019cdbe88b6617a95d5c40d3a68286c..38eebda226e007c8910e04f502ce218cdfe1d456 100644
@ -556,10 +557,10 @@ index bcc946d2747443c34ee8ac2485a5ab41773c93af..2730923bd0bf3b0f928765b9e09e2299
while (iterator.hasNext()) { while (iterator.hasNext()) {
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 aa198e9f2755734eac591bd3f94679518e9d7270..507a70521a97c463d6fd22b788c39e9f458971c3 100644 index 687e3652d0f36a358a2348df845801ad82d8460c..4eee8156d193f59b7e28499f492f81247c4b1591 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
@@ -522,8 +522,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -527,8 +527,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2); this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
} }
@ -575,7 +576,7 @@ index aa198e9f2755734eac591bd3f94679518e9d7270..507a70521a97c463d6fd22b788c39e9f
if ((i & 1) != 0) { if ((i & 1) != 0) {
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 521f199e495f3bec232cc9ca36e51e0392afe737..922026da8c234427e0322443004d3c32993adfce 100644 index d4e11b552988f0ef28059f9aa2ca1f1897653171..f6b591f045ae992180806fd6aba309c0d04e722b 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
@@ -33,7 +33,10 @@ import net.minecraft.core.Registry; @@ -33,7 +33,10 @@ import net.minecraft.core.Registry;

Datei anzeigen

@ -5,44 +5,29 @@ Subject: [PATCH] Implement alternative item-despawn-rate
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 3cd8895adecd345c3bdfb8b5e3e9fdf0ef9097db..be4a36df28d4f16727daad1270d5c3a84ae94613 100644 index b2f0102c2a15eb4324367f52e03e534bff883f9b..3f4a9ce31981f77b1c451a5d9ba91d6c9ab67587 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -1,8 +1,13 @@ @@ -453,6 +453,54 @@ public class PaperWorldConfig {
package com.destroystokyo.paper;
+import java.util.EnumMap;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig;
@@ -450,5 +455,53 @@ public class PaperWorldConfig {
private void viewDistance() {
this.noTickViewDistance = this.getInt("viewdistances.no-tick-view-distance", -1); this.noTickViewDistance = this.getInt("viewdistances.no-tick-view-distance", -1);
} }
+
+ public boolean altItemDespawnRateEnabled; + public boolean altItemDespawnRateEnabled;
+ public Map<Material, Integer> altItemDespawnRateMap; + public java.util.Map<org.bukkit.Material, Integer> altItemDespawnRateMap;
+ private void altItemDespawnRate() { + private void altItemDespawnRate() {
+ String path = "alt-item-despawn-rate"; + String path = "alt-item-despawn-rate";
+ +
+ altItemDespawnRateEnabled = getBoolean(path + ".enabled", false); + altItemDespawnRateEnabled = getBoolean(path + ".enabled", false);
+ +
+ Map<Material, Integer> altItemDespawnRateMapDefault = new EnumMap<>(Material.class); + java.util.Map<org.bukkit.Material, Integer> altItemDespawnRateMapDefault = new java.util.EnumMap<>(org.bukkit.Material.class);
+ altItemDespawnRateMapDefault.put(Material.COBBLESTONE, 300); + altItemDespawnRateMapDefault.put(org.bukkit.Material.COBBLESTONE, 300);
+ for (Material key : altItemDespawnRateMapDefault.keySet()) { + for (org.bukkit.Material key : altItemDespawnRateMapDefault.keySet()) {
+ config.addDefault("world-settings.default." + path + ".items." + key, altItemDespawnRateMapDefault.get(key)); + config.addDefault("world-settings.default." + path + ".items." + key, altItemDespawnRateMapDefault.get(key));
+ } + }
+ +
+ Map<String, Integer> rawMap = new HashMap<>(); + java.util.Map<String, Integer> rawMap = new java.util.HashMap<>();
+ try { + try {
+ ConfigurationSection mapSection = config.getConfigurationSection("world-settings." + worldName + "." + path + ".items"); + org.bukkit.configuration.ConfigurationSection mapSection = config.getConfigurationSection("world-settings." + worldName + "." + path + ".items");
+ if (mapSection == null) { + if (mapSection == null) {
+ mapSection = config.getConfigurationSection("world-settings.default." + path + ".items"); + mapSection = config.getConfigurationSection("world-settings.default." + path + ".items");
+ } + }
@ -56,26 +41,28 @@ index 3cd8895adecd345c3bdfb8b5e3e9fdf0ef9097db..be4a36df28d4f16727daad1270d5c3a8
+ altItemDespawnRateEnabled = false; + altItemDespawnRateEnabled = false;
+ } + }
+ +
+ altItemDespawnRateMap = new EnumMap<>(Material.class); + altItemDespawnRateMap = new java.util.EnumMap<>(org.bukkit.Material.class);
+ if (!altItemDespawnRateEnabled) { + if (!altItemDespawnRateEnabled) {
+ return; + return;
+ } + }
+ +
+ for(String key : rawMap.keySet()) { + for(String key : rawMap.keySet()) {
+ try { + try {
+ altItemDespawnRateMap.put(Material.valueOf(key), rawMap.get(key)); + altItemDespawnRateMap.put(org.bukkit.Material.valueOf(key), rawMap.get(key));
+ } catch (Exception e) { + } catch (Exception e) {
+ logError("Could not add item " + key + " to altItemDespawnRateMap: " + e.getMessage()); + logError("Could not add item " + key + " to altItemDespawnRateMap: " + e.getMessage());
+ } + }
+ } + }
+ if(altItemDespawnRateEnabled) { + if(altItemDespawnRateEnabled) {
+ for(Material key : altItemDespawnRateMap.keySet()) { + for(org.bukkit.Material key : altItemDespawnRateMap.keySet()) {
+ log("Alternative item despawn rate of " + key + ": " + altItemDespawnRateMap.get(key)); + log("Alternative item despawn rate of " + key + ": " + altItemDespawnRateMap.get(key));
+ } + }
+ } + }
+ } + }
} +
public boolean antiXray;
public EngineMode engineMode;
public int maxChunkSectionIndex;
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 9ee1dc89dd4c6b9453e1f6f92208d454877d23c9..e0c13a112c95eed9867d4608e18dc797b0c9c9cf 100644 index 9ee1dc89dd4c6b9453e1f6f92208d454877d23c9..e0c13a112c95eed9867d4608e18dc797b0c9c9cf 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java

Datei anzeigen

@ -8,7 +8,7 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code
Also ignores Enderdragon, defaulting it to Mojang's setting Also ignores Enderdragon, defaulting it to Mojang's setting
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 fdf5d8ede4b01e399272ddebfbd49258b166f00b..273cd2e0fc38801a5ecb26579e4d0e9ee017bb3c 100644 index b0cf6e186d7030b1aa9296671683bd33e2d15579..280bd301b7005d16fec293311f11485b94ded550 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
@@ -1791,6 +1791,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially @@ -1791,6 +1791,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially

Datei anzeigen

@ -25,11 +25,11 @@ index fe79c0add4f7cb18d487c5bb9415c40c5b551ea2..8d9ddad1879e7616d980ca70de8aecac
poiUnload = Timings.ofSafe(name + "Chunk unload - POI"); poiUnload = Timings.ofSafe(name + "Chunk unload - POI");
chunkUnload = Timings.ofSafe(name + "Chunk unload - Chunk"); chunkUnload = Timings.ofSafe(name + "Chunk unload - Chunk");
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index be4a36df28d4f16727daad1270d5c3a84ae94613..16f013ffe992a934e9d0b32e764a14a8fd204449 100644 index 3f4a9ce31981f77b1c451a5d9ba91d6c9ab67587..a69efd1a21a667c5eee539f6c761755479375527 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -503,5 +503,10 @@ public class PaperWorldConfig { @@ -534,5 +534,10 @@ public class PaperWorldConfig {
} Bukkit.getLogger().warning("You have enabled permission-based Anti-Xray checking - depending on your permission plugin, this may cause performance issues");
} }
} }
+ +
@ -545,18 +545,10 @@ index 0000000000000000000000000000000000000000..11de56afaf059b00fa5bec293516bcdc
+ } + }
+} +}
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 273cd2e0fc38801a5ecb26579e4d0e9ee017bb3c..e1498a5a8e664b922c77a8524ed2ea38c91834ce 100644 index 280bd301b7005d16fec293311f11485b94ded550..d3f835a0c76ce559fb5f3c39714a3312c7e865d1 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
@@ -69,6 +69,7 @@ import net.minecraft.util.thread.ProcessorMailbox; @@ -140,6 +140,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
+import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.entity.ai.village.poi.PoiManager;
import net.minecraft.world.entity.boss.EnderDragonPart;
import net.minecraft.world.level.ChunkPos;
@@ -140,6 +141,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private final Long2ByteMap chunkTypeCache; private final Long2ByteMap chunkTypeCache;
private final Queue<Runnable> unloadQueue; private final Queue<Runnable> unloadQueue;
int viewDistance; int viewDistance;
@ -564,7 +556,7 @@ index 273cd2e0fc38801a5ecb26579e4d0e9ee017bb3c..e1498a5a8e664b922c77a8524ed2ea38
// CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public final CallbackExecutor callbackExecutor = new CallbackExecutor();
@@ -263,6 +265,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -263,6 +264,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.overworldDataStorage = persistentStateManagerFactory; this.overworldDataStorage = persistentStateManagerFactory;
this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, dsync, world); this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, dsync, world);
this.setViewDistance(viewDistance); this.setViewDistance(viewDistance);
@ -572,7 +564,7 @@ index 273cd2e0fc38801a5ecb26579e4d0e9ee017bb3c..e1498a5a8e664b922c77a8524ed2ea38
// Paper start - no-tick view distance // Paper start - no-tick view distance
this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance); this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance);
this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets,
@@ -304,6 +307,25 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -304,6 +306,25 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end - no-tick view distance // Paper end - no-tick view distance
} }
@ -590,7 +582,7 @@ index 273cd2e0fc38801a5ecb26579e4d0e9ee017bb3c..e1498a5a8e664b922c77a8524ed2ea38
+ } + }
+ } + }
+ +
+ public int getMobCountNear(ServerPlayer entityPlayer, MobCategory enumCreatureType) { + public int getMobCountNear(ServerPlayer entityPlayer, net.minecraft.world.entity.MobCategory enumCreatureType) {
+ return entityPlayer.mobCounts[enumCreatureType.ordinal()]; + return entityPlayer.mobCounts[enumCreatureType.ordinal()];
+ } + }
+ // Paper end + // Paper end

Datei anzeigen

@ -14,10 +14,10 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear
Combined, this adds up a lot. Combined, this adds up a lot.
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 507a70521a97c463d6fd22b788c39e9f458971c3..1dc1f7a5319e067b5f56c2fdadf04547ae1bc9ea 100644 index 4eee8156d193f59b7e28499f492f81247c4b1591..641f022c4c716e0441a098f4540fd008059a4b51 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
@@ -984,7 +984,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -989,7 +989,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
} }
} }

Datei anzeigen

@ -71,7 +71,7 @@ index 0000000000000000000000000000000000000000..3edc8e52e06a62ce9f8cc734fd7458b3
+ } + }
+} +}
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 8d72e68fe8f7d0a770264f54c539ea11f5e1d8da..50efe1bd6a62b71007bf3274f323704be1477ce7 100644 index c5070975be1ceeab20ad0b3bab790426adb5e5fa..86ee1b535a6e586fd4e9e3c37f439d81b4508939 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
@@ -667,7 +667,12 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -667,7 +667,12 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
@ -266,10 +266,10 @@ index e638d982b4bd1d261a7282cad6dab98ad0b55213..e305173fd1652a8b88ae8a9b94d0fae0
public BlockPos getHomePos() { // Paper - public public BlockPos getHomePos() { // Paper - public
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 1dc1f7a5319e067b5f56c2fdadf04547ae1bc9ea..9d5dcaabe43ee36259b24063b4c74daddc7df773 100644 index 641f022c4c716e0441a098f4540fd008059a4b51..944b28b55a38352dfb49aeecca3f196502cb04e8 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
@@ -1300,10 +1300,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1305,10 +1305,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public abstract TagContainer getTagManager(); public abstract TagContainer getTagManager();
public BlockPos getBlockRandomPos(int x, int y, int z, int l) { public BlockPos getBlockRandomPos(int x, int y, int z, int l) {
@ -290,7 +290,7 @@ index 1dc1f7a5319e067b5f56c2fdadf04547ae1bc9ea..9d5dcaabe43ee36259b24063b4c74dad
public boolean noSave() { public boolean noSave() {
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 922026da8c234427e0322443004d3c32993adfce..88b053d8181d2a5abdb2c5527529a81855e1de7c 100644 index f6b591f045ae992180806fd6aba309c0d04e722b..338e93a1855cf0e535e8a9897cffaff1d2e87279 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
@@ -568,6 +568,7 @@ public class LevelChunk implements ChunkAccess { @@ -568,6 +568,7 @@ public class LevelChunk implements ChunkAccess {
@ -302,7 +302,7 @@ index 922026da8c234427e0322443004d3c32993adfce..88b053d8181d2a5abdb2c5527529a818
public int getHeight(Heightmap.Types type, int x, int z) { public int getHeight(Heightmap.Types type, int x, int z) {
return ((Heightmap) this.heightmaps.get(type)).getFirstAvailable(x & 15, z & 15) - 1; return ((Heightmap) this.heightmaps.get(type)).getFirstAvailable(x & 15, z & 15) - 1;
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 5fd66020a937b641e2a060cf38df731a43f3bf55..b5497272bc03a290298b5a829bdf653ac986866b 100644 index b10beabccf5a29098a796e5615eb4632fae95f99..79fda9a003ca4088404d3f0490c0c6a12afa1711 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
@@ -14,11 +14,12 @@ public class LevelChunkSection { @@ -14,11 +14,12 @@ public class LevelChunkSection {
@ -318,9 +318,9 @@ index 5fd66020a937b641e2a060cf38df731a43f3bf55..b5497272bc03a290298b5a829bdf653a
final PalettedContainer<BlockState> states; // Paper - package-private final PalettedContainer<BlockState> states; // Paper - package-private
+ public final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper + public final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper
public LevelChunkSection(int yOffset) { // Paper start - Anti-Xray - Add parameters
this(yOffset, (short)0, (short)0, (short)0); @Deprecated public LevelChunkSection(int yOffset) { this(yOffset, null, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere
@@ -70,6 +71,9 @@ public class LevelChunkSection { @@ -79,6 +80,9 @@ public class LevelChunkSection {
--this.nonEmptyBlockCount; --this.nonEmptyBlockCount;
if (blockState.isRandomlyTicking()) { if (blockState.isRandomlyTicking()) {
--this.tickingBlockCount; --this.tickingBlockCount;
@ -330,7 +330,7 @@ index 5fd66020a937b641e2a060cf38df731a43f3bf55..b5497272bc03a290298b5a829bdf653a
} }
} }
@@ -81,6 +85,9 @@ public class LevelChunkSection { @@ -90,6 +94,9 @@ public class LevelChunkSection {
++this.nonEmptyBlockCount; ++this.nonEmptyBlockCount;
if (state.isRandomlyTicking()) { if (state.isRandomlyTicking()) {
++this.tickingBlockCount; ++this.tickingBlockCount;
@ -340,7 +340,7 @@ index 5fd66020a937b641e2a060cf38df731a43f3bf55..b5497272bc03a290298b5a829bdf653a
} }
} }
@@ -116,22 +123,28 @@ public class LevelChunkSection { @@ -125,22 +132,28 @@ public class LevelChunkSection {
} }
public void recalcBlockCounts() { public void recalcBlockCounts() {
@ -375,10 +375,10 @@ index 5fd66020a937b641e2a060cf38df731a43f3bf55..b5497272bc03a290298b5a829bdf653a
} }
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 5ea60bbb56450502f1ceb41959239ab579458ac2..5ac948b5b82f3144cdf402af440251cb8c7369d7 100644 index efe4d45b431890e4821f977b8f9fafdab7de3be2..82a4b7969e36940cb694bd999b8c03f9c66a71dc 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
@@ -259,6 +259,14 @@ public class PalettedContainer<T> implements PaletteResize<T> { @@ -312,6 +312,14 @@ public class PalettedContainer<T> implements PaletteResize<T> {
}); });
} }

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add option to nerf pigmen from nether portals
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 16f013ffe992a934e9d0b32e764a14a8fd204449..6c7e90f9939d42fdf8d40dd7ec0a6a86d5437451 100644 index a69efd1a21a667c5eee539f6c761755479375527..8b460378d8c2dd1942404f332d4012acb5687773 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -446,6 +446,11 @@ public class PaperWorldConfig { @@ -443,6 +443,11 @@ public class PaperWorldConfig {
log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled")); log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled"));
} }

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add option to allow iron golems to spawn in air
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 6c7e90f9939d42fdf8d40dd7ec0a6a86d5437451..3ac4fe247dd12e039396da5276b83709957823c7 100644 index 8b460378d8c2dd1942404f332d4012acb5687773..a2b1e2c3c4bd958b6ec7b7de5561747d3a2075d2 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -385,6 +385,11 @@ public class PaperWorldConfig { @@ -382,6 +382,11 @@ public class PaperWorldConfig {
scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true); scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true);
} }

Datei anzeigen

@ -8,10 +8,10 @@ This allows you to solve an issue in vanilla behavior where:
* On normal difficulty they will have a 50% of getting infected or dying. * On normal difficulty they will have a 50% of getting infected or dying.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 3ac4fe247dd12e039396da5276b83709957823c7..0863bdab8322b80a3df52c238b55c14401bafe6d 100644 index a2b1e2c3c4bd958b6ec7b7de5561747d3a2075d2..c3f2cdedf7b9c2ff9e33b823cb20890cba0ded8a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -456,6 +456,11 @@ public class PaperWorldConfig { @@ -453,6 +453,11 @@ public class PaperWorldConfig {
nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen); nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen);
} }

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 88b053d8181d2a5abdb2c5527529a81855e1de7c..59a77541bbda880ae8f84e3535a2b6112caa78fb 100644 index 338e93a1855cf0e535e8a9897cffaff1d2e87279..a4398502dd0cbbceb00cffc68702d34bf8ed7e8f 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
@@ -461,18 +461,20 @@ public class LevelChunk implements ChunkAccess { @@ -461,18 +461,20 @@ public class LevelChunk implements ChunkAccess {
@ -49,10 +49,10 @@ index 88b053d8181d2a5abdb2c5527529a81855e1de7c..59a77541bbda880ae8f84e3535a2b611
// 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 b5497272bc03a290298b5a829bdf653ac986866b..fa350db3f4ada07a385d9f57b46aa799effb6039 100644 index 79fda9a003ca4088404d3f0490c0c6a12afa1711..9ca27907c6e1d4d5cc79e954136c63a59d3be2b8 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
@@ -42,7 +42,7 @@ public class LevelChunkSection { @@ -51,7 +51,7 @@ public class LevelChunkSection {
} }
public FluidState getFluidState(int x, int y, int z) { public FluidState getFluidState(int x, int y, int z) {

Datei anzeigen

@ -941,7 +941,7 @@ index 56aa640eb0096e5c5f1a34d6f11a4dd9ac8770df..a81c773cc281ba390d3ce44c52c43710
public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, boolean flag, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<DimensionDataStorage> supplier) { public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, boolean flag, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<DimensionDataStorage> supplier) {
this.level = world; this.level = world;
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 50efe1bd6a62b71007bf3274f323704be1477ce7..a43839ddd468d7b61d5609f22fb1e9fcd873590a 100644 index 86ee1b535a6e586fd4e9e3c37f439d81b4508939..d037b14b34658e2f13d7e77f06576c406abc8a60 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
@@ -289,6 +289,15 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -289,6 +289,15 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl

Datei anzeigen

@ -10,10 +10,10 @@ When not per player it will use the Vanilla mechanic of one delay per
world and the world age for the start day. world and the world age for the start day.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0863bdab8322b80a3df52c238b55c14401bafe6d..4a2b52b5f5c0453c204765ec77e35524ee7e77c1 100644 index c3f2cdedf7b9c2ff9e33b823cb20890cba0ded8a..8f1dcdb3b1beddb5698f596c048869d99e1f4437 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -433,10 +433,21 @@ public class PaperWorldConfig { @@ -430,10 +430,21 @@ public class PaperWorldConfig {
} }
public boolean disablePillagerPatrols = false; public boolean disablePillagerPatrols = false;

Datei anzeigen

@ -7,10 +7,10 @@ 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 e1498a5a8e664b922c77a8524ed2ea38c91834ce..71d5c298e14869d9d44226aeb6ffe3f051827d1a 100644 index d3f835a0c76ce559fb5f3c39714a3312c7e865d1..002561c87ddd03e8bc31864ddd9dee7bc2ff0931 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
@@ -1467,6 +1467,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1466,6 +1466,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
protected void addEntity(Entity entity) { protected void addEntity(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot
@ -26,7 +26,7 @@ index e1498a5a8e664b922c77a8524ed2ea38c91834ce..71d5c298e14869d9d44226aeb6ffe3f0
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 03939f43ade3859a53ccf90e7fc221555ce6e97f..7340a25e49af30ecbb4b212365b9941e24e221d2 100644 index d037b14b34658e2f13d7e77f06576c406abc8a60..9cdfd1c8bce3adb5d3ad6d970c6f46ca75f3a952 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
@@ -2120,7 +2120,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -2120,7 +2120,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl

Datei anzeigen

@ -70,10 +70,10 @@ index 9c88426ab1275ee5fb6e28be8b213533dc4ab859..87c9a5c1b43f6010898d72136b5eb997
List<ChunkHolder> allChunks = new ArrayList<>(visibleChunks.values()); List<ChunkHolder> allChunks = new ArrayList<>(visibleChunks.values());
List<ServerPlayer> players = world.players; List<ServerPlayer> players = world.players;
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 71d5c298e14869d9d44226aeb6ffe3f051827d1a..a75de538835522f92e889452fddd5a3d8fc25f07 100644 index 002561c87ddd03e8bc31864ddd9dee7bc2ff0931..a80c4517cd0d2c5e7b71b4f86b6a8d441a9eb64e 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
@@ -108,9 +108,36 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -107,9 +107,36 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private static final int MIN_VIEW_DISTANCE = 3; private static final int MIN_VIEW_DISTANCE = 3;
public static final int MAX_VIEW_DISTANCE = 33; public static final int MAX_VIEW_DISTANCE = 33;
public static final int MAX_CHUNK_DISTANCE = 33 + ChunkStatus.maxDistance(); public static final int MAX_CHUNK_DISTANCE = 33 + ChunkStatus.maxDistance();
@ -112,7 +112,7 @@ index 71d5c298e14869d9d44226aeb6ffe3f051827d1a..a75de538835522f92e889452fddd5a3d
private final Long2ObjectLinkedOpenHashMap<ChunkHolder> pendingUnloads; private final Long2ObjectLinkedOpenHashMap<ChunkHolder> pendingUnloads;
public final LongSet entitiesInLevel; // Paper - private -> public public final LongSet entitiesInLevel; // Paper - private -> public
public final ServerLevel level; public final ServerLevel level;
@@ -233,7 +260,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -232,7 +259,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) { public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
super(new File(session.getDimensionPath(world.dimension()), "region"), dataFixer, dsync); super(new File(session.getDimensionPath(world.dimension()), "region"), dataFixer, dsync);
@ -121,7 +121,7 @@ index 71d5c298e14869d9d44226aeb6ffe3f051827d1a..a75de538835522f92e889452fddd5a3d
this.pendingUnloads = new Long2ObjectLinkedOpenHashMap(); this.pendingUnloads = new Long2ObjectLinkedOpenHashMap();
this.entitiesInLevel = new LongOpenHashSet(); this.entitiesInLevel = new LongOpenHashSet();
this.toDrop = new LongOpenHashSet(); this.toDrop = new LongOpenHashSet();
@@ -372,9 +399,52 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -371,9 +398,52 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return (ChunkHolder) this.updatingChunkMap.get(pos); return (ChunkHolder) this.updatingChunkMap.get(pos);
} }
@ -175,7 +175,7 @@ index 71d5c298e14869d9d44226aeb6ffe3f051827d1a..a75de538835522f92e889452fddd5a3d
} }
protected IntSupplier getChunkQueueLevel(long pos) { protected IntSupplier getChunkQueueLevel(long pos) {
@@ -531,8 +601,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -530,8 +600,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
protected void saveAllChunks(boolean flush) { protected void saveAllChunks(boolean flush) {
@ -186,7 +186,7 @@ index 71d5c298e14869d9d44226aeb6ffe3f051827d1a..a75de538835522f92e889452fddd5a3d
MutableBoolean mutableboolean = new MutableBoolean(); MutableBoolean mutableboolean = new MutableBoolean();
do { do {
@@ -563,7 +634,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -562,7 +633,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// this.i(); // Paper - nuke IOWorker // this.i(); // Paper - nuke IOWorker
ChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.storageFolder.getName()); ChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.storageFolder.getName());
} else { } else {
@ -195,7 +195,7 @@ index 71d5c298e14869d9d44226aeb6ffe3f051827d1a..a75de538835522f92e889452fddd5a3d
ChunkAccess ichunkaccess = (ChunkAccess) playerchunk.getChunkToSave().getNow(null); // CraftBukkit - decompile error ChunkAccess ichunkaccess = (ChunkAccess) playerchunk.getChunkToSave().getNow(null); // CraftBukkit - decompile error
if (ichunkaccess instanceof ImposterProtoChunk || ichunkaccess instanceof LevelChunk) { if (ichunkaccess instanceof ImposterProtoChunk || ichunkaccess instanceof LevelChunk) {
@@ -723,7 +794,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -722,7 +793,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!this.modified) { if (!this.modified) {
return false; return false;
} else { } else {
@ -217,7 +217,7 @@ index 71d5c298e14869d9d44226aeb6ffe3f051827d1a..a75de538835522f92e889452fddd5a3d
this.modified = false; this.modified = false;
return true; return true;
} }
@@ -1132,12 +1216,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1131,12 +1215,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
protected Iterable<ChunkHolder> getChunks() { protected Iterable<ChunkHolder> getChunks() {

Datei anzeigen

@ -226,7 +226,7 @@ index 34183527a23650706a9249ffac0182cb77b18086..90decfade57b2f17cdcc9188962c2d21
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
public boolean pollTask() { public boolean pollTask() {
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 da85bfe5de9dcd6d51605ce9b023265b5a5f2936..f10fad84e4f36f9158383b327170593f273cecd9 100644 index 9cdfd1c8bce3adb5d3ad6d970c6f46ca75f3a952..70106dda486d685dffafc0d4b3ae95b4861c6342 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
@@ -581,6 +581,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -581,6 +581,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl

Datei anzeigen

@ -262,10 +262,10 @@ index 0511f1921193b78cbf4d8426136bf1f79746f955..e5f7f043cbdb28d85b8aa0eea7cbaeb5
@Override @Override
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 a75de538835522f92e889452fddd5a3d8fc25f07..ccf50500b53f7336db1d3d287ec6f2a0da3d4183 100644 index a80c4517cd0d2c5e7b71b4f86b6a8d441a9eb64e..3994cefe74481efd5d779f22c752aadc22b4749b 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
@@ -607,6 +607,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -606,6 +606,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
MutableBoolean mutableboolean = new MutableBoolean(); MutableBoolean mutableboolean = new MutableBoolean();
do { do {
@ -299,10 +299,10 @@ index 0ef3c4982df88a7991a56d983ac733daa8adc507..cdd797c6fc7507a0e6376f7d9c521be8
} }
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 9d5dcaabe43ee36259b24063b4c74daddc7df773..06f2f76636804cd5f997bbe1558a104bc24aa84a 100644 index 944b28b55a38352dfb49aeecca3f196502cb04e8..54fcdcef2a6b68e4b4f4c6a090e84919fe76b073 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
@@ -837,6 +837,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -842,6 +842,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
try { try {
tickConsumer.accept(entity); tickConsumer.accept(entity);
} catch (Throwable throwable) { } catch (Throwable throwable) {
@ -311,7 +311,7 @@ index 9d5dcaabe43ee36259b24063b4c74daddc7df773..06f2f76636804cd5f997bbe1558a104b
String msg = "Entity threw exception at " + entity.level.getWorld().getName() + ":" + entity.getX() + "," + entity.getY() + "," + entity.getZ(); String msg = "Entity threw exception at " + entity.level.getWorld().getName() + ":" + entity.getX() + "," + entity.getY() + "," + entity.getZ();
System.err.println(msg); System.err.println(msg);
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 59a77541bbda880ae8f84e3535a2b6112caa78fb..a63dc77db41dab79f03ef7384da55c1cdeca5d98 100644 index a4398502dd0cbbceb00cffc68702d34bf8ed7e8f..bde00ca058f32eb55e940614f0fbc361fe3a501d 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
@@ -1320,6 +1320,7 @@ public class LevelChunk implements ChunkAccess { @@ -1320,6 +1320,7 @@ public class LevelChunk implements ChunkAccess {

Datei anzeigen

@ -25,10 +25,10 @@ This successfully fixed a reoccurring and highly reproduceable crash
for heightmaps. for heightmaps.
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 ccf50500b53f7336db1d3d287ec6f2a0da3d4183..f651b7d2bbc2fc883bc73ef892de62624d1285e7 100644 index 3994cefe74481efd5d779f22c752aadc22b4749b..dede8863193423858f6d60cc942919e52f28b607 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
@@ -191,6 +191,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -190,6 +190,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}; };
// CraftBukkit end // CraftBukkit end
@ -36,7 +36,7 @@ index ccf50500b53f7336db1d3d287ec6f2a0da3d4183..f651b7d2bbc2fc883bc73ef892de6262
// Paper start - distance maps // Paper start - distance maps
private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
// Paper start - no-tick view distance // Paper start - no-tick view distance
@@ -1050,7 +1051,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1049,7 +1050,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return Either.left(chunk); return Either.left(chunk);
}); });
}, (runnable) -> { }, (runnable) -> {

Datei anzeigen

@ -28,10 +28,10 @@ receives a deterministic result, and should no longer require 1 tick
delays anymore. delays anymore.
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 f651b7d2bbc2fc883bc73ef892de62624d1285e7..6c763b5407425b764839b921f4dc9e18d76442cd 100644 index dede8863193423858f6d60cc942919e52f28b607..4fe5b75661de64474698495776ebb8232fd252aa 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
@@ -1551,7 +1551,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1550,7 +1550,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end - per player view distance // Paper end - per player view distance
} }
@ -40,7 +40,7 @@ index f651b7d2bbc2fc883bc73ef892de62624d1285e7..6c763b5407425b764839b921f4dc9e18
org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot
// Paper start - ignore and warn about illegal addEntity calls instead of crashing server // Paper start - ignore and warn about illegal addEntity calls instead of crashing server
if (!entity.valid || entity.level != this.level || this.entityMap.containsKey(entity.getId())) { if (!entity.valid || entity.level != this.level || this.entityMap.containsKey(entity.getId())) {
@@ -1560,6 +1560,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1559,6 +1559,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
.printStackTrace(); .printStackTrace();
return; return;
} }

Datei anzeigen

@ -14,10 +14,10 @@ Use an ArrayDeque to store this Queue
We make sure to also implement a pattern that is recursion safe too. We make sure to also implement a pattern that is recursion safe too.
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 6c763b5407425b764839b921f4dc9e18d76442cd..f9fcf99ec7151b4f00ef2c40b0cbc2fd3a8e002c 100644 index 4fe5b75661de64474698495776ebb8232fd252aa..3e45ddc39d1283661cbfc1057aa0548d940a444a 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
@@ -174,17 +174,29 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -173,17 +173,29 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public final CallbackExecutor callbackExecutor = new CallbackExecutor();
public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable { public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add phantom creative and insomniac controls
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 4a2b52b5f5c0453c204765ec77e35524ee7e77c1..16cf7d116e3ffd44ffc4f060b4014b52389cff77 100644 index 8f1dcdb3b1beddb5698f596c048869d99e1f4437..98416de3dfc9d16d17124902e19cbd9b916077d2 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -477,6 +477,13 @@ public class PaperWorldConfig { @@ -474,6 +474,13 @@ public class PaperWorldConfig {
lightQueueSize = getInt("light-queue-size", lightQueueSize); lightQueueSize = getInt("light-queue-size", lightQueueSize);
} }

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 4c0b94a56fab161fca92b594f55e1c846524d5e8..479b4eb8efeeca432bcb21925db18d5c0750f001 100644 index e31a05dfe7e934692ac89c7cedcab736bcd9ca4f..130ab05393a7136020e06ec199256a031ba66091 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
@@ -517,6 +517,13 @@ public final class CraftServer implements Server { @@ -517,6 +517,13 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -18,7 +18,7 @@ index 11fd6d24ed0612e4df1a0493907178fb9c455d1c..d7023cb0974f6c28a0fb8a0a6e5a6600
return initialDistance; return initialDistance;
} }
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 f9fcf99ec7151b4f00ef2c40b0cbc2fd3a8e002c..f7032e1d64afa6707756bb5a2af9d43a808c9736 100644 index 3e45ddc39d1283661cbfc1057aa0548d940a444a..f4a31d340ea9629dea70eec4e339cfd869a73ed9 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
@@ -58,6 +58,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; @@ -58,6 +58,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket;
@ -29,7 +29,7 @@ index f9fcf99ec7151b4f00ef2c40b0cbc2fd3a8e002c..f7032e1d64afa6707756bb5a2af9d43a
import net.minecraft.server.level.progress.ChunkProgressListener; import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.server.network.ServerPlayerConnection; import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.util.CsvOutput; import net.minecraft.util.CsvOutput;
@@ -222,11 +223,33 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -221,11 +222,33 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerViewDistanceTickMap; public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerViewDistanceTickMap;
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerViewDistanceNoTickMap; public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerViewDistanceNoTickMap;
// Paper end - no-tick view distance // Paper end - no-tick view distance
@ -63,7 +63,7 @@ index f9fcf99ec7151b4f00ef2c40b0cbc2fd3a8e002c..f7032e1d64afa6707756bb5a2af9d43a
// Paper start - no-tick view distance // Paper start - no-tick view distance
int effectiveTickViewDistance = this.getEffectiveViewDistance(); int effectiveTickViewDistance = this.getEffectiveViewDistance();
int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance); int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance);
@@ -243,7 +266,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -242,7 +265,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
void removePlayerFromDistanceMaps(ServerPlayer player) { void removePlayerFromDistanceMaps(ServerPlayer player) {
@ -76,7 +76,7 @@ index f9fcf99ec7151b4f00ef2c40b0cbc2fd3a8e002c..f7032e1d64afa6707756bb5a2af9d43a
// Paper start - no-tick view distance // Paper start - no-tick view distance
this.playerViewDistanceBroadcastMap.remove(player); this.playerViewDistanceBroadcastMap.remove(player);
this.playerViewDistanceTickMap.remove(player); this.playerViewDistanceTickMap.remove(player);
@@ -255,6 +282,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -254,6 +281,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
int chunkX = MCUtil.getChunkCoordinate(player.getX()); int chunkX = MCUtil.getChunkCoordinate(player.getX());
int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
// Note: players need to be explicitly added to distance maps before they can be updated // Note: players need to be explicitly added to distance maps before they can be updated
@ -91,7 +91,7 @@ index f9fcf99ec7151b4f00ef2c40b0cbc2fd3a8e002c..f7032e1d64afa6707756bb5a2af9d43a
// Paper start - no-tick view distance // Paper start - no-tick view distance
int effectiveTickViewDistance = this.getEffectiveViewDistance(); int effectiveTickViewDistance = this.getEffectiveViewDistance();
int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance); int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance);
@@ -306,6 +341,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -305,6 +340,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, dsync, world); this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, dsync, world);
this.setViewDistance(viewDistance); this.setViewDistance(viewDistance);
this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper
@ -137,7 +137,7 @@ index f9fcf99ec7151b4f00ef2c40b0cbc2fd3a8e002c..f7032e1d64afa6707756bb5a2af9d43a
// Paper start - no-tick view distance // Paper start - no-tick view distance
this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance); this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance);
this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets,
@@ -1424,17 +1498,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1423,17 +1497,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
public void move(ServerPlayer player) { public void move(ServerPlayer player) {
@ -156,7 +156,7 @@ index f9fcf99ec7151b4f00ef2c40b0cbc2fd3a8e002c..f7032e1d64afa6707756bb5a2af9d43a
int i = SectionPos.blockToSectionCoord(player.getBlockX()); int i = SectionPos.blockToSectionCoord(player.getBlockX());
int j = SectionPos.blockToSectionCoord(player.getBlockZ()); int j = SectionPos.blockToSectionCoord(player.getBlockZ());
@@ -1589,7 +1653,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1588,7 +1652,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
this.entityMap.put(entity.getId(), playerchunkmap_entitytracker); this.entityMap.put(entity.getId(), playerchunkmap_entitytracker);
@ -165,7 +165,7 @@ index f9fcf99ec7151b4f00ef2c40b0cbc2fd3a8e002c..f7032e1d64afa6707756bb5a2af9d43a
if (entity instanceof ServerPlayer) { if (entity instanceof ServerPlayer) {
ServerPlayer entityplayer = (ServerPlayer) entity; ServerPlayer entityplayer = (ServerPlayer) entity;
@@ -1633,7 +1697,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1632,7 +1696,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
entity.tracker = null; // Paper - We're no longer tracked entity.tracker = null; // Paper - We're no longer tracked
} }
@ -203,7 +203,7 @@ index f9fcf99ec7151b4f00ef2c40b0cbc2fd3a8e002c..f7032e1d64afa6707756bb5a2af9d43a
List<ServerPlayer> list = Lists.newArrayList(); List<ServerPlayer> list = Lists.newArrayList();
List<ServerPlayer> list1 = this.level.players(); List<ServerPlayer> list1 = this.level.players();
@@ -1742,23 +1836,31 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially @@ -1741,23 +1835,31 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
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();
@ -247,7 +247,7 @@ index f9fcf99ec7151b4f00ef2c40b0cbc2fd3a8e002c..f7032e1d64afa6707756bb5a2af9d43a
Iterator iterator; Iterator iterator;
Entity entity1; Entity entity1;
@@ -1837,6 +1939,42 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially @@ -1836,6 +1938,42 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
this.lastSectionPos = SectionPos.of(entity); this.lastSectionPos = SectionPos.of(entity);
} }
@ -290,7 +290,7 @@ index f9fcf99ec7151b4f00ef2c40b0cbc2fd3a8e002c..f7032e1d64afa6707756bb5a2af9d43a
public boolean equals(Object object) { public boolean equals(Object object) {
return object instanceof ChunkMap.TrackedEntity ? ((ChunkMap.TrackedEntity) object).entity.getId() == this.entity.getId() : false; return object instanceof ChunkMap.TrackedEntity ? ((ChunkMap.TrackedEntity) object).entity.getId() == this.entity.getId() : false;
} }
@@ -1922,7 +2060,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially @@ -1921,7 +2059,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
int j = entity.getType().clientTrackingRange() * 16; int j = entity.getType().clientTrackingRange() * 16;
j = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, j); // Paper j = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, j); // Paper

Datei anzeigen

@ -37,10 +37,10 @@ index 58369d70bcd8b2c25609b6f101d9cbe2031df352..969b0c9cf6d7eb2055d3b804f25a3cbc
// CraftBukkit start // CraftBukkit start
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 f7032e1d64afa6707756bb5a2af9d43a808c9736..18335e2c5c9e50a8ed31a3d2b585835bcc28bbe6 100644 index f4a31d340ea9629dea70eec4e339cfd869a73ed9..450ab55859304ecda6f752b0e4a04279f4104af1 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
@@ -237,6 +237,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -236,6 +236,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return MinecraftServer.getServer().applyTrackingRangeScale(vanilla); return MinecraftServer.getServer().applyTrackingRangeScale(vanilla);
} }
// Paper end - use distance map to optimise tracker // Paper end - use distance map to optimise tracker
@ -58,7 +58,7 @@ index f7032e1d64afa6707756bb5a2af9d43a808c9736..18335e2c5c9e50a8ed31a3d2b585835b
void addPlayerToDistanceMaps(ServerPlayer player) { void addPlayerToDistanceMaps(ServerPlayer player) {
int chunkX = MCUtil.getChunkCoordinate(player.getX()); int chunkX = MCUtil.getChunkCoordinate(player.getX());
@@ -250,6 +261,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -249,6 +260,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
trackMap.add(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance())); trackMap.add(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance()));
} }
// Paper end - use distance map to optimise entity tracker // Paper end - use distance map to optimise entity tracker
@ -71,7 +71,7 @@ index f7032e1d64afa6707756bb5a2af9d43a808c9736..18335e2c5c9e50a8ed31a3d2b585835b
// Paper start - no-tick view distance // Paper start - no-tick view distance
int effectiveTickViewDistance = this.getEffectiveViewDistance(); int effectiveTickViewDistance = this.getEffectiveViewDistance();
int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance); int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance);
@@ -271,6 +288,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -270,6 +287,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.playerEntityTrackerTrackMaps[i].remove(player); this.playerEntityTrackerTrackMaps[i].remove(player);
} }
// Paper end - use distance map to optimise tracker // Paper end - use distance map to optimise tracker
@ -82,7 +82,7 @@ index f7032e1d64afa6707756bb5a2af9d43a808c9736..18335e2c5c9e50a8ed31a3d2b585835b
// Paper start - no-tick view distance // Paper start - no-tick view distance
this.playerViewDistanceBroadcastMap.remove(player); this.playerViewDistanceBroadcastMap.remove(player);
this.playerViewDistanceTickMap.remove(player); this.playerViewDistanceTickMap.remove(player);
@@ -290,6 +311,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -289,6 +310,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
trackMap.update(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance())); trackMap.update(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance()));
} }
// Paper end - use distance map to optimise entity tracker // Paper end - use distance map to optimise entity tracker
@ -92,7 +92,7 @@ index f7032e1d64afa6707756bb5a2af9d43a808c9736..18335e2c5c9e50a8ed31a3d2b585835b
// Paper start - no-tick view distance // Paper start - no-tick view distance
int effectiveTickViewDistance = this.getEffectiveViewDistance(); int effectiveTickViewDistance = this.getEffectiveViewDistance();
int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance); int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance);
@@ -336,7 +360,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -335,7 +359,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.mainThreadMailbox = this.queueSorter.getProcessor(mailbox, false); this.mainThreadMailbox = this.queueSorter.getProcessor(mailbox, false);
this.mailboxLight = this.queueSorter.getProcessor(lightthreaded, false);// Paper this.mailboxLight = this.queueSorter.getProcessor(lightthreaded, false);// Paper
this.lightEngine = new ThreadedLevelLightEngine(chunkProvider, this, this.level.dimensionType().hasSkyLight(), threadedmailbox1, this.queueSorter.getProcessor(threadedmailbox1, false)); this.lightEngine = new ThreadedLevelLightEngine(chunkProvider, this, this.level.dimensionType().hasSkyLight(), threadedmailbox1, this.queueSorter.getProcessor(threadedmailbox1, false));
@ -101,7 +101,7 @@ index f7032e1d64afa6707756bb5a2af9d43a808c9736..18335e2c5c9e50a8ed31a3d2b585835b
this.overworldDataStorage = persistentStateManagerFactory; this.overworldDataStorage = persistentStateManagerFactory;
this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, dsync, world); this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, dsync, world);
this.setViewDistance(viewDistance); this.setViewDistance(viewDistance);
@@ -380,6 +404,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -379,6 +403,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.playerEntityTrackerTrackMaps[ordinal] = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets); this.playerEntityTrackerTrackMaps[ordinal] = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets);
} }
// Paper end - use distance map to optimise entity tracker // Paper end - use distance map to optimise entity tracker
@ -140,7 +140,7 @@ index f7032e1d64afa6707756bb5a2af9d43a808c9736..18335e2c5c9e50a8ed31a3d2b585835b
// Paper start - no-tick view distance // Paper start - no-tick view distance
this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance); this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance);
this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets,
@@ -649,6 +705,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -648,6 +704,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} else { } else {
if (holder != null) { if (holder != null) {
holder.setTicketLevel(level); holder.setTicketLevel(level);
@ -148,7 +148,7 @@ index f7032e1d64afa6707756bb5a2af9d43a808c9736..18335e2c5c9e50a8ed31a3d2b585835b
} }
if (holder != null) { if (holder != null) {
@@ -1434,29 +1491,50 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1433,29 +1490,50 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return this.isOutsideOfRange(chunkPos, false); return this.isOutsideOfRange(chunkPos, false);
} }

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Option for maximum exp value when merging orbs
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 16cf7d116e3ffd44ffc4f060b4014b52389cff77..3bc6329d3ea48966cb99e792f9b35e2d2d71a34b 100644 index 98416de3dfc9d16d17124902e19cbd9b916077d2..b10de4e99913030bae7451b3242067312e94df7e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -359,6 +359,12 @@ public class PaperWorldConfig { @@ -356,6 +356,12 @@ public class PaperWorldConfig {
log("Creeper lingering effect: " + disableCreeperLingeringEffect); log("Creeper lingering effect: " + disableCreeperLingeringEffect);
} }

Datei anzeigen

@ -56,10 +56,10 @@ index cdf214fca3b0055efa56702470d9d2f890a8aead..a12af10e28f2d023ba6f916b5e7a5353
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 06f2f76636804cd5f997bbe1558a104bc24aa84a..b92d930448757968cd6a178f4bcafae72c93044c 100644 index 54fcdcef2a6b68e4b4f4c6a090e84919fe76b073..f004f5012ce157f9b0fb9c5890b5f3de957418f8 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
@@ -420,6 +420,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -424,6 +424,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

@ -5,10 +5,10 @@ Subject: [PATCH] Reduce allocation of Vec3D by entity tracker
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 18335e2c5c9e50a8ed31a3d2b585835bcc28bbe6..d8f99f7f5ca0e1dbbb9b760af3a4b4f9c52ef6c7 100644 index 450ab55859304ecda6f752b0e4a04279f4104af1..f722d9e77fa074847a2bdc6a117816d176eb6dca 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
@@ -2102,9 +2102,14 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially @@ -2101,9 +2101,14 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
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

@ -16,7 +16,7 @@ We further improve it by making a copy of the nbt tag with only the memory
it needs, so that we dont have to hold a copy to the entire compound. it needs, so that we dont have to hold a copy to the entire compound.
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 7c04aef3eac54981ca1e34cb87d97104c3c9685b..b4246524dd11ad1e1dc94c56eee966c5a54d9ecc 100644 index 097d38f12ef324dbb529a833383e2da949377f9c..1f95ac18990822a64f0bb2af947693c4b88cdf73 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
@@ -27,6 +27,7 @@ import net.minecraft.nbt.CompoundTag; @@ -27,6 +27,7 @@ import net.minecraft.nbt.CompoundTag;

Datei anzeigen

@ -17,10 +17,10 @@ This allows servers with smaller worlds who do less long distance exploring to s
wasting cpu cycles on saving/unloading/reloading chunks repeatedly. wasting cpu cycles on saving/unloading/reloading chunks repeatedly.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 3bc6329d3ea48966cb99e792f9b35e2d2d71a34b..1f4d0d3493e748f52eb3b679c0a8a1306c0cc8b4 100644 index b10de4e99913030bae7451b3242067312e94df7e..d2b1ef727004906d184995a840657e22ea127f71 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -495,6 +495,15 @@ public class PaperWorldConfig { @@ -492,6 +492,15 @@ public class PaperWorldConfig {
this.noTickViewDistance = this.getInt("viewdistances.no-tick-view-distance", -1); this.noTickViewDistance = this.getInt("viewdistances.no-tick-view-distance", -1);
} }
@ -34,7 +34,7 @@ index 3bc6329d3ea48966cb99e792f9b35e2d2d71a34b..1f4d0d3493e748f52eb3b679c0a8a130
+ } + }
+ +
public boolean altItemDespawnRateEnabled; public boolean altItemDespawnRateEnabled;
public Map<Material, Integer> altItemDespawnRateMap; public java.util.Map<org.bukkit.Material, Integer> altItemDespawnRateMap;
private void altItemDespawnRate() { private void altItemDespawnRate() {
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
index 577b391dcba1db712c1e2c83296e1c87b3e34ab2..d94241bcca4f2fd5e464a860bd356af504dc68b7 100644 index 577b391dcba1db712c1e2c83296e1c87b3e34ab2..d94241bcca4f2fd5e464a860bd356af504dc68b7 100644

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] incremental chunk saving
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 1f4d0d3493e748f52eb3b679c0a8a1306c0cc8b4..91917b11163c0740d5e5effc5e93d494e2b2d73e 100644 index d2b1ef727004906d184995a840657e22ea127f71..040956f5d714ac014f9a153981d444db299fd826 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -47,6 +47,21 @@ public class PaperWorldConfig { @@ -44,6 +44,21 @@ public class PaperWorldConfig {
log( "Keep Spawn Loaded Range: " + (keepLoadedRange/16)); log( "Keep Spawn Loaded Range: " + (keepLoadedRange/16));
} }
@ -139,10 +139,10 @@ index 969b0c9cf6d7eb2055d3b804f25a3cbc161ceaea..1f67c9c5f7161ea687983e7ae0ec7d25
for (int i = 0; i < this.futures.length(); ++i) { for (int i = 0; i < this.futures.length(); ++i) {
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = (CompletableFuture) this.futures.get(i); CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = (CompletableFuture) this.futures.get(i);
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 d8f99f7f5ca0e1dbbb9b760af3a4b4f9c52ef6c7..5a5e9188f55405c8a2646891c348d544d33eb940 100644 index f722d9e77fa074847a2bdc6a117816d176eb6dca..8982823efd8fd21d403c6c6fb158d57a9da67707 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
@@ -93,6 +93,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana @@ -92,6 +92,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana
import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.DimensionDataStorage;
import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.level.storage.LevelStorageSource;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
@ -150,7 +150,7 @@ index d8f99f7f5ca0e1dbbb9b760af3a4b4f9c52ef6c7..5a5e9188f55405c8a2646891c348d544
import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.commons.lang3.mutable.MutableBoolean;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@@ -744,6 +745,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -743,6 +744,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
@ -215,7 +215,7 @@ index d8f99f7f5ca0e1dbbb9b760af3a4b4f9c52ef6c7..5a5e9188f55405c8a2646891c348d544
protected void saveAllChunks(boolean flush) { protected void saveAllChunks(boolean flush) {
Long2ObjectLinkedOpenHashMap<ChunkHolder> visibleChunks = this.getVisibleChunks(); // Paper remove clone of visible Chunks unless saving off main thread (watchdog kill) Long2ObjectLinkedOpenHashMap<ChunkHolder> visibleChunks = this.getVisibleChunks(); // Paper remove clone of visible Chunks unless saving off main thread (watchdog kill)
if (flush) { if (flush) {
@@ -883,6 +942,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -882,6 +941,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
asyncSaveData, chunk); asyncSaveData, chunk);
chunk.setUnsaved(false); chunk.setUnsaved(false);
@ -223,7 +223,7 @@ index d8f99f7f5ca0e1dbbb9b760af3a4b4f9c52ef6c7..5a5e9188f55405c8a2646891c348d544
} }
// Paper end // Paper end
@@ -905,6 +965,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -904,6 +964,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.level.unload(chunk); this.level.unload(chunk);
} }
@ -231,7 +231,7 @@ index d8f99f7f5ca0e1dbbb9b760af3a4b4f9c52ef6c7..5a5e9188f55405c8a2646891c348d544
// Paper start - async chunk saving // Paper start - async chunk saving
try { try {
@@ -1231,6 +1292,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1230,6 +1291,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!chunk.isUnsaved()) { if (!chunk.isUnsaved()) {
return false; return false;
} else { } else {
@ -260,7 +260,7 @@ index 3faa808f41f057a9956c697ec1323330f5920b86..7ab28e9bd3f785838b7fa4ac5811c0e7
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 f10fad84e4f36f9158383b327170593f273cecd9..bdabcdb60dbfb803ead13c42c8dd5e100b37dc00 100644 index 70106dda486d685dffafc0d4b3ae95b4861c6342..74753639ed095eab305c2facd0f00264a6253cef 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
@@ -1017,6 +1017,38 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -1017,6 +1017,38 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
@ -303,7 +303,7 @@ index f10fad84e4f36f9158383b327170593f273cecd9..bdabcdb60dbfb803ead13c42c8dd5e10
ServerChunkCache chunkproviderserver = this.getChunkSource(); ServerChunkCache chunkproviderserver = this.getChunkSource();
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 c0075d226331f32e470dae5bf1ce8d79e8b263dc..8ba782511b0a6c7859cbcf910ad742cbb9f599e5 100644 index 91f5106cfe7914389b52a1ed001117b13e4f9768..31ea618547e0e452f9a495796a4197e718abbfa6 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
@@ -29,6 +29,7 @@ public interface ChunkAccess extends BlockGetter, FeatureAccess { @@ -29,6 +29,7 @@ public interface ChunkAccess extends BlockGetter, FeatureAccess {
@ -315,7 +315,7 @@ index c0075d226331f32e470dae5bf1ce8d79e8b263dc..8ba782511b0a6c7859cbcf910ad742cb
default boolean generateFlatBedrock() { default boolean generateFlatBedrock() {
if (this instanceof ProtoChunk) { if (this instanceof ProtoChunk) {
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 a63dc77db41dab79f03ef7384da55c1cdeca5d98..efb9c6fef915b43c9dd4468ead52aa36ea9e7ef3 100644 index bde00ca058f32eb55e940614f0fbc361fe3a501d..fe46fdb828d630f9dc9b212128608203f6c6f4bb 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
@@ -108,6 +108,13 @@ public class LevelChunk implements ChunkAccess { @@ -108,6 +108,13 @@ public class LevelChunk implements ChunkAccess {

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 94670ec4de01341822f6affe0fa1c9774dd6131b..6bc5ba51c90723c7138b1b5d2381cb215f1e5271 100644 index e3338717bffe5f5e4a00fe1ebe3ba7cf74555b36..f7d542b828904fb51a30dfb7a50e01e4e2df0f3e 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
@@ -346,7 +346,7 @@ public final class CraftServer implements Server { @@ -346,7 +346,7 @@ public final class CraftServer implements Server {

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 f4a056185990181e486f452960159a5287947382..6c55bd8b876d1d694e05ad6de6a9fd29a4d4d053 100644 index a695e5a0c2e8846333ccb9aea499b5656af35163..c21c5134308a2a83fb50bfe37f05d19c8e96ca7c 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
@@ -389,7 +389,7 @@ public class ServerPlayerGameMode { @@ -391,7 +391,7 @@ public class ServerPlayerGameMode {
BlockEntity tileentity = this.level.getBlockEntity(pos); BlockEntity tileentity = this.level.getBlockEntity(pos);
Block block = iblockdata.getBlock(); Block block = iblockdata.getBlock();

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