Updated Upstream (Paper, Tuinity, & Airplane)

Upstream has released updates that appear to apply and compile correctly

Paper Changes:
8a29f5894 [Auto] Updated Upstream (Bukkit/CraftBukkit)
8756d232c Expose server protocol version (#5416)
4492bc4cc remove l4j class no longer in existence from preload list
be1370517 Updated Upstream (CraftBukkit) (#5484)
d560151ec Bump mysql-connector-java to 8.0.23 (Fixes #5473) (#5474)
61f400f11 Update log4j to 2.11.2 for JDK 9+ compat (#5400)
a98196585 Updated Upstream (Bukkit/CraftBukkit)
de138fac4 [Auto] Updated Upstream (Bukkit)
304a216ba [CI-SKIP] Ignore gitignore when adding files in automation
d8e384a16 [CI-SKIP] Drop `Allow PlayerEditBookEvent to fire for off hand` (#5471)

Tuinity Changes:
d5261ad29 Do not load chunks for getCubes by default
da9cf9828 Don't read neighbor chunk data off disk when converting chunks
a0aa5ab07 Do not load 1 radius neighbors for lighting
5ccfa52a2 Fix terrible patch times
af53d703a Stop large move vectors in player packet handling from killing the server
6e56ee735 Fix OBFHELPER for flushHeaderin RegionFile
995d05c1c Do not update TE's in generating chunks

Airplane Changes:
8de8e82a2 Update upstream (Tuinity)
This commit is contained in:
BillyGalbreath
2021-04-13 10:56:22 -05:00
parent 2e66f8344b
commit 7f7f024f02
41 changed files with 228 additions and 167 deletions

View File

@@ -169,7 +169,7 @@ permanent authorization for you to choose that version for the
Library.
diff --git a/pom.xml b/pom.xml
index 25ec9c4f8c08551fd80a597a1b39854e70e4f895..dad9981b1cd1ca8b27a45972188fd2b92f5146e7 100644
index ab57297272c2d6f3d21067081bcaf8775b8fff09..de7da911833569c97b7f800a43ee7354d19677e2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,11 +1,11 @@
@@ -187,7 +187,7 @@ index 25ec9c4f8c08551fd80a597a1b39854e70e4f895..dad9981b1cd1ca8b27a45972188fd2b9
<properties>
<!-- <skipTests>true</skipTests> Paper - This [was] not going to end well -->
@@ -19,16 +19,16 @@
@@ -19,8 +19,8 @@
</properties>
<parent>
@@ -198,6 +198,7 @@ index 25ec9c4f8c08551fd80a597a1b39854e70e4f895..dad9981b1cd1ca8b27a45972188fd2b9
<version>dev-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -39,8 +39,8 @@
<dependencies>
<dependency>
@@ -208,7 +209,7 @@ index 25ec9c4f8c08551fd80a597a1b39854e70e4f895..dad9981b1cd1ca8b27a45972188fd2b9
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
@@ -38,6 +38,13 @@
@@ -50,6 +50,13 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
@@ -222,7 +223,7 @@ index 25ec9c4f8c08551fd80a597a1b39854e70e4f895..dad9981b1cd1ca8b27a45972188fd2b9
<dependency>
<groupId>io.papermc</groupId>
<artifactId>minecraft-server</artifactId>
@@ -105,11 +112,7 @@
@@ -112,11 +119,7 @@
<artifactId>cleaner</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
@@ -235,7 +236,7 @@ index 25ec9c4f8c08551fd80a597a1b39854e70e4f895..dad9981b1cd1ca8b27a45972188fd2b9
<!-- deprecated API depend -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
@@ -149,19 +152,26 @@
@@ -156,19 +159,26 @@
<version>4.8.47</version>
<scope>test</scope>
</dependency>
@@ -11404,7 +11405,7 @@ index 2f8bca35508640f6b8c312fff17d55f129431599..db8532c42fcb2e96f4b3491352d1b9a2
class b extends ChunkMap {
diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
index c5e54c519e1f686761faa53b5e9579c514a65332..fe040615ff03478a20cdf8376f89a6b7d100ba61 100644
index c5e54c519e1f686761faa53b5e9579c514a65332..cb83f1152c52a99d25e4e80cc8bf18c6793e8b50 100644
--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
@@ -47,6 +47,12 @@ import net.minecraft.world.level.storage.WorldData;
@@ -11800,7 +11801,7 @@ index c5e54c519e1f686761faa53b5e9579c514a65332..fe040615ff03478a20cdf8376f89a6b7
}
private void a(long i, Consumer<Chunk> consumer) {
@@ -1026,44 +1237,12 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -1026,51 +1237,19 @@ public class ChunkProviderServer extends IChunkProvider {
ChunkProviderServer.this.world.getMethodProfiler().c("runTask");
super.executeTask(runnable);
}
@@ -11848,8 +11849,16 @@ index c5e54c519e1f686761faa53b5e9579c514a65332..fe040615ff03478a20cdf8376f89a6b7
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
try {
boolean execChunkTask = com.destroystokyo.paper.io.chunk.ChunkTaskManager.pollChunkWaitQueue() || ChunkProviderServer.this.world.asyncChunkTaskManager.pollNextChunkTask(); // Paper
if (ChunkProviderServer.this.tickDistanceManager()) {
return true;
} else {
- ChunkProviderServer.this.lightEngine.queueUpdate(); // Paper - not needed
+ ChunkProviderServer.this.lightEngine.queueUpdate(); // Paper - not needed // Tuinity - prevent queue overflow when no players are in this world
return super.executeNext() || execChunkTask; // Paper
}
} finally {
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index 37c9b5fd712e30a9a0faccc840f738f4b2cfc723..59989db6dcf96a8ab5a75775bb588c31cec3418a 100644
index 37c9b5fd712e30a9a0faccc840f738f4b2cfc723..62b95dcba8606330fbb3239e74c5eaf8baa3c51d 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -261,7 +261,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -11861,6 +11870,24 @@ index 37c9b5fd712e30a9a0faccc840f738f4b2cfc723..59989db6dcf96a8ab5a75775bb588c31
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
@@ -370,7 +370,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (blockposition1 != null) {
this.setPositionRotation(blockposition1, 0.0F, 0.0F);
- if (worldserver.getCubes(this)) {
+ if (!worldserver.collidesWithAnyBlockOrWorldBorder(this, this.getBoundingBox(), true, false)) { // Tuinity - make sure this is loaded
break;
}
}
@@ -378,7 +378,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} else {
this.setPositionRotation(blockposition, 0.0F, 0.0F);
- while (!worldserver.getCubes(this) && this.locY() < 255.0D) {
+ while (worldserver.collidesWithAnyBlockOrWorldBorder(this, this.getBoundingBox(), true, false) && this.locY() < 255.0D) { // Tuinity - make sure this is loaded
this.setPosition(this.locX(), this.locY() + 1.0D, this.locZ());
}
}
@@ -661,6 +661,185 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
@@ -12102,7 +12129,7 @@ index 4ee7070364a8989eece4fa4237b529926821f9c9..f22ab98d2e250081df8949be8a997370
this.a(Long.MAX_VALUE, i, j, flag);
}
diff --git a/src/main/java/net/minecraft/server/level/LightEngineThreaded.java b/src/main/java/net/minecraft/server/level/LightEngineThreaded.java
index 0b80569648c1df01aab52d0b8d47028cda925d86..381bd11075599d44e4c705a8e754769d29883d75 100644
index 0b80569648c1df01aab52d0b8d47028cda925d86..4d651cc21a9cb2fdeabff62d8978c3ec4abe2f68 100644
--- a/src/main/java/net/minecraft/server/level/LightEngineThreaded.java
+++ b/src/main/java/net/minecraft/server/level/LightEngineThreaded.java
@@ -2,6 +2,11 @@ package net.minecraft.server.level;
@@ -12131,7 +12158,7 @@ index 0b80569648c1df01aab52d0b8d47028cda925d86..381bd11075599d44e4c705a8e754769d
PlayerChunk playerChunk = playerChunkMap.getVisibleChunk(pair);
if (playerChunk == null) {
return false;
@@ -169,13 +175,218 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@@ -169,13 +175,184 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
private volatile int f = 5;
private final AtomicBoolean g = new AtomicBoolean();
@@ -12202,21 +12229,18 @@ index 0b80569648c1df01aab52d0b8d47028cda925d86..381bd11075599d44e4c705a8e754769d
+ this.queueUpdate();
+
+ return totalChunks;
+ }
+
}
+ protected final Long2IntOpenHashMap holdingChunks = new Long2IntOpenHashMap();
+ protected final LongArrayList postWorkTicketRelease = new LongArrayList();
+
+ private void addLightWorkTicket(int chunkX, int chunkZ) {
+ final long coordinate = net.minecraft.server.MCUtil.getCoordinateKey(chunkX, chunkZ);
+ final int current = this.holdingChunks.putIfAbsent(coordinate, 1);
+ final int current = this.holdingChunks.addTo(coordinate, 1);
+ if (current == 0) {
+ final ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(coordinate);
+ this.theLightEngine.getWorld().getChunkProvider().addTicketAtLevel(TicketType.LIGHT_UPDATE, chunkPos,
+ net.minecraft.server.MCUtil.getTicketLevelFor(ChunkStatus.LIGHT), chunkPos);
+ this.theLightEngine.getWorld().getChunkProvider().tickDistanceManager();
+ } else {
+ this.holdingChunks.put(coordinate, current + 1);
+ }
+ }
+
@@ -12240,45 +12264,14 @@ index 0b80569648c1df01aab52d0b8d47028cda925d86..381bd11075599d44e4c705a8e754769d
+
+ this.addLightWorkTicket(chunkX, chunkZ);
+
+ // light doesn't always load one radius neighbours...
+ // i.e if they get unloaded
+ boolean neighboursAtFeatures = true;
+ int targetNeighbourLevel = net.minecraft.server.MCUtil.getTicketLevelFor(ChunkStatus.LIGHT.getPreviousStatus());
+ for (int dx = -1; dx <= 1; ++dx) {
+ for (int dz = -1; dz <= 1; ++dz) {
+ PlayerChunk neighbour = chunkMap.getUpdatingChunk(net.minecraft.server.MCUtil.getCoordinateKey(dx + chunkX, dz + chunkZ));
+ ChunkStatus status;
+ if (neighbour == null || neighbour.getTicketLevel() > targetNeighbourLevel ||
+ (status = neighbour.getChunkHolderStatus()) == null ||
+ !status.isAtLeastStatus(ChunkStatus.LIGHT.getPreviousStatus())) {
+ neighboursAtFeatures = false;
+ break;
+ }
+ }
+ }
+
+ PlayerChunk playerChunk = chunkMap.getUpdatingChunk(net.minecraft.server.MCUtil.getCoordinateKey(chunkX, chunkZ));
+ ChunkStatus holderStatus;
+ if (!neighboursAtFeatures || playerChunk == null || playerChunk.getTicketLevel() > targetLevel ||
+ if (playerChunk == null || playerChunk.getTicketLevel() > targetLevel ||
+ (holderStatus = playerChunk.getChunkHolderStatus()) == null ||
+ !holderStatus.isAtLeastStatus(ChunkStatus.LIGHT)) {
+ CompletableFuture<IChunkAccess> ret = new CompletableFuture<>();
+
+ int[] loads = new int[1];
+ int requiredLoads = 3 * 3;
+ java.util.function.Consumer<IChunkAccess> onLoad = (chunk) -> {
+ if (++loads[0] == requiredLoads) {
+ ret.complete(this.getChunk(chunkX, chunkZ));
+ }
+ };
+
+ for (int dx = -1; dx <= 1; ++dx) {
+ for (int dz = -1; dz <= 1; ++dz) {
+ chunkProvider.getChunkAtAsynchronously(chunkX + dx, chunkZ + dz,
+ (dx | dz) == 0 ? ChunkStatus.LIGHT : ChunkStatus.LIGHT.getPreviousStatus(),
+ true, false, onLoad);
+ }
+ }
+ chunkProvider.getChunkAtAsynchronously(chunkX, chunkZ, ChunkStatus.LIGHT, true, false, ret::complete);
+
+ return ret;
+ }
@@ -12315,8 +12308,8 @@ index 0b80569648c1df01aab52d0b8d47028cda925d86..381bd11075599d44e4c705a8e754769d
+ });
+ }
+ }, this.playerChunkMap.mainInvokingExecutor);
}
+ }
+
+ // override things from superclass
+
+ @Override
@@ -12350,7 +12343,7 @@ index 0b80569648c1df01aab52d0b8d47028cda925d86..381bd11075599d44e4c705a8e754769d
public void close() {}
@Override
@@ -192,6 +403,15 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@@ -192,6 +369,15 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
public void a(BlockPosition blockposition) {
BlockPosition blockposition1 = blockposition.immutableCopy();
@@ -12366,7 +12359,7 @@ index 0b80569648c1df01aab52d0b8d47028cda925d86..381bd11075599d44e4c705a8e754769d
this.a(blockposition.getX() >> 4, blockposition.getZ() >> 4, LightEngineThreaded.Update.POST_UPDATE, SystemUtils.a(() -> {
super.a(blockposition1);
}, () -> {
@@ -200,6 +420,11 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@@ -200,6 +386,11 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
}
protected void a(ChunkCoordIntPair chunkcoordintpair) {
@@ -12378,7 +12371,7 @@ index 0b80569648c1df01aab52d0b8d47028cda925d86..381bd11075599d44e4c705a8e754769d
this.a(chunkcoordintpair.x, chunkcoordintpair.z, () -> {
return 0;
}, LightEngineThreaded.Update.PRE_UPDATE, SystemUtils.a(() -> {
@@ -224,6 +449,14 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@@ -224,6 +415,14 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@Override
public void a(SectionPosition sectionposition, boolean flag) {
@@ -12393,7 +12386,7 @@ index 0b80569648c1df01aab52d0b8d47028cda925d86..381bd11075599d44e4c705a8e754769d
this.a(sectionposition.a(), sectionposition.c(), () -> {
return 0;
}, LightEngineThreaded.Update.PRE_UPDATE, SystemUtils.a(() -> {
@@ -235,6 +468,11 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@@ -235,6 +434,11 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@Override
public void a(ChunkCoordIntPair chunkcoordintpair, boolean flag) {
@@ -12405,7 +12398,7 @@ index 0b80569648c1df01aab52d0b8d47028cda925d86..381bd11075599d44e4c705a8e754769d
this.a(chunkcoordintpair.x, chunkcoordintpair.z, LightEngineThreaded.Update.PRE_UPDATE, SystemUtils.a(() -> {
super.a(chunkcoordintpair, flag);
}, () -> {
@@ -244,6 +482,11 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@@ -244,6 +448,11 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@Override
public void a(EnumSkyBlock enumskyblock, SectionPosition sectionposition, @Nullable NibbleArray nibblearray, boolean flag) {
@@ -12417,7 +12410,7 @@ index 0b80569648c1df01aab52d0b8d47028cda925d86..381bd11075599d44e4c705a8e754769d
this.a(sectionposition.a(), sectionposition.c(), () -> {
return 0;
}, LightEngineThreaded.Update.PRE_UPDATE, SystemUtils.a(() -> {
@@ -253,6 +496,7 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@@ -253,6 +462,7 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
}));
}
@@ -12425,7 +12418,7 @@ index 0b80569648c1df01aab52d0b8d47028cda925d86..381bd11075599d44e4c705a8e754769d
private void a(int i, int j, LightEngineThreaded.Update lightenginethreaded_update, Runnable runnable) {
this.a(i, j, this.d.c(ChunkCoordIntPair.pair(i, j)), lightenginethreaded_update, runnable);
}
@@ -265,6 +509,11 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@@ -265,6 +475,11 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@Override
public void b(ChunkCoordIntPair chunkcoordintpair, boolean flag) {
@@ -12437,7 +12430,7 @@ index 0b80569648c1df01aab52d0b8d47028cda925d86..381bd11075599d44e4c705a8e754769d
this.a(chunkcoordintpair.x, chunkcoordintpair.z, () -> {
return 0;
}, LightEngineThreaded.Update.PRE_UPDATE, SystemUtils.a(() -> {
@@ -277,6 +526,35 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@@ -277,6 +492,35 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
public CompletableFuture<IChunkAccess> a(IChunkAccess ichunkaccess, boolean flag) {
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
@@ -12473,7 +12466,7 @@ index 0b80569648c1df01aab52d0b8d47028cda925d86..381bd11075599d44e4c705a8e754769d
// Paper start
//ichunkaccess.b(false); // Don't need to disable this
long pair = chunkcoordintpair.pair();
@@ -324,7 +602,7 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@@ -324,7 +568,7 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
}
public void queueUpdate() {
@@ -12482,7 +12475,7 @@ index 0b80569648c1df01aab52d0b8d47028cda925d86..381bd11075599d44e4c705a8e754769d
this.b.a((() -> { // Paper - decompile error
this.b();
this.g.set(false);
@@ -338,17 +616,36 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@@ -338,17 +582,36 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
private final java.util.List<Runnable> pre = new java.util.ArrayList<>();
private final java.util.List<Runnable> post = new java.util.ArrayList<>();
private void b() {
@@ -13672,7 +13665,7 @@ index 3c804c7b20a14ea6e510810e2be10c1cc89ff5c1..3738c51b5e673c439d88a7ef7f4614f3
return new TicketType<>(s, comparator, 0L);
}
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index ef9b08df58d9d28df6b8ade076d95bf7e5cb1b18..46baad407de5598ecb23fcbb9a3fb4ee82addb17 100644
index ef9b08df58d9d28df6b8ade076d95bf7e5cb1b18..fcf9af44702f34d75185eee0b3259fe0e57001b1 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -168,12 +168,13 @@ import org.bukkit.event.server.MapInitializeEvent;
@@ -14153,7 +14146,7 @@ index ef9b08df58d9d28df6b8ade076d95bf7e5cb1b18..46baad407de5598ecb23fcbb9a3fb4ee
+ @Override
+ public boolean getCubes(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate<Entity> predicate) {
+ if (entity instanceof net.minecraft.world.entity.decoration.EntityArmorStand && !entity.world.paperConfig.armorStandEntityLookups) return false;
+ return !this.collidesWithAnyBlockOrWorldBorder(entity, axisalignedbb, true, true) && !this.hardCollidesWithAnyEntities(entity, axisalignedbb, predicate);
+ return !this.collidesWithAnyBlockOrWorldBorder(entity, axisalignedbb, false, false) && !this.hardCollidesWithAnyEntities(entity, axisalignedbb, predicate);
+ }
+ // Tuinity end - optimise collision
+
@@ -14651,10 +14644,23 @@ index 185667110cd6f566b23546728d20fc79223f3c92..dc98ef48a664d9ee2a302fff8c611fd1
throw new IllegalStateException("Protocol error", cryptographyexception);
}
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
index e6ea84ba098b4d77bc68e99862992a10ef4585b5..40a7f69e5e14078977ef615abf3a0f1f61d76f9f 100644
index e6ea84ba098b4d77bc68e99862992a10ef4585b5..83ad913e46f44aabb41b7e441cba2ef2f7bcbc46 100644
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
@@ -568,7 +568,9 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -540,6 +540,12 @@ public class PlayerConnection implements PacketListenerPlayIn {
double currDeltaZ = toZ - fromZ;
double d10 = Math.max(d6 * d6 + d7 * d7 + d8 * d8, (currDeltaX * currDeltaX + currDeltaY * currDeltaY + currDeltaZ * currDeltaZ) - 1);
// Paper end - fix large move vectors killing the server
+ // Tuinity start - fix large move vectors killing the server
+ double otherFieldX = d3 - this.v;
+ double otherFieldY = d4 - this.w - 1.0E-6D;
+ double otherFieldZ = d5 - this.x;
+ d10 = Math.max(d10, (otherFieldX * otherFieldX + otherFieldY * otherFieldY + otherFieldZ * otherFieldZ) - 1);
+ // Tuinity end - fix large move vectors killing the server
// CraftBukkit start - handle custom speeds and skipped ticks
@@ -568,7 +574,9 @@ public class PlayerConnection implements PacketListenerPlayIn {
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
// Paper start - Prevent moving into unloaded chunks
@@ -14665,7 +14671,7 @@ index e6ea84ba098b4d77bc68e99862992a10ef4585b5..40a7f69e5e14078977ef615abf3a0f1f
this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
return;
}
@@ -581,12 +583,14 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -581,12 +589,14 @@ public class PlayerConnection implements PacketListenerPlayIn {
return;
}
@@ -14673,15 +14679,18 @@ index e6ea84ba098b4d77bc68e99862992a10ef4585b5..40a7f69e5e14078977ef615abf3a0f1f
+ //boolean flag = worldserver.getCubes(entity, entity.getBoundingBox().shrink(0.0625D)); // Tuinity - replace with different checks
+ AxisAlignedBB oldBox = entity.getBoundingBox(); // Tuinity - copy from player movement packet
d6 = d3 - this.v;
d7 = d4 - this.w - 1.0E-6D;
d8 = d5 - this.x;
- d6 = d3 - this.v;
- d7 = d4 - this.w - 1.0E-6D;
- d8 = d5 - this.x;
+ d6 = d3 - this.v; // Tuinity - diff on change, used for checking large move vectors above
+ d7 = d4 - this.w - 1.0E-6D; // Tuinity - diff on change, used for checking large move vectors above
+ d8 = d5 - this.x; // Tuinity - diff on change, used for checking large move vectors above
entity.move(EnumMoveType.PLAYER, new Vec3D(d6, d7, d8));
+ boolean didCollide = toX != entity.locX() || toY != entity.locY() || toZ != entity.locZ(); // Tuinity - needed here as the difference in Y can be reset - also note: this is only a guess at whether collisions took place, floating point errors can make this true when it shouldn't be...
double d11 = d7;
d6 = d3 - entity.locX();
@@ -600,16 +604,25 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -600,16 +610,25 @@ public class PlayerConnection implements PacketListenerPlayIn {
boolean flag1 = false;
if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot
@@ -14711,7 +14720,7 @@ index e6ea84ba098b4d77bc68e99862992a10ef4585b5..40a7f69e5e14078977ef615abf3a0f1f
entity.setLocation(d0, d1, d2, f, f1);
player.setLocation(d0, d1, d2, this.player.yaw, this.player.pitch); // CraftBukkit
this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
@@ -695,7 +708,32 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -695,7 +714,32 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
private boolean a(Entity entity) {
@@ -14745,7 +14754,7 @@ index e6ea84ba098b4d77bc68e99862992a10ef4585b5..40a7f69e5e14078977ef615abf3a0f1f
}
@Override
@@ -1217,7 +1255,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1217,7 +1261,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
if (this.teleportPos != null) {
@@ -14754,7 +14763,20 @@ index e6ea84ba098b4d77bc68e99862992a10ef4585b5..40a7f69e5e14078977ef615abf3a0f1f
this.A = this.e;
this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
}
@@ -1287,7 +1325,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1255,6 +1299,12 @@ public class PlayerConnection implements PacketListenerPlayIn {
double currDeltaZ = toZ - prevZ;
double d11 = Math.max(d7 * d7 + d8 * d8 + d9 * d9, (currDeltaX * currDeltaX + currDeltaY * currDeltaY + currDeltaZ * currDeltaZ) - 1);
// Paper end - fix large move vectors killing the server
+ // Tuinity start - fix large move vectors killing the server
+ double otherFieldX = d4 - this.o;
+ double otherFieldY = d5 - this.p;
+ double otherFieldZ = d6 - this.q;
+ d11 = Math.max(d11, (otherFieldX * otherFieldX + otherFieldY * otherFieldY + otherFieldZ * otherFieldZ) - 1);
+ // Tuinity end - fix large move vectors killing the server
if (this.player.isSleeping()) {
if (d11 > 1.0D) {
@@ -1287,7 +1337,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
speed = player.abilities.walkSpeed * 10f;
}
// Paper start - Prevent moving into unloaded chunks
@@ -14763,16 +14785,23 @@ index e6ea84ba098b4d77bc68e99862992a10ef4585b5..40a7f69e5e14078977ef615abf3a0f1f
this.internalTeleport(this.player.locX(), this.player.locY(), this.player.locZ(), this.player.yaw, this.player.pitch, Collections.emptySet());
return;
}
@@ -1304,7 +1342,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1304,11 +1354,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
}
- AxisAlignedBB axisalignedbb = this.player.getBoundingBox();
+ AxisAlignedBB axisalignedbb = this.player.getBoundingBox(); // Tuinity - diff on change, should be old AABB
d7 = d4 - this.o;
d8 = d5 - this.p;
@@ -1343,6 +1381,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
- d7 = d4 - this.o;
- d8 = d5 - this.p;
- d9 = d6 - this.q;
+ d7 = d4 - this.o; // Tuinity - diff on change, used for checking large move vectors above
+ d8 = d5 - this.p; // Tuinity - diff on change, used for checking large move vectors above
+ d9 = d6 - this.q; // Tuinity - diff on change, used for checking large move vectors above
boolean flag = d8 > 0.0D;
if (this.player.isOnGround() && !packetplayinflying.b() && flag) {
@@ -1343,6 +1393,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
@@ -14780,7 +14809,7 @@ index e6ea84ba098b4d77bc68e99862992a10ef4585b5..40a7f69e5e14078977ef615abf3a0f1f
this.player.setOnGround(packetplayinflying.b()); // CraftBukkit - SPIGOT-5810, SPIGOT-5835: reset by this.player.move
// Paper start - prevent position desync
if (this.teleportPos != null) {
@@ -1362,12 +1401,23 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1362,12 +1413,23 @@ public class PlayerConnection implements PacketListenerPlayIn {
boolean flag1 = false;
if (!this.player.H() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative() && this.player.playerInteractManager.getGameMode() != EnumGamemode.SPECTATOR) { // Spigot
@@ -14806,7 +14835,7 @@ index e6ea84ba098b4d77bc68e99862992a10ef4585b5..40a7f69e5e14078977ef615abf3a0f1f
this.a(d0, d1, d2, f, f1);
} else {
// CraftBukkit start - fire PlayerMoveEvent
@@ -1454,6 +1504,26 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1454,6 +1516,26 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
}
@@ -14850,7 +14879,7 @@ index dc362724ea0cc1b2f9d9ceffff483217b4356c40..70fde7bad2e0a6d7432d8509fdb7c46d
protected void initChannel(Channel channel) throws Exception {
try {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 2df8e914f66176e22aeddf8b94a83af5ea921d88..499b516330f3f3a48fb64802f2e8c1b7c9684f4d 100644
index 2df8e914f66176e22aeddf8b94a83af5ea921d88..0b5cf23932c3c626d8805d4db97d2bbab63634cf 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -179,6 +179,7 @@ public abstract class PlayerList {
@@ -14879,7 +14908,14 @@ index 2df8e914f66176e22aeddf8b94a83af5ea921d88..499b516330f3f3a48fb64802f2e8c1b7
Player player = entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.networkManager.getRawAddress()).getAddress());
@@ -949,7 +950,7 @@ public abstract class PlayerList {
@@ -943,13 +944,13 @@ public abstract class PlayerList {
worldserver1.getChunkProvider().addTicket(TicketType.POST_TELEPORT, new ChunkCoordIntPair(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper
entityplayer1.forceCheckHighPriority(); // Player
- while (avoidSuffocation && !worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) {
+ while (avoidSuffocation && worldserver1.collidesWithAnyBlockOrWorldBorder(entityplayer1, entityplayer1.getBoundingBox(), true, false) && entityplayer1.locY() < 256.0D) { // Tuinity - make sure this is loaded
entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ());
}
// CraftBukkit start
WorldData worlddata = worldserver1.getWorldData();
entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), BiomeManager.a(worldserver1.getSeed()), entityplayer1.playerInteractManager.getGameMode(), entityplayer1.playerInteractManager.c(), worldserver1.isDebugWorld(), worldserver1.isFlatWorld(), flag));
@@ -18615,10 +18651,10 @@ index 4eaf497d048324a85ce49fc1c6e9559991c20df7..ec2b238480413ba9c123d9ddeaa787d9
BiomeStorage biomestorage = ichunkaccess.getBiomeIndex();
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java
index 890362d28ab9cb760c73fe5014e144fb08ada6b8..3c532d3996dfc734ec07181701280b6072bff55f 100644
index 890362d28ab9cb760c73fe5014e144fb08ada6b8..21c8530c77161b5f8cfd0bae3126c8fd394dcae2 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java
@@ -39,7 +39,7 @@ public class IChunkLoader implements AutoCloseable {
@@ -39,13 +39,14 @@ public class IChunkLoader implements AutoCloseable {
public final RegionFileCache regionFileCache;
public IChunkLoader(File file, DataFixer datafixer, boolean flag) {
@@ -18627,6 +18663,13 @@ index 890362d28ab9cb760c73fe5014e144fb08ada6b8..3c532d3996dfc734ec07181701280b60
this.b = datafixer;
// Paper - nuke IOWorker
}
// CraftBukkit start
private boolean check(ChunkProviderServer cps, int x, int z) throws IOException {
+ if (true) return false; // Tuinity - this isn't even needed anymore, light is purged updating to 1.14+, why are we holding up the conversion process reading chunk data off disk
ChunkCoordIntPair pos = new ChunkCoordIntPair(x, z);
if (cps != null) {
//com.google.common.base.Preconditions.checkState(org.bukkit.Bukkit.isPrimaryThread(), "primary thread"); // Paper - this function is now MT-Safe
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index 1b0535ba211904b2384cc80c02c21ed1a606e752..7cdac33e153ccba0a7e8b5aa8fbcbb58ade6a9d2 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -19542,6 +19585,24 @@ index bcb620e9b7f47341f51af0f3bb7fbd6a348f9739..79214a93c533839d0c560a1e4f5904c6
this.h = s;
this.i = heightmap_use;
this.j = predicate;
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java
index 9b82ff37faaafc3a799413f6949fb88a993aa9a0..13983f3271d33ab6e4c7030de5865edbd7b0cd8a 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java
@@ -374,7 +374,13 @@ public class DefinedStructure {
if (pair1.getSecond() != null) {
tileentity = worldaccess.getTileEntity(blockposition3);
if (tileentity != null) {
+ // Tuinity start - do not update TE's in generating chunks, it might cause a deadlock
+ if (!(worldaccess instanceof World)) {
+ tileentity.invalidateBlockCache();
+ } else {
+ // Tuinity end - do not update TE's in generating chunks, it might cause a deadlock
tileentity.update();
+ } // Tuinity - do not update TE's in generating chunks, it might cause a deadlock
}
}
}
diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java
index fc0162e7f543d230277457638f208a66537560d7..3825a3ddea21e7dd14c455daac1a6af5b0871e00 100644
--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java
@@ -20367,7 +20428,7 @@ index 03b8d67a5f0088c0254b2099f27e8dcae32a6221..fd3333fef4112e6469ccd316ba2c8292
public void restart() {
org.spigotmc.RestartCommand.restart();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index e739b4f8a7b8785ceb11c553bd27e2fe0e64a4bb..b393490231ea00af15d883336a07de6cca642195 100644
index 62513d3acb930c4c9fa3d875a1fc94bb4d948951..91005e112950d79e1120e5595570970b94cd3c67 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -342,6 +342,14 @@ public class CraftWorld implements World {
@@ -20440,7 +20501,7 @@ index e739b4f8a7b8785ceb11c553bd27e2fe0e64a4bb..b393490231ea00af15d883336a07de6c
@Override
public boolean isChunkForceLoaded(int x, int z) {
return getHandle().getForceLoadedChunks().contains(ChunkCoordIntPair.pair(x, z));
@@ -2586,7 +2612,7 @@ public class CraftWorld implements World {
@@ -2587,7 +2613,7 @@ public class CraftWorld implements World {
}
return this.world.getChunkProvider().getChunkAtAsynchronously(x, z, gen, urgent).thenComposeAsync((either) -> {
net.minecraft.world.level.chunk.Chunk chunk = (net.minecraft.world.level.chunk.Chunk) either.left().orElse(null);
@@ -20449,7 +20510,7 @@ index e739b4f8a7b8785ceb11c553bd27e2fe0e64a4bb..b393490231ea00af15d883336a07de6c
return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk());
}, net.minecraft.server.MinecraftServer.getServer());
}
@@ -2611,14 +2637,14 @@ public class CraftWorld implements World {
@@ -2612,14 +2638,14 @@ public class CraftWorld implements World {
throw new IllegalArgumentException("View distance " + viewDistance + " is out of range of [2, 32]");
}
PlayerChunkMap chunkMap = getHandle().getChunkProvider().playerChunkMap;
@@ -20466,7 +20527,7 @@ index e739b4f8a7b8785ceb11c553bd27e2fe0e64a4bb..b393490231ea00af15d883336a07de6c
}
@Override
@@ -2627,11 +2653,22 @@ public class CraftWorld implements World {
@@ -2628,11 +2654,22 @@ public class CraftWorld implements World {
throw new IllegalArgumentException("View distance " + viewDistance + " is out of range of [2, 32]");
}
PlayerChunkMap chunkMap = getHandle().getChunkProvider().playerChunkMap;
@@ -20491,7 +20552,7 @@ index e739b4f8a7b8785ceb11c553bd27e2fe0e64a4bb..b393490231ea00af15d883336a07de6c
// Spigot start
private final org.bukkit.World.Spigot spigot = new org.bukkit.World.Spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 23389d0a0e7bd8aeb2f1ab0ea6a149ef99e800fb..2774abda3dd1390ae904bf2b177bdd0f11968f40 100644
index 154f3a6a3d37b94c40cb29c305e3aa5fb494850c..145748b5ca095cd555fd1f085a596bf0f58fea13 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -140,6 +140,13 @@ public class Main {
@@ -20508,7 +20569,7 @@ index 23389d0a0e7bd8aeb2f1ab0ea6a149ef99e800fb..2774abda3dd1390ae904bf2b177bdd0f
// Paper start
acceptsAll(asList("server-name"), "Name of the server")
@@ -254,7 +261,7 @@ public class Main {
@@ -253,7 +260,7 @@ public class Main {
if (buildDate.before(deadline.getTime())) {
// Paper start - This is some stupid bullshit
System.err.println("*** Warning, you've not updated in a while! ***");