Updated Upstream (Paper & Tuinity)

Upstream has released updates that appear to apply and compile correctly

Paper Changes:
2e37979 Use cause and cancel component in PlayerGameModeChanteEvent (#6192)
b41b5b5 Catch desynced block breaks (#6193)
5a9c14b Fix distanceSq check on block breaking (#6195)
a5acf36 Fix PaperTickList (#6191)

Tuinity Changes:
08c0050 Update paper
9cabf00 Do not run filtered rebuild
23229b9 Add async catchers to chunk ticking status change
ab2aeb0 Update paper
bdd7bb4 Update paper
This commit is contained in:
William Blake Galbreath
2021-07-16 14:18:57 -05:00
parent 7b591f462c
commit 0713758d86
16 changed files with 82 additions and 97 deletions

View File

@@ -3937,7 +3937,7 @@ index 580bae0d414d371a07a6bfeefc41fdd989dc0083..d50b61876f15d95b836b3dd81d9c3492
switch (distance) {
case -1:
diff --git a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java
index da13ff17609b7bc8076d9297edf8decf01a2ed88..b4c69d39eee19339b1de295151d7ed3bf61635c1 100644
index 5fdaefc128956581be4bb9b34199fd6410563991..8203524862c309bd52fd3a8a47b219aca570f0b1 100644
--- a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java
+++ b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java
@@ -312,6 +312,7 @@ public final class PaperTickList<T> extends ServerTickList<T> { // extend to avo
@@ -12667,7 +12667,7 @@ index 1cc4e0a1f3d8235ef88b48e01ca8b78a263d2676..428d94c60b826ddf3797d6713661dff1
+ */ // Tuinity - replace old loader system
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index c5d77b446afc162adb4b64d23f34596363b990b6..db39671881b622189961b39309a323a1b35d680e 100644
index c5a73dee1c1c4724f01be44399f52cd2f711256c..6d9497655bd568157f83f30c38a0bf254a5330d7 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -47,6 +47,7 @@ import net.minecraft.world.level.storage.LevelStorageSource;
@@ -12699,7 +12699,7 @@ index c5d77b446afc162adb4b64d23f34596363b990b6..db39671881b622189961b39309a323a1
}
} catch (Throwable thr) {
if (thr instanceof ThreadDeath) {
@@ -226,6 +227,166 @@ public class ServerChunkCache extends ChunkSource {
@@ -227,6 +228,166 @@ public class ServerChunkCache extends ChunkSource {
}
// Paper end - rewrite ticklistserver
@@ -12866,7 +12866,7 @@ index c5d77b446afc162adb4b64d23f34596363b990b6..db39671881b622189961b39309a323a1
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.mainThreadProcessor = new ServerChunkCache.MainThreadExecutor(world);
@@ -569,6 +730,8 @@ public class ServerChunkCache extends ChunkSource {
@@ -570,6 +731,8 @@ public class ServerChunkCache extends ChunkSource {
return completablefuture;
}
@@ -12875,7 +12875,7 @@ index c5d77b446afc162adb4b64d23f34596363b990b6..db39671881b622189961b39309a323a1
private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) {
// Paper start - add isUrgent - old sig left in place for dirty nms plugins
return getChunkFutureMainThread(i, j, chunkstatus, flag, false);
@@ -587,9 +750,12 @@ public class ServerChunkCache extends ChunkSource {
@@ -588,9 +751,12 @@ public class ServerChunkCache extends ChunkSource {
ChunkHolder.FullChunkStatus currentChunkState = ChunkHolder.getFullChunkStatus(playerchunk.getTicketLevel());
currentlyUnloading = (oldChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !currentChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER));
}
@@ -12888,7 +12888,7 @@ index c5d77b446afc162adb4b64d23f34596363b990b6..db39671881b622189961b39309a323a1
if (isUrgent) this.distanceManager.markUrgent(chunkcoordintpair); // Paper - Chunk priority
if (this.chunkAbsent(playerchunk, l)) {
ProfilerFiller gameprofilerfiller = this.level.getProfiler();
@@ -600,12 +766,20 @@ public class ServerChunkCache extends ChunkSource {
@@ -601,12 +767,20 @@ public class ServerChunkCache extends ChunkSource {
playerchunk = this.getVisibleChunkIfPresent(k);
gameprofilerfiller.pop();
if (this.chunkAbsent(playerchunk, l)) {
@@ -12910,7 +12910,7 @@ index c5d77b446afc162adb4b64d23f34596363b990b6..db39671881b622189961b39309a323a1
if (isUrgent) {
future.thenAccept(either -> this.distanceManager.clearUrgent(chunkcoordintpair));
}
@@ -663,6 +837,8 @@ public class ServerChunkCache extends ChunkSource {
@@ -664,6 +838,8 @@ public class ServerChunkCache extends ChunkSource {
public boolean runDistanceManagerUpdates() {
if (distanceManager.delayDistanceManagerTick) return false; // Paper - Chunk priority
@@ -12919,7 +12919,7 @@ index c5d77b446afc162adb4b64d23f34596363b990b6..db39671881b622189961b39309a323a1
boolean flag = this.distanceManager.runAllUpdates(this.chunkMap);
boolean flag1 = this.chunkMap.promoteChunkMap();
@@ -672,6 +848,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -673,6 +849,7 @@ public class ServerChunkCache extends ChunkSource {
this.clearCache();
return true;
}
@@ -12927,7 +12927,7 @@ index c5d77b446afc162adb4b64d23f34596363b990b6..db39671881b622189961b39309a323a1
}
// Paper start - helper
@@ -729,6 +906,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -730,6 +907,7 @@ public class ServerChunkCache extends ChunkSource {
// CraftBukkit start - modelled on below
public void purgeUnload() {
@@ -12935,7 +12935,7 @@ index c5d77b446afc162adb4b64d23f34596363b990b6..db39671881b622189961b39309a323a1
this.level.getProfiler().push("purge");
this.distanceManager.purgeStaleTickets();
this.runDistanceManagerUpdates();
@@ -744,17 +922,18 @@ public class ServerChunkCache extends ChunkSource {
@@ -745,17 +923,18 @@ public class ServerChunkCache extends ChunkSource {
this.level.getProfiler().push("purge");
this.level.timings.doChunkMap.startTiming(); // Spigot
this.distanceManager.purgeStaleTickets();
@@ -12956,7 +12956,7 @@ index c5d77b446afc162adb4b64d23f34596363b990b6..db39671881b622189961b39309a323a1
this.level.timings.doChunkUnload.stopTiming(); // Spigot
this.level.getProfiler().pop();
this.clearCache();
@@ -832,18 +1011,26 @@ public class ServerChunkCache extends ChunkSource {
@@ -833,18 +1012,26 @@ public class ServerChunkCache extends ChunkSource {
//Collections.shuffle(list); // Paper
// Paper - moved up
this.level.timings.chunkTicks.startTiming(); // Paper
@@ -12990,7 +12990,7 @@ index c5d77b446afc162adb4b64d23f34596363b990b6..db39671881b622189961b39309a323a1
}
// this.level.timings.doTickTiles.startTiming(); // Spigot // Paper
@@ -851,7 +1038,11 @@ public class ServerChunkCache extends ChunkSource {
@@ -852,7 +1039,11 @@ public class ServerChunkCache extends ChunkSource {
// this.level.timings.doTickTiles.stopTiming(); // Spigot // Paper
}
}
@@ -13003,7 +13003,7 @@ index c5d77b446afc162adb4b64d23f34596363b990b6..db39671881b622189961b39309a323a1
this.level.timings.chunkTicks.stopTiming(); // Paper
this.level.getProfiler().push("customSpawners");
if (flag1) {
@@ -860,25 +1051,28 @@ public class ServerChunkCache extends ChunkSource {
@@ -861,25 +1052,28 @@ public class ServerChunkCache extends ChunkSource {
} // Paper - timings
}
@@ -13047,7 +13047,7 @@ index c5d77b446afc162adb4b64d23f34596363b990b6..db39671881b622189961b39309a323a1
}
private void getFullChunk(long pos, Consumer<LevelChunk> chunkConsumer) {
@@ -1025,46 +1219,14 @@ public class ServerChunkCache extends ChunkSource {
@@ -1026,46 +1220,14 @@ public class ServerChunkCache extends ChunkSource {
super.doRunTask(task);
}
@@ -13110,7 +13110,7 @@ index 2f3e69ad809199ffc2661d524bb627ec8dbc2e80..0fcd6a9162f5bddb3c4fc42b3a64efde
if (flag2) {
packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.entity.isOnGround());
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index c2e0417ee15018ec31c4aa8eec3dff7a0d16aa9e..8207f0fd2c0b5cd60d02714108eab47b1ae84e16 100644
index c2e0417ee15018ec31c4aa8eec3dff7a0d16aa9e..631bc406d9bb193ac2d1d433519c2c3a7f4589e4 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -114,6 +114,7 @@ import net.minecraft.world.level.block.Block;
@@ -13322,18 +13322,7 @@ index c2e0417ee15018ec31c4aa8eec3dff7a0d16aa9e..8207f0fd2c0b5cd60d02714108eab47b
StructureManager definedstructuremanager = minecraftserver.getStructureManager();
int j = this.spigotConfig.viewDistance; // Spigot
PersistentEntitySectionManager persistententitysectionmanager = this.entityManager;
@@ -382,6 +552,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.asyncChunkTaskManager = new com.destroystokyo.paper.io.chunk.ChunkTaskManager(this); // Paper
}
+ // Tuinity start - optimise collision
+
+ // Tuinity end - optimise collision
+
public void setWeatherParameters(int clearDuration, int rainDuration, boolean raining, boolean thundering) {
this.serverLevelData.setClearWeatherTime(clearDuration);
this.serverLevelData.setRainTime(rainDuration);
@@ -400,6 +574,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -400,6 +570,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
public void tick(BooleanSupplier shouldKeepTicking) {
@@ -13348,7 +13337,7 @@ index c2e0417ee15018ec31c4aa8eec3dff7a0d16aa9e..8207f0fd2c0b5cd60d02714108eab47b
ProfilerFiller gameprofilerfiller = this.getProfiler();
this.handlingTick = true;
@@ -545,7 +727,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -545,7 +723,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
timings.scheduledBlocks.stopTiming(); // Paper
@@ -13357,7 +13346,7 @@ index c2e0417ee15018ec31c4aa8eec3dff7a0d16aa9e..8207f0fd2c0b5cd60d02714108eab47b
gameprofilerfiller.popPush("raid");
this.timings.raids.startTiming(); // Paper - timings
this.raids.tick();
@@ -558,7 +740,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -558,7 +736,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
timings.doSounds.startTiming(); // Spigot
this.runBlockEvents();
timings.doSounds.stopTiming(); // Spigot
@@ -13366,7 +13355,7 @@ index c2e0417ee15018ec31c4aa8eec3dff7a0d16aa9e..8207f0fd2c0b5cd60d02714108eab47b
this.handlingTick = false;
gameprofilerfiller.pop();
boolean flag3 = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
@@ -605,12 +787,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -605,12 +783,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
timings.entityTick.stopTiming(); // Spigot
timings.tickEntities.stopTiming(); // Spigot
gameprofilerfiller.pop();
@@ -13381,7 +13370,7 @@ index c2e0417ee15018ec31c4aa8eec3dff7a0d16aa9e..8207f0fd2c0b5cd60d02714108eab47b
this.entityManager.tick();
gameprofilerfiller.pop();
}
@@ -655,6 +837,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -655,6 +833,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
entityplayer.stopSleepInBed(false, false);
});
}
@@ -13392,7 +13381,7 @@ index c2e0417ee15018ec31c4aa8eec3dff7a0d16aa9e..8207f0fd2c0b5cd60d02714108eab47b
public void tickChunk(LevelChunk chunk, int randomTickSpeed) {
ChunkPos chunkcoordintpair = chunk.getPos();
@@ -664,10 +850,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -664,10 +846,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
ProfilerFiller gameprofilerfiller = this.getProfiler();
gameprofilerfiller.push("thunder");
@@ -13405,7 +13394,7 @@ index c2e0417ee15018ec31c4aa8eec3dff7a0d16aa9e..8207f0fd2c0b5cd60d02714108eab47b
if (this.isRainingAt(blockposition)) {
DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition);
boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * paperConfig.skeleHorseSpawnChance && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper
@@ -690,64 +876,78 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -690,64 +872,78 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
gameprofilerfiller.popPush("iceandsnow");
@@ -13516,7 +13505,7 @@ index c2e0417ee15018ec31c4aa8eec3dff7a0d16aa9e..8207f0fd2c0b5cd60d02714108eab47b
timings.chunkTicksBlocks.stopTiming(); // Paper
gameprofilerfiller.pop();
}
@@ -873,7 +1073,27 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -873,7 +1069,27 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
@@ -13544,7 +13533,7 @@ index c2e0417ee15018ec31c4aa8eec3dff7a0d16aa9e..8207f0fd2c0b5cd60d02714108eab47b
++TimingHistory.entityTicks; // Paper - timings
// Spigot start
co.aikar.timings.Timing timer; // Paper
@@ -914,7 +1134,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -914,7 +1130,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
// } finally { timer.stopTiming(); } // Paper - timings - move up
@@ -13559,7 +13548,7 @@ index c2e0417ee15018ec31c4aa8eec3dff7a0d16aa9e..8207f0fd2c0b5cd60d02714108eab47b
}
private void tickPassenger(Entity vehicle, Entity passenger) {
@@ -1206,9 +1432,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1206,9 +1428,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot Start
for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) {
if (tileentity instanceof net.minecraft.world.Container) {
@@ -13574,7 +13563,7 @@ index c2e0417ee15018ec31c4aa8eec3dff7a0d16aa9e..8207f0fd2c0b5cd60d02714108eab47b
}
}
// Spigot End
@@ -1305,9 +1535,19 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1305,9 +1531,19 @@ public class ServerLevel extends Level implements WorldGenLevel {
VoxelShape voxelshape1 = newState.getCollisionShape(this, pos);
if (Shapes.joinIsNotEmpty(voxelshape, voxelshape1, BooleanOp.NOT_SAME)) {
@@ -13596,7 +13585,7 @@ index c2e0417ee15018ec31c4aa8eec3dff7a0d16aa9e..8207f0fd2c0b5cd60d02714108eab47b
// CraftBukkit start - fix SPIGOT-6362
Mob entityinsentient;
try {
@@ -1326,6 +1566,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1326,6 +1562,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
navigationabstract.recomputePath(pos);
}
}
@@ -13608,7 +13597,7 @@ index c2e0417ee15018ec31c4aa8eec3dff7a0d16aa9e..8207f0fd2c0b5cd60d02714108eab47b
}
} // Paper
@@ -2107,10 +2352,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2107,10 +2348,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void onTickingStart(Entity entity) {
ServerLevel.this.entityTickList.add(entity);
@@ -13672,7 +13661,7 @@ index 8e2bccc3a9ddb17a4978596056189eb776976338..dcba69c0ad3288ddc64dacc58b6fb857
public void doCloseContainer() {
this.containerMenu.removed((Player) this);
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index e572088cad8b9e09b1d64f7971bacac2f10c5b17..b2c8cae1a777cd63a35ed1340caf205b1b3bb0ad 100644
index c607cbae6306bea4eaf9c7abc55c59e92e3304c8..800f6f7c6e7d0d5922fc8b8de2aab72dca8514df 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -56,14 +56,28 @@ public class ServerPlayerGameMode {
@@ -13737,7 +13726,7 @@ index e572088cad8b9e09b1d64f7971bacac2f10c5b17..b2c8cae1a777cd63a35ed1340caf205b
float f = state.getDestroyProgress(this.player, this.player.level, pos) * (float) (j + 1);
int k = (int) (f * 10.0F);
@@ -225,7 +245,7 @@ public class ServerPlayerGameMode {
@@ -230,7 +250,7 @@ public class ServerPlayerGameMode {
return;
}
@@ -13746,7 +13735,7 @@ index e572088cad8b9e09b1d64f7971bacac2f10c5b17..b2c8cae1a777cd63a35ed1340caf205b
float f = 1.0F;
iblockdata = this.level.getBlockState(pos);
@@ -278,12 +298,12 @@ public class ServerPlayerGameMode {
@@ -283,12 +303,12 @@ public class ServerPlayerGameMode {
int j = (int) (f * 10.0F);
this.level.destroyBlockProgress(this.player.getId(), pos, j);
@@ -13761,7 +13750,7 @@ index e572088cad8b9e09b1d64f7971bacac2f10c5b17..b2c8cae1a777cd63a35ed1340caf205b
iblockdata = this.level.getBlockState(pos);
if (!iblockdata.isAir()) {
@@ -300,12 +320,18 @@ public class ServerPlayerGameMode {
@@ -305,12 +325,18 @@ public class ServerPlayerGameMode {
this.isDestroyingBlock = false;
this.hasDelayedDestroy = true;
this.delayedDestroyPos = pos;
@@ -13781,7 +13770,7 @@ index e572088cad8b9e09b1d64f7971bacac2f10c5b17..b2c8cae1a777cd63a35ed1340caf205b
} else if (action == ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK) {
this.isDestroyingBlock = false;
if (!Objects.equals(this.destroyPos, pos) && !BlockPos.ZERO.equals(this.destroyPos)) {
@@ -317,7 +343,7 @@ public class ServerPlayerGameMode {
@@ -322,7 +348,7 @@ public class ServerPlayerGameMode {
}
this.level.destroyBlockProgress(this.player.getId(), pos, -1);
@@ -13790,7 +13779,7 @@ index e572088cad8b9e09b1d64f7971bacac2f10c5b17..b2c8cae1a777cd63a35ed1340caf205b
}
}
@@ -327,7 +353,13 @@ public class ServerPlayerGameMode {
@@ -332,7 +358,13 @@ public class ServerPlayerGameMode {
public void destroyAndAck(BlockPos pos, ServerboundPlayerActionPacket.Action action, String reason) {
if (this.destroyBlock(pos)) {
@@ -14161,7 +14150,7 @@ index 0f6b534a4c789a2f09f6c4624e5d58b99c7ed0e6..fea852674098fe411841d8e5ebeace7d
this.generatingStatus = chunkstatus;
this.writeRadiusCutoff = i;
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 098e221d61a8279a4d2eb67ac3fe9ded9b63d322..733ba23aa8f8d84eba556604fd743449a313a659 100644
index 45b57cbd619cec8a77014f977df9778f0ff88917..de56756afcd90eff9a1f7fbfa0feb33e4284c3d7 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -536,6 +536,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -16782,7 +16771,7 @@ index 554474d4b2e57d8a005b3c3b9b23f32a62243058..ebeb3e3b0619b034a9681da999e9ac33
+ // Paper end
}
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 7dc3d806a680150c6a2fffa1436fd63bbdc31eb3..27dcaafbc090bac4cad2607a0961378fbc51092e 100644
index 7dc3d806a680150c6a2fffa1436fd63bbdc31eb3..f6d05372f592a3b7619ad6989630c140ffd4f03b 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
@@ -1,5 +1,7 @@
@@ -16847,15 +16836,7 @@ index 7dc3d806a680150c6a2fffa1436fd63bbdc31eb3..27dcaafbc090bac4cad2607a0961378f
@Deprecated // Paper start - add level
public ProtoChunk(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor world) {
// Paper start
@@ -81,6 +130,7 @@ public class ProtoChunk implements ChunkAccess {
PRINTED_OUTDATED_CTOR_MSG = true;
}
}
+
public ProtoChunk(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor world, net.minecraft.server.level.ServerLevel level) {
// Paper end
this(pos, upgradeData, (LevelChunkSection[])null, new ProtoTickList<>((block) -> {
@@ -100,6 +150,10 @@ public class ProtoChunk implements ChunkAccess {
@@ -100,6 +149,10 @@ public class ProtoChunk implements ChunkAccess {
}
}
public ProtoChunk(ChunkPos pos, UpgradeData upgradeData, @Nullable LevelChunkSection[] levelChunkSections, ProtoTickList<Block> blockTickScheduler, ProtoTickList<Fluid> fluidTickScheduler, LevelHeightAccessor world, net.minecraft.server.level.ServerLevel level) {
@@ -16866,7 +16847,7 @@ index 7dc3d806a680150c6a2fffa1436fd63bbdc31eb3..27dcaafbc090bac4cad2607a0961378f
this.level = level;
// Paper end
this.chunkPos = pos;
@@ -197,7 +251,7 @@ public class ProtoChunk implements ChunkAccess {
@@ -197,7 +250,7 @@ public class ProtoChunk implements ChunkAccess {
LevelChunkSection levelChunkSection = this.getOrCreateSection(l);
BlockState blockState = levelChunkSection.setBlockState(i & 15, j & 15, k & 15, state);
@@ -17827,10 +17808,10 @@ index 90f7b06bd2c558be35c4577044fa033e1fb5cc22..8f244db7e46ac1a3d2c8358f001d4889
return Optional.empty();
} else {
diff --git a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
index f01182a0ac8a14bcd5b1deb778306e7bf1bf70ed..2cfc54a577d0a63a504e24bc54fd763fe51083e5 100644
index f01182a0ac8a14bcd5b1deb778306e7bf1bf70ed..6ba8b50b59d3f81ec4c974defc319b1bab27c04b 100644
--- a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
+++ b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
@@ -9,54 +9,40 @@ import javax.annotation.Nullable;
@@ -9,54 +9,42 @@ import javax.annotation.Nullable;
import net.minecraft.world.entity.Entity;
public class EntityTickList {
@@ -17857,12 +17838,14 @@ index f01182a0ac8a14bcd5b1deb778306e7bf1bf70ed..2cfc54a577d0a63a504e24bc54fd763f
}
public void add(Entity entity) {
+ com.tuinity.tuinity.util.TickThread.ensureTickThread("Asynchronous entity ticklist addition"); // Tuinity
this.ensureActiveIsNotIterated();
- this.active.put(entity.getId(), entity);
+ this.entities.add(entity); // Tuinity - replace with better logic, do not delay removals/additions
}
public void remove(Entity entity) {
+ com.tuinity.tuinity.util.TickThread.ensureTickThread("Asynchronous entity ticklist removal"); // Tuinity
this.ensureActiveIsNotIterated();
- this.active.remove(entity.getId());
+ this.entities.remove(entity); // Tuinity - replace with better logic, do not delay removals/additions
@@ -17885,6 +17868,7 @@ index f01182a0ac8a14bcd5b1deb778306e7bf1bf70ed..2cfc54a577d0a63a504e24bc54fd763f
- }
- } finally {
- this.iterated = null;
+ com.tuinity.tuinity.util.TickThread.ensureTickThread("Asynchronous entity ticklist iteration"); // Tuinity
+ // Tuinity start - replace with better logic, do not delay removals/additions
+ // To ensure nothing weird happens with dimension travelling, do not iterate over new entries...
+ // (by dfl iterator() is configured to not iterate over new entries)
@@ -17897,12 +17881,11 @@ index f01182a0ac8a14bcd5b1deb778306e7bf1bf70ed..2cfc54a577d0a63a504e24bc54fd763f
+ } finally {
+ iterator.finishedIterating();
}
+
+ // Tuinity end - replace with better logic, do not delay removals/additions
}
}
diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
index 5a0a1b01e89b122811b0b567e1ee27081953e638..a40af675d594c0c3a24f61948c28bd682115263e 100644
index 5a0a1b01e89b122811b0b567e1ee27081953e638..3cb190d38eeb978a7c7ebc37259be0c56d07823d 100644
--- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
+++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
@@ -41,8 +41,10 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
@@ -17991,15 +17974,17 @@ index 5a0a1b01e89b122811b0b567e1ee27081953e638..a40af675d594c0c3a24f61948c28bd68
entity.setLevelCallback(new PersistentEntitySectionManager.Callback(entity, l, entitySection));
if (!existing) {
this.callbacks.onCreated(entity);
@@ -147,6 +209,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
@@ -146,7 +208,9 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
public void updateChunkStatus(ChunkPos chunkPos, ChunkHolder.FullChunkStatus levelType) {
+ com.tuinity.tuinity.util.TickThread.ensureTickThread("Asynchronous chunk ticking status update"); // Tuinity
Visibility visibility = Visibility.fromFullChunkStatus(levelType);
+ this.entitySliceManager.chunkStatusChange(chunkPos.x, chunkPos.z, levelType); // Tuinity
this.updateChunkStatus(chunkPos, visibility);
}
@@ -382,18 +445,38 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
@@ -382,18 +446,38 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
@Override
public void onMove() {
BlockPos blockPos = this.entity.blockPosition();
@@ -18041,7 +18026,7 @@ index 5a0a1b01e89b122811b0b567e1ee27081953e638..a40af675d594c0c3a24f61948c28bd68
this.updateStatus(visibility, entitySection.getStatus());
}
@@ -427,6 +510,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
@@ -427,6 +511,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
if (!this.currentSection.remove(this.entity)) {
PersistentEntitySectionManager.LOGGER.warn("Entity {} wasn't found in section {} (destroying due to {})", this.entity, SectionPos.of(this.currentSectionKey), reason);
}