3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 11:00:06 +01:00

Remove unused chunk system hooks in MCUtils

Dieser Commit ist enthalten in:
Spottedleaf 2024-07-17 11:08:28 -07:00
Ursprung 00b949f1bb
Commit 4efd24b336
15 geänderte Dateien mit 84 neuen und 223 gelöschten Zeilen

Datei anzeigen

@ -4837,7 +4837,7 @@ index 40adb6117b9e0d5f70103113202a07715e403e2a..cef1761cdaf3e456695f2de61f4295fb
long j = Util.getNanos() - i;
int k = this.tickCount % 100;
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index f40a2f348c45a29168ca3d4eef07b5b628060bee..d0866b2c2f729b6c251eaade3758e94de4d05d6d 100644
index f40a2f348c45a29168ca3d4eef07b5b628060bee..2f253f33b866ff74e959c41d9501264cf226f45e 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -37,9 +37,9 @@ public class ChunkHolder extends GenerationChunkHolder {
@ -4853,65 +4853,7 @@ index f40a2f348c45a29168ca3d4eef07b5b628060bee..d0866b2c2f729b6c251eaade3758e94d
public int oldTicketLevel;
private int ticketLevel;
private int queueLevel;
@@ -55,6 +55,18 @@ public class ChunkHolder extends GenerationChunkHolder {
private CompletableFuture<?> sendSync;
private CompletableFuture<?> saveSync;
+ private final ChunkMap chunkMap; // Paper
+
+ // Paper start
+ public void onChunkAdd() {
+
+ }
+
+ public void onChunkRemove() {
+
+ }
+ // Paper end
+
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
super(pos);
this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
@@ -74,8 +86,22 @@ public class ChunkHolder extends GenerationChunkHolder {
this.queueLevel = this.oldTicketLevel;
this.setTicketLevel(level);
this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()];
+ this.chunkMap = (ChunkMap)playersWatchingChunkProvider; // Paper
}
+ // Paper start
+ public @Nullable ChunkAccess getAvailableChunkNow() {
+ // TODO can we just getStatusFuture(EMPTY)?
+ for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) {
+ ChunkAccess chunkAccess = this.getChunkIfPresentUnchecked(curr);
+ if (chunkAccess == null) {
+ continue;
+ }
+ return chunkAccess;
+ }
+ return null;
+ }
+ // Paper end
// CraftBukkit start
public LevelChunk getFullChunkNow() {
// Note: We use the oldTicketLevel for isLoaded checks.
@@ -88,20 +114,20 @@ public class ChunkHolder extends GenerationChunkHolder {
}
// CraftBukkit end
- public CompletableFuture<ChunkResult<LevelChunk>> getTickingChunkFuture() {
+ public final CompletableFuture<ChunkResult<LevelChunk>> getTickingChunkFuture() { // Paper - final for inline
return this.tickingChunkFuture;
}
- public CompletableFuture<ChunkResult<LevelChunk>> getEntityTickingChunkFuture() {
+ public final CompletableFuture<ChunkResult<LevelChunk>> getEntityTickingChunkFuture() { // Paper - final for inline
return this.entityTickingChunkFuture;
}
- public CompletableFuture<ChunkResult<LevelChunk>> getFullChunkFuture() {
+ public final CompletableFuture<ChunkResult<LevelChunk>> getFullChunkFuture() { // Paper - final for inline
return this.fullChunkFuture;
@@ -101,7 +101,7 @@ public class ChunkHolder extends GenerationChunkHolder {
}
@Nullable
@ -4920,37 +4862,7 @@ index f40a2f348c45a29168ca3d4eef07b5b628060bee..d0866b2c2f729b6c251eaade3758e94d
return (LevelChunk) ((ChunkResult) this.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).orElse(null); // CraftBukkit - decompile error
}
@@ -125,6 +151,20 @@ public class ChunkHolder extends GenerationChunkHolder {
}
+ // Paper start
+ public @Nullable ChunkStatus getChunkHolderStatus() {
+ for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) {
+ ChunkAccess chunkAccess = this.getChunkIfPresentUnchecked(curr);
+ if (chunkAccess == null) {
+ continue;
+ }
+ return curr;
+ }
+
+ return null;
+ }
+ // Paper end
+
public CompletableFuture<?> getSaveSyncFuture() {
return this.saveSync;
}
@@ -268,7 +308,7 @@ public class ChunkHolder extends GenerationChunkHolder {
}
@Override
- public int getTicketLevel() {
+ public final int getTicketLevel() { // Paper - final for inline
return this.ticketLevel;
}
@@ -337,12 +377,28 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -337,12 +337,28 @@ public class ChunkHolder extends GenerationChunkHolder {
this.wasAccessibleSinceLastSave |= flag1;
if (!flag && flag1) {
@ -4979,7 +4891,7 @@ index f40a2f348c45a29168ca3d4eef07b5b628060bee..d0866b2c2f729b6c251eaade3758e94d
this.fullChunkFuture.complete(ChunkHolder.UNLOADED_LEVEL_CHUNK);
this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
}
@@ -353,11 +409,25 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -353,11 +369,25 @@ public class ChunkHolder extends GenerationChunkHolder {
if (!flag2 && flag3) {
this.tickingChunkFuture = chunkLoadingManager.prepareTickingChunk(this);
this.scheduleFullChunkPromotion(chunkLoadingManager, this.tickingChunkFuture, executor, FullChunkStatus.BLOCK_TICKING);
@ -5006,7 +4918,7 @@ index f40a2f348c45a29168ca3d4eef07b5b628060bee..d0866b2c2f729b6c251eaade3758e94d
this.tickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
}
@@ -371,11 +441,24 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -371,11 +401,24 @@ public class ChunkHolder extends GenerationChunkHolder {
this.entityTickingChunkFuture = chunkLoadingManager.prepareEntityTickingChunk(this);
this.scheduleFullChunkPromotion(chunkLoadingManager, this.entityTickingChunkFuture, executor, FullChunkStatus.ENTITY_TICKING);
@ -5032,7 +4944,7 @@ index f40a2f348c45a29168ca3d4eef07b5b628060bee..d0866b2c2f729b6c251eaade3758e94d
this.entityTickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
}
@@ -425,4 +508,18 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -425,4 +468,18 @@ public class ChunkHolder extends GenerationChunkHolder {
List<ServerPlayer> getPlayers(ChunkPos chunkPos, boolean onlyOnWatchDistanceEdge);
}
@ -5052,7 +4964,7 @@ index f40a2f348c45a29168ca3d4eef07b5b628060bee..d0866b2c2f729b6c251eaade3758e94d
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 5b920beb39dad8d392b4e5e12a89880720e41942..6751e403595170b22abf100a27f97251edcb2125 100644
index 5b920beb39dad8d392b4e5e12a89880720e41942..16cfa946f2e121594875a57e4ff982052cf5ffd1 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -170,6 +170,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -5093,7 +5005,7 @@ index 5b920beb39dad8d392b4e5e12a89880720e41942..6751e403595170b22abf100a27f97251
CrashReport crashreport = CrashReport.forThrowable(exception, "Chunk loading");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Chunk loading");
@@ -422,8 +434,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -422,6 +434,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
holder.setTicketLevel(level);
} else {
holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this);
@ -5102,13 +5014,8 @@ index 5b920beb39dad8d392b4e5e12a89880720e41942..6751e403595170b22abf100a27f97251
+ // Paper end
}
+ // Paper start
+ holder.onChunkAdd();
+ // Paper end
this.updatingChunkMap.put(pos, holder);
this.modified = true;
}
@@ -445,7 +463,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -445,7 +460,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
protected void saveAllChunks(boolean flush) {
if (flush) {
@ -5117,7 +5024,7 @@ index 5b920beb39dad8d392b4e5e12a89880720e41942..6751e403595170b22abf100a27f97251
MutableBoolean mutableboolean = new MutableBoolean();
do {
@@ -468,7 +486,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -468,7 +483,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
this.flushWorker();
} else {
@ -5126,7 +5033,7 @@ index 5b920beb39dad8d392b4e5e12a89880720e41942..6751e403595170b22abf100a27f97251
}
}
@@ -487,7 +505,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -487,7 +502,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public boolean hasWork() {
@ -5135,15 +5042,7 @@ index 5b920beb39dad8d392b4e5e12a89880720e41942..6751e403595170b22abf100a27f97251
}
private void processUnloads(BooleanSupplier shouldKeepTicking) {
@@ -504,6 +522,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
this.updatingChunkMap.remove(j);
+ playerchunk.onChunkRemove(); // Paper
this.pendingUnloads.put(j, playerchunk);
this.modified = true;
++i;
@@ -523,7 +542,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -523,7 +538,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
int l = 0;
@ -5152,7 +5051,7 @@ index 5b920beb39dad8d392b4e5e12a89880720e41942..6751e403595170b22abf100a27f97251
while (l < 20 && shouldKeepTicking.getAsBoolean() && objectiterator.hasNext()) {
if (this.saveChunkIfNeeded((ChunkHolder) objectiterator.next())) {
@@ -541,7 +560,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -541,7 +556,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} else {
ChunkAccess ichunkaccess = holder.getLatestChunk();
@ -5165,7 +5064,7 @@ index 5b920beb39dad8d392b4e5e12a89880720e41942..6751e403595170b22abf100a27f97251
LevelChunk chunk;
if (ichunkaccess instanceof LevelChunk) {
@@ -559,7 +582,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -559,7 +578,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.lightEngine.tryScheduleUpdate();
this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null);
this.chunkSaveCooldowns.remove(ichunkaccess.getPos().toLong());
@ -5176,7 +5075,7 @@ index 5b920beb39dad8d392b4e5e12a89880720e41942..6751e403595170b22abf100a27f97251
}
};
@@ -896,7 +921,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -896,7 +917,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
}
@ -5185,7 +5084,7 @@ index 5b920beb39dad8d392b4e5e12a89880720e41942..6751e403595170b22abf100a27f97251
int j = Mth.clamp(watchDistance, 2, 32);
if (j != this.serverViewDistance) {
@@ -913,7 +938,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -913,7 +934,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
@ -5194,7 +5093,7 @@ index 5b920beb39dad8d392b4e5e12a89880720e41942..6751e403595170b22abf100a27f97251
return Mth.clamp(player.requestedViewDistance(), 2, this.serverViewDistance);
}
@@ -942,7 +967,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -942,7 +963,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public int size() {
@ -5203,7 +5102,7 @@ index 5b920beb39dad8d392b4e5e12a89880720e41942..6751e403595170b22abf100a27f97251
}
public DistanceManager getDistanceManager() {
@@ -950,19 +975,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -950,19 +971,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected Iterable<ChunkHolder> getChunks() {
@ -5228,7 +5127,7 @@ index 5b920beb39dad8d392b4e5e12a89880720e41942..6751e403595170b22abf100a27f97251
Optional<ChunkAccess> optional = Optional.ofNullable(playerchunk.getLatestChunk());
Optional<LevelChunk> optional1 = optional.flatMap((ichunkaccess) -> {
return ichunkaccess instanceof LevelChunk ? Optional.of((LevelChunk) ichunkaccess) : Optional.empty();
@@ -1385,10 +1410,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1385,10 +1406,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
}
@ -5758,7 +5657,7 @@ index 3c707d6674b2594b09503b959a31c1f4ad3981e6..db61b6b0158a9bcc0e1d735e34fe3671
public BlockState getBlockState(BlockPos pos) {
return Blocks.AIR.defaultBlockState();
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index c061813d275fbc48d7629cc59d90dbb4c347516c..55b30e1df4a05802977b0c3f3b518ef0676eae2d 100644
index c061813d275fbc48d7629cc59d90dbb4c347516c..2bc1d0d3ea8a6e3327e9c11bd1f0666d210e9bbe 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -95,6 +95,7 @@ import org.bukkit.craftbukkit.CraftServer;
@ -5834,21 +5733,11 @@ index c061813d275fbc48d7629cc59d90dbb4c347516c..55b30e1df4a05802977b0c3f3b518ef0
+ }
+
@Override
- public ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
+ public final ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) { // Paper - final for inline
public ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
+ // Paper end
ChunkAccess ichunkaccess = this.getChunkSource().getChunk(chunkX, chunkZ, leastStatus, create);
if (ichunkaccess == null && create) {
@@ -312,7 +354,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
@Override
- public boolean setBlock(BlockPos pos, BlockState state, int flags) {
+ public final boolean setBlock(BlockPos pos, BlockState state, int flags) { // Paper - final for inline
return this.setBlock(pos, state, flags, 512);
}
@@ -551,7 +593,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if (this.isOutsideBuildHeight(pos)) {
return Blocks.VOID_AIR.defaultBlockState();

Datei anzeigen

@ -977,7 +977,7 @@ index d38ecbc208c34509eaf77751ac45d9ef51a5dce8..b51c3f8c485496734ea58c15377a1215
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 6751e403595170b22abf100a27f97251edcb2125..93bd3c633f83c96a7028a97eee3a732489d01b06 100644
index 16cfa946f2e121594875a57e4ff982052cf5ffd1..d60c70d59d0a6ef21224c597c9015cb3f51dabb8 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1,8 +1,10 @@
@ -991,7 +991,7 @@ index 6751e403595170b22abf100a27f97251edcb2125..93bd3c633f83c96a7028a97eee3a7324
import com.google.common.collect.Lists;
import com.google.common.collect.Queues;
import com.google.common.collect.Sets;
@@ -1300,6 +1302,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1296,6 +1298,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
List<ServerPlayer> list = Lists.newArrayList();
List<ServerPlayer> list1 = this.level.players();
ObjectIterator objectiterator = this.entityMap.values().iterator();
@ -999,7 +999,7 @@ index 6751e403595170b22abf100a27f97251edcb2125..93bd3c633f83c96a7028a97eee3a7324
ChunkMap.TrackedEntity playerchunkmap_entitytracker;
@@ -1324,14 +1327,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1320,14 +1323,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
playerchunkmap_entitytracker.serverEntity.sendChanges();
}
}
@ -1459,7 +1459,7 @@ index 44d4aee059d74676bffb8b6bc6f6ad4dd96fcb33..97ad63aad3c559feb1e762af1e00fd55
if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
this.hurt(this.damageSources().drown(), 1.0F);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 55b30e1df4a05802977b0c3f3b518ef0676eae2d..1702cd6aa8b4fc29b8f2539604f6e203bf95d020 100644
index 2bc1d0d3ea8a6e3327e9c11bd1f0666d210e9bbe..79d5423be919dfe4db75ad7dd0ce403ad0214462 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -93,7 +93,6 @@ import net.minecraft.network.protocol.game.ClientboundSetBorderWarningDistancePa
@ -1804,7 +1804,7 @@ index b0ffa23faf62629043dfd613315eaf9c5fcc2cfe..00000000000000000000000000000000
- }
-}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 2b6912514ab39c26338c6ac580a8d1f33f3df61f..eb633256f353ddaee5098d11f0e5f50d7e5a26cd 100644
index 807184636a99c17fe6ed8dd1cd07e1872d613657..68b9b4aba7dba31e4526165e6efb8c40f9e841bc 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2782,6 +2782,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Add World Util Methods
Methods that can be used for other patches to help improve logic.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 4f5ff6849e0ea7a4f2491e0dbede7699554239dc..eae1d6eedeed09b3f49913c2bb205b80442bbfe3 100644
index 32b42d25631aecdd31db4954a8bbf38bcda98d6b..dfb349ed8a0fb981b3234baf040bd3297a555ebf 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -341,6 +341,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -30,5 +30,5 @@ index 4f5ff6849e0ea7a4f2491e0dbede7699554239dc..eae1d6eedeed09b3f49913c2bb205b80
+ }
+
@Override
public final ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) { // Paper - final for inline
public ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
// Paper end

Datei anzeigen

@ -9,10 +9,10 @@ from triggering monster spawns on a server.
Also a highly more effecient way to blanket block spawns in a world
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 93bd3c633f83c96a7028a97eee3a732489d01b06..fdd1b0a02eb90d39ad3324808d088705ab5651c0 100644
index d60c70d59d0a6ef21224c597c9015cb3f51dabb8..63bcd7698fdb86366441dacedbb616771f6b1a3d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1041,7 +1041,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1037,7 +1037,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
chunkRange = (chunkRange > this.level.spigotConfig.viewDistance) ? (byte) this.level.spigotConfig.viewDistance : chunkRange;
chunkRange = (chunkRange > 8) ? 8 : chunkRange;
@ -23,7 +23,7 @@ index 93bd3c633f83c96a7028a97eee3a732489d01b06..fdd1b0a02eb90d39ad3324808d088705
// Spigot end
if (!this.distanceManager.hasPlayersNearby(chunkcoordintpair.toLong())) {
return false;
@@ -1056,6 +1058,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1052,6 +1054,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
entityplayer = (ServerPlayer) iterator.next();

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index fdd1b0a02eb90d39ad3324808d088705ab5651c0..bdaef11e9f8a78c7777b6a98fcca881c8f253bda 100644
index 63bcd7698fdb86366441dacedbb616771f6b1a3d..a58a68220e077ce23c20cf61d63f51183df1dfc9 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1258,6 +1258,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1254,6 +1254,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} else {
ChunkMap.TrackedEntity playerchunkmap_entitytracker = new ChunkMap.TrackedEntity(entity, i, j, entitytypes.trackDeltas());
@ -16,7 +16,7 @@ index fdd1b0a02eb90d39ad3324808d088705ab5651c0..bdaef11e9f8a78c7777b6a98fcca881c
this.entityMap.put(entity.getId(), playerchunkmap_entitytracker);
playerchunkmap_entitytracker.updatePlayers(this.level.players());
if (entity instanceof ServerPlayer) {
@@ -1298,7 +1299,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1294,7 +1295,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (playerchunkmap_entitytracker1 != null) {
playerchunkmap_entitytracker1.broadcastRemoved();
}

Datei anzeigen

@ -8,10 +8,10 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code
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
index bdaef11e9f8a78c7777b6a98fcca881c8f253bda..d969d761c12b5c335037eb74b603061ac1d918c2 100644
index a58a68220e077ce23c20cf61d63f51183df1dfc9..6159ab8831a233c21aad48c64ef76b06c1955bb0 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1550,6 +1550,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1546,6 +1546,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
int j = entity.getType().clientTrackingRange() * 16;

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.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index d969d761c12b5c335037eb74b603061ac1d918c2..fd50b43197bf3a92e838023de31b7acd8a257b8e 100644
index 6159ab8831a233c21aad48c64ef76b06c1955bb0..ee3a5b2f2f1591f68bbacea01b8eafed65c29356 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1245,6 +1245,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1241,6 +1241,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void addEntity(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot

Datei anzeigen

@ -31,10 +31,10 @@ delays anymore.
public net.minecraft.server.level.ChunkMap addEntity(Lnet/minecraft/world/entity/Entity;)V
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index fd50b43197bf3a92e838023de31b7acd8a257b8e..161792d0226dbb50e9f5ab5c0fe42cc73f44c2a8 100644
index ee3a5b2f2f1591f68bbacea01b8eafed65c29356..bac8e53cab360142f224965e68d8f9e6ae0c15f6 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1252,6 +1252,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1248,6 +1248,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return;
}
// Paper end - ignore and warn about illegal addEntity calls instead of crashing server

Datei anzeigen

@ -7,10 +7,10 @@ Reference2BooleanOpenHashMap is going to have
better lookups than HashMap.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 161792d0226dbb50e9f5ab5c0fe42cc73f44c2a8..b95690dc28dbe8420b0054205c50d14de79f7a42 100644
index bac8e53cab360142f224965e68d8f9e6ae0c15f6..b953def299faf1a13e1893d17a476f36e2d6337a 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1466,7 +1466,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1462,7 +1462,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
final Entity entity;
private final int range;
SectionPos lastSectionPos;

Datei anzeigen

@ -85,10 +85,10 @@ index 6854ca4d4fec2b4fa541c3fabf63787665572609..e7b444a10b244828827b3c66c5346520
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index b95690dc28dbe8420b0054205c50d14de79f7a42..54a7e65929ca29526f670d5e5d4ef19cb9008d43 100644
index b953def299faf1a13e1893d17a476f36e2d6337a..d409791325771909faaef0dffb0f7f02d1bf71af 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1031,7 +1031,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1027,7 +1027,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// CraftBukkit end
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Player Entity Tracking Events
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 54a7e65929ca29526f670d5e5d4ef19cb9008d43..cc7c284079af5ec4fd7085e87a7de47aacda587d 100644
index d409791325771909faaef0dffb0f7f02d1bf71af..ca98b4c405afc2d86085759ba50d02eba75784a7 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1538,7 +1538,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1534,7 +1534,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// CraftBukkit end
if (flag) {
if (this.seenBy.add(player.connection)) {

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Configurable entity tracking range by Y coordinate
Options to configure entity tracking by Y coordinate, also for each entity category.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index cc7c284079af5ec4fd7085e87a7de47aacda587d..a179fef4a020b66224984e3bf5b4b5255274103c 100644
index ca98b4c405afc2d86085759ba50d02eba75784a7..51c6f20a7402ff3809c8b7690fa4651eee0304cd 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1530,6 +1530,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1526,6 +1526,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
double d1 = vec3d.x * vec3d.x + vec3d.z * vec3d.z;
double d2 = d0 * d0;
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player) && ChunkMap.this.isChunkTracked(player, this.entity.chunkPosition().x, this.entity.chunkPosition().z);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Don't check if we can see non-visible entities
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index a179fef4a020b66224984e3bf5b4b5255274103c..12361438efd12e327c8f6c2c1b233f05075402f8 100644
index 51c6f20a7402ff3809c8b7690fa4651eee0304cd..d4cc6d189cda03ea8e5d44af0608f914078f7e6e 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1541,7 +1541,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1537,7 +1537,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end - Configurable entity tracking range by Y
// CraftBukkit start - respect vanish API

Datei anzeigen

@ -18,10 +18,10 @@ index a043ac10834562d357ef0b5aded2e916e2a0d056..74276c368016fcc4dbf9579b2ecbadc9
@VisibleForTesting
static long encode(double value) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 12361438efd12e327c8f6c2c1b233f05075402f8..56ef427af5cdfa9b673089cabc43167012b343bc 100644
index d4cc6d189cda03ea8e5d44af0608f914078f7e6e..7f287127faf1d3a6b4b0f77800964b327ca9123f 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1524,10 +1524,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1520,10 +1520,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void updatePlayer(ServerPlayer player) {
org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot
if (player != this.entity) {

Datei anzeigen

@ -22687,10 +22687,10 @@ index 0761d5bc5f2813bb4a9f664ac7a05b9744d0a778..7d2896918ff5fed37e5de5a22c37b0c7
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index d0866b2c2f729b6c251eaade3758e94de4d05d6d..63b5286e315ed620ce74c9d67ac99a8708b4c0a7 100644
index 2f253f33b866ff74e959c41d9501264cf226f45e..932de172f1fd4c1b31cf8958f3d2d412c9be0af9 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -32,28 +32,20 @@ import net.minecraft.world.level.lighting.LevelLightEngine;
@@ -32,46 +32,125 @@ import net.minecraft.world.level.lighting.LevelLightEngine;
import net.minecraft.server.MinecraftServer;
// CraftBukkit end
@ -22720,13 +22720,7 @@ index d0866b2c2f729b6c251eaade3758e94de4d05d6d..63b5286e315ed620ce74c9d67ac99a87
- private CompletableFuture<?> sendSync;
- private CompletableFuture<?> saveSync;
+ // Paper - rewrite chunk system
private final ChunkMap chunkMap; // Paper
@@ -67,23 +59,110 @@ public class ChunkHolder extends GenerationChunkHolder {
}
// Paper end
+
+ // Paper start - rewrite chunk system
+ private ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder newChunkHolder;
+
@ -22819,7 +22813,7 @@ index d0866b2c2f729b6c251eaade3758e94de4d05d6d..63b5286e315ed620ce74c9d67ac99a87
+ return true;
+ }
+ // Paper end - rewrite chunk system
+
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
super(pos);
- this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
@ -22843,23 +22837,8 @@ index d0866b2c2f729b6c251eaade3758e94de4d05d6d..63b5286e315ed620ce74c9d67ac99a87
+ // Paper - rewrite chunk system
this.setTicketLevel(level);
this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()];
this.chunkMap = (ChunkMap)playersWatchingChunkProvider; // Paper
@@ -91,21 +170,13 @@ public class ChunkHolder extends GenerationChunkHolder {
// Paper start
public @Nullable ChunkAccess getAvailableChunkNow() {
- // TODO can we just getStatusFuture(EMPTY)?
- for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) {
- ChunkAccess chunkAccess = this.getChunkIfPresentUnchecked(curr);
- if (chunkAccess == null) {
- continue;
- }
- return chunkAccess;
- }
- return null;
+ return this.getChunkIfPresent(ChunkStatus.EMPTY); // Paper - rewrite chunk system
}
// Paper end
@@ -79,7 +158,7 @@ public class ChunkHolder extends GenerationChunkHolder {
// CraftBukkit start
public LevelChunk getFullChunkNow() {
// Note: We use the oldTicketLevel for isLoaded checks.
@ -22868,20 +22847,20 @@ index d0866b2c2f729b6c251eaade3758e94de4d05d6d..63b5286e315ed620ce74c9d67ac99a87
return this.getFullChunkNowUnchecked();
}
@@ -115,39 +186,46 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -89,63 +168,64 @@ public class ChunkHolder extends GenerationChunkHolder {
// CraftBukkit end
public final CompletableFuture<ChunkResult<LevelChunk>> getTickingChunkFuture() { // Paper - final for inline
public CompletableFuture<ChunkResult<LevelChunk>> getTickingChunkFuture() {
- return this.tickingChunkFuture;
+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system
}
public final CompletableFuture<ChunkResult<LevelChunk>> getEntityTickingChunkFuture() { // Paper - final for inline
public CompletableFuture<ChunkResult<LevelChunk>> getEntityTickingChunkFuture() {
- return this.entityTickingChunkFuture;
+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system
}
public final CompletableFuture<ChunkResult<LevelChunk>> getFullChunkFuture() { // Paper - final for inline
public CompletableFuture<ChunkResult<LevelChunk>> getFullChunkFuture() {
- return this.fullChunkFuture;
+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system
}
@ -22928,9 +22907,6 @@ index d0866b2c2f729b6c251eaade3758e94de4d05d6d..63b5286e315ed620ce74c9d67ac99a87
}
@@ -166,26 +244,20 @@ public class ChunkHolder extends GenerationChunkHolder {
// Paper end
public CompletableFuture<?> getSaveSyncFuture() {
- return this.saveSync;
+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system
@ -22959,7 +22935,7 @@ index d0866b2c2f729b6c251eaade3758e94de4d05d6d..63b5286e315ed620ce74c9d67ac99a87
if (chunk != null) {
int i = this.levelHeightAccessor.getSectionIndex(pos.getY());
@@ -205,7 +277,7 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -165,7 +245,7 @@ public class ChunkHolder extends GenerationChunkHolder {
if (ichunkaccess != null) {
ichunkaccess.setUnsaved(true);
@ -22968,7 +22944,7 @@ index d0866b2c2f729b6c251eaade3758e94de4d05d6d..63b5286e315ed620ce74c9d67ac99a87
if (chunk != null) {
int j = this.lightEngine.getMinLightSection();
@@ -231,7 +303,7 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -191,7 +271,7 @@ public class ChunkHolder extends GenerationChunkHolder {
List list;
if (!this.skyChangedLightSectionFilter.isEmpty() || !this.blockChangedLightSectionFilter.isEmpty()) {
@ -22977,7 +22953,7 @@ index d0866b2c2f729b6c251eaade3758e94de4d05d6d..63b5286e315ed620ce74c9d67ac99a87
if (!list.isEmpty()) {
ClientboundLightUpdatePacket packetplayoutlightupdate = new ClientboundLightUpdatePacket(chunk.getPos(), this.lightEngine, this.skyChangedLightSectionFilter, this.blockChangedLightSectionFilter);
@@ -243,7 +315,7 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -203,7 +283,7 @@ public class ChunkHolder extends GenerationChunkHolder {
}
if (this.hasChangedSections) {
@ -22986,10 +22962,10 @@ index d0866b2c2f729b6c251eaade3758e94de4d05d6d..63b5286e315ed620ce74c9d67ac99a87
for (int i = 0; i < this.changedBlocksPerSection.length; ++i) {
ShortSet shortset = this.changedBlocksPerSection[i];
@@ -309,193 +381,40 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -269,193 +349,40 @@ public class ChunkHolder extends GenerationChunkHolder {
@Override
public final int getTicketLevel() { // Paper - final for inline
public int getTicketLevel() {
- return this.ticketLevel;
+ return this.newChunkHolder.getTicketLevel(); // Paper - rewrite chunk system
}
@ -23189,7 +23165,7 @@ index d0866b2c2f729b6c251eaade3758e94de4d05d6d..63b5286e315ed620ce74c9d67ac99a87
}
@FunctionalInterface
@@ -511,15 +430,15 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -471,15 +398,15 @@ public class ChunkHolder extends GenerationChunkHolder {
// Paper start
public final boolean isEntityTickingReady() {
@ -23226,7 +23202,7 @@ index d9ad32acdf46a43a649334a3b736aeb7b3af21d1..fae17a075d7efaf24d916877dd5968eb
public static final int RADIUS_AROUND_FULL_CHUNK = FULL_CHUNK_STEP.accumulatedDependencies().getRadius();
public static final int MAX_LEVEL = 33 + RADIUS_AROUND_FULL_CHUNK;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0bec5f285e 100644
index 7f287127faf1d3a6b4b0f77800964b327ca9123f..edb36dee707433d4f9419aef6ac6cc0bec5f285e 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -122,10 +122,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -23425,7 +23401,7 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
}
public ReportedException debugFuturesAndCreateReportedException(IllegalStateException exception, String details) {
@@ -404,93 +337,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -404,90 +337,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public CompletableFuture<ChunkResult<LevelChunk>> prepareEntityTickingChunk(ChunkHolder holder) {
@ -23467,9 +23443,6 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
- // Paper end
- }
-
- // Paper start
- holder.onChunkAdd();
- // Paper end
- this.updatingChunkMap.put(pos, holder);
- this.modified = true;
- }
@ -23525,7 +23498,7 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
}
protected void tick(BooleanSupplier shouldKeepTicking) {
@@ -507,134 +370,25 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -504,133 +370,25 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public boolean hasWork() {
@ -23547,7 +23520,6 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
- }
-
- this.updatingChunkMap.remove(j);
- playerchunk.onChunkRemove(); // Paper
- this.pendingUnloads.put(j, playerchunk);
- this.modified = true;
- ++i;
@ -23666,7 +23638,7 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
}
private static boolean isChunkDataValid(CompoundTag nbt) {
@@ -694,137 +448,44 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -690,137 +448,44 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@Override
public GenerationChunkHolder acquireGeneration(long pos) {
@ -23813,7 +23785,7 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
}
public int getTickingGenerated() {
@@ -832,135 +493,84 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -828,135 +493,84 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
private boolean saveChunkIfNeeded(ChunkHolder chunkHolder) {
@ -24001,7 +23973,7 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
@Nullable
public LevelChunk getChunkToSend(long pos) {
ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos);
@@ -1026,7 +636,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1022,7 +636,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
// CraftBukkit start
@ -24010,7 +23982,7 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
return this.upgradeChunkTag(this.level.getTypeKey(), this.overworldDataStorage, nbttagcompound, this.generator().getTypeNameForDataFixer(), chunkcoordintpair, this.level);
// CraftBukkit end
}
@@ -1117,19 +727,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1113,19 +727,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.updatePlayerPos(player);
if (!flag1) {
this.distanceManager.addPlayer(SectionPos.of((EntityAccess) player), player);
@ -24034,7 +24006,7 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
}
}
@@ -1141,17 +753,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1137,17 +753,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public void move(ServerPlayer player) {
@ -24053,7 +24025,7 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
SectionPos sectionposition = player.getLastSectionPos();
SectionPos sectionposition1 = SectionPos.of((EntityAccess) player);
@@ -1161,6 +763,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1157,6 +763,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (flag2 || flag != flag1) {
this.updatePlayerPos(player);
@ -24061,7 +24033,7 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
if (!flag) {
this.distanceManager.removePlayer(sectionposition, player);
}
@@ -1177,70 +780,30 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1173,70 +780,30 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.playerMap.unIgnorePlayer(player);
}
@ -24143,7 +24115,7 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
}
public void addEntity(Entity entity) {
@@ -1268,6 +831,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1264,6 +831,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
this.entityMap.put(entity.getId(), playerchunkmap_entitytracker);
@ -24156,7 +24128,7 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
playerchunkmap_entitytracker.updatePlayers(this.level.players());
if (entity instanceof ServerPlayer) {
ServerPlayer entityplayer = (ServerPlayer) entity;
@@ -1308,16 +877,49 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1304,16 +877,49 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
playerchunkmap_entitytracker1.broadcastRemoved();
}
entity.tracker = null; // Paper - We're no longer tracked
@ -24211,7 +24183,7 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
List<ServerPlayer> list = Lists.newArrayList();
List<ServerPlayer> list1 = this.level.players();
@@ -1424,27 +1026,25 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1420,27 +1026,25 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public void waitForLightBeforeSending(ChunkPos centerPos, int radius) {
@ -24249,7 +24221,7 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
}
@Nullable
@@ -1460,7 +1060,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1456,7 +1060,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
}
@ -24258,7 +24230,7 @@ index 56ef427af5cdfa9b673089cabc43167012b343bc..edb36dee707433d4f9419aef6ac6cc0b
public final ServerEntity serverEntity;
final Entity entity;
@@ -1468,6 +1068,84 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1464,6 +1068,84 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
SectionPos lastSectionPos;
public final Set<ServerPlayerConnection> seenBy = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>(); // Paper - Perf: optimise map impl
@ -28136,7 +28108,7 @@ index bff83fe413c7baef4ba56a3270ea4463a58c792f..a248d859cbce48f4a34c4771a7acffc1
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index e27d3547d1e19c137e05e6b8d075127a8bafb237..a016fb2140d6a43172c3fbc623b23f6d57798d9e 100644
index e5abde76c354c3dd9940dd4e5ae3fe8b6a2b4680..347334130e99dbf938d570bd36440a96f92d475a 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -81,6 +81,7 @@ import net.minecraft.world.level.storage.LevelData;
@ -32793,7 +32765,7 @@ index 94640aa827c9b2e1d0174eb012fdb37c0851f501..5ad2ceb1274648631689215702a12463
// Paper start - implement pointers
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 65a6952d48f40f3fd73d6693b61be9d29741f2f6..4e7da1be4acf1028022e62a652df3e262a85fa0f 100644
index 12010a078542b7e89f0f4c0e7983eb15e75c4f1f..2f56cbcc1d1af98f58c310ff8b4ce33cc950e977 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3497,7 +3497,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {