Properly check water block when random ticking ice (#9804)

Readds a lost update to the shared mutable state in the random block
ticking optimisation.
This commit is contained in:
Bjarne Koll 2023-10-06 22:34:00 +02:00 committed by GitHub
parent 08c0b488b9
commit 29a0209575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 26 additions and 25 deletions

View File

@ -90,7 +90,7 @@ index 0000000000000000000000000000000000000000..7d93652c1abbb6aee6eb7c26cf35d4d0
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 5c39bf8a3975e632a4f41938306d9b2eb77f335d..5478b17a00c34c927455dddf804c4d4fbba7e7a9 100644 index 5c39bf8a3975e632a4f41938306d9b2eb77f335d..ab2ba79aa6ef36a86173e47abdac71a115693d02 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -839,6 +839,10 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -839,6 +839,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -116,7 +116,7 @@ index 5c39bf8a3975e632a4f41938306d9b2eb77f335d..5478b17a00c34c927455dddf804c4d4f
if (this.isRainingAt(blockposition)) { if (this.isRainingAt(blockposition)) {
DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition);
@@ -881,61 +887,67 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -881,61 +887,68 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!this.paperConfig().environment.disableIceAndSnow) { // Paper if (!this.paperConfig().environment.disableIceAndSnow) { // Paper
for (int l = 0; l < randomTickSpeed; ++l) { for (int l = 0; l < randomTickSpeed; ++l) {
if (this.random.nextInt(48) == 0) { if (this.random.nextInt(48) == 0) {
@ -202,6 +202,7 @@ index 5c39bf8a3975e632a4f41938306d9b2eb77f335d..5478b17a00c34c927455dddf804c4d4f
- if (biomebase.shouldFreeze(this, blockposition2)) { - if (biomebase.shouldFreeze(this, blockposition2)) {
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition2, Blocks.ICE.defaultBlockState(), null); // CraftBukkit - org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition2, Blocks.ICE.defaultBlockState(), null); // CraftBukkit
+ blockposition1.setY(downY);
+ if (biomebase.shouldFreeze(this, blockposition1)) { + if (biomebase.shouldFreeze(this, blockposition1)) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.ICE.defaultBlockState(), null); // CraftBukkit + org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.ICE.defaultBlockState(), null); // CraftBukkit
} }
@ -214,7 +215,7 @@ index 5c39bf8a3975e632a4f41938306d9b2eb77f335d..5478b17a00c34c927455dddf804c4d4f
if (i > 0 && biomebase.shouldSnow(this, blockposition1)) { if (i > 0 && biomebase.shouldSnow(this, blockposition1)) {
BlockState iblockdata = this.getBlockState(blockposition1); BlockState iblockdata = this.getBlockState(blockposition1);
@@ -953,12 +965,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -953,12 +966,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
} }

View File

@ -76,10 +76,10 @@ index 047fc7206131e0f36ab45d04e98b7a235431e342..6ac03dee902051a26493dba468d6a2f5
}); });
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD; throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 5478b17a00c34c927455dddf804c4d4fbba7e7a9..bf0a263ca5cde88479b475fc3e8377a72b1834d9 100644 index ab2ba79aa6ef36a86173e47abdac71a115693d02..08027ef81e46a6346b2acedd82f66ffc2297559d 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1215,7 +1215,26 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1216,7 +1216,26 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
@ -106,7 +106,7 @@ index 5478b17a00c34c927455dddf804c4d4fbba7e7a9..bf0a263ca5cde88479b475fc3e8377a7
++TimingHistory.entityTicks; // Paper - timings ++TimingHistory.entityTicks; // Paper - timings
// Spigot start // Spigot start
co.aikar.timings.Timing timer; // Paper co.aikar.timings.Timing timer; // Paper
@@ -1255,7 +1274,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1256,7 +1275,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(entity, entity1); this.tickPassenger(entity, entity1);
} }
// } finally { timer.stopTiming(); } // Paper - timings - move up // } finally { timer.stopTiming(); } // Paper - timings - move up

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index bf0a263ca5cde88479b475fc3e8377a72b1834d9..0b069e495d9f0523ee2ce5f2124d9f9ffd436625 100644 index 08027ef81e46a6346b2acedd82f66ffc2297559d..b0d8d28aa4a5cd95671a90e3f9981c532726b8ca 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2641,6 +2641,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2642,6 +2642,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot end // Spigot end
// Spigot Start // Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message

View File

@ -23,10 +23,10 @@ index ff99336e0b8131ae161cfa5c4fc83c6905e3dbc8..5f43aedc6596e2b1ac7af97115157147
} }
}); });
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0b069e495d9f0523ee2ce5f2124d9f9ffd436625..da003497b56a729cfed1ff58c0d00987ce0ebd16 100644 index b0d8d28aa4a5cd95671a90e3f9981c532726b8ca..b59ecc3571234a6168f9ba235e5acbfa733c0512 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2551,6 +2551,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2552,6 +2552,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
public void onTickingStart(Entity entity) { public void onTickingStart(Entity entity) {

View File

@ -2008,7 +2008,7 @@ index 0000000000000000000000000000000000000000..33cd90c30c22200a4e1ae64f40a0bf78
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index da003497b56a729cfed1ff58c0d00987ce0ebd16..e70d6a446f33c266e6117467c69bc404fd23304b 100644 index b59ecc3571234a6168f9ba235e5acbfa733c0512..64a3b789a46438dcd01a5429dcab641467cf5f00 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -222,6 +222,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -222,6 +222,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -2019,7 +2019,7 @@ index da003497b56a729cfed1ff58c0d00987ce0ebd16..e70d6a446f33c266e6117467c69bc404
public static Throwable getAddToWorldStackTrace(Entity entity) { public static Throwable getAddToWorldStackTrace(Entity entity) {
final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date()); final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr); io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr);
@@ -2540,6 +2541,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2541,6 +2542,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
return this.randomSequences; return this.randomSequences;
} }

View File

@ -7,10 +7,10 @@ The previous solution caused a bunch of bandaid fixes inorder to resolve edge ca
Just simply prevent them from being added to the world instead. Just simply prevent them from being added to the world instead.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e70d6a446f33c266e6117467c69bc404fd23304b..ca28be4a2f11a04cbc6555dc7e2eb8ef7aeb8f4e 100644 index 64a3b789a46438dcd01a5429dcab641467cf5f00..d79b354e6723450223e106d19f20aa096ec7a02a 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1558,6 +1558,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1559,6 +1559,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
return false; return false;
} else { } else {

View File

@ -124,10 +124,10 @@ index c16e84ee54bf2a65d8bd41f8156b7a4edee5e941..d7dcffde09e099ee2554ec201f553ee0
return this.anyPlayerCloseEnoughForSpawning(pos, false); return this.anyPlayerCloseEnoughForSpawning(pos, false);
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index ca28be4a2f11a04cbc6555dc7e2eb8ef7aeb8f4e..4686600b3fea6c7800c7746fa47acab6c90540a2 100644 index d79b354e6723450223e106d19f20aa096ec7a02a..67b4bba742cfd1eacc1ac3f230e78874efbb10cc 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1004,7 +1004,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1005,7 +1005,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
} else { } else {
AABB axisalignedbb = (new AABB(blockposition1, new BlockPos(blockposition1.getX(), this.getMaxBuildHeight(), blockposition1.getZ()))).inflate(3.0D); AABB axisalignedbb = (new AABB(blockposition1, new BlockPos(blockposition1.getX(), this.getMaxBuildHeight(), blockposition1.getZ()))).inflate(3.0D);
List<LivingEntity> list = this.getEntitiesOfClass(LivingEntity.class, axisalignedbb, (entityliving) -> { List<LivingEntity> list = this.getEntitiesOfClass(LivingEntity.class, axisalignedbb, (entityliving) -> {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Remove unnecessary onTrackingStart during navigation warning
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 4686600b3fea6c7800c7746fa47acab6c90540a2..26888d5bdfe16a8c69d757b134d9e4e1978cc7ba 100644 index 67b4bba742cfd1eacc1ac3f230e78874efbb10cc..5803f7b286cd262a8f79d0adb159d897361275a2 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2587,7 +2587,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2588,7 +2588,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (entity instanceof Mob) { if (entity instanceof Mob) {
Mob entityinsentient = (Mob) entity; Mob entityinsentient = (Mob) entity;
@ -17,7 +17,7 @@ index 4686600b3fea6c7800c7746fa47acab6c90540a2..26888d5bdfe16a8c69d757b134d9e4e1
String s = "onTrackingStart called during navigation iteration"; String s = "onTrackingStart called during navigation iteration";
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration")); Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));
@@ -2672,7 +2672,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2673,7 +2673,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (entity instanceof Mob) { if (entity instanceof Mob) {
Mob entityinsentient = (Mob) entity; Mob entityinsentient = (Mob) entity;

View File

@ -7,10 +7,10 @@ Makes certain entities check all players when searching for a player
instead of just checking players in their world. instead of just checking players in their world.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 26888d5bdfe16a8c69d757b134d9e4e1978cc7ba..eae08569a3e338641740bf1ca8e92bc8e8455cdd 100644 index 5803f7b286cd262a8f79d0adb159d897361275a2..42f0ea87dd0bb3be3fbe9e0f7d87582cd3cd7c97 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2709,4 +2709,12 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2710,4 +2710,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.updateDynamicGameEventListener(DynamicGameEventListener::move); entity.updateDynamicGameEventListener(DynamicGameEventListener::move);
} }
} }

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent GameEvents being fired from unloaded chunks
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index eae08569a3e338641740bf1ca8e92bc8e8455cdd..a35b98e92a8afaa1d61e86a614466e64ef6e948f 100644 index 42f0ea87dd0bb3be3fbe9e0f7d87582cd3cd7c97..2858fe182e617429f7dcbd7b5d2d2f5df722d5bb 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1695,6 +1695,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1696,6 +1696,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override @Override
public void gameEvent(GameEvent event, Vec3 emitterPos, GameEvent.Context emitter) { public void gameEvent(GameEvent event, Vec3 emitterPos, GameEvent.Context emitter) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix missing map initialize event call
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f502b01b564bd33c449cbe621966ef4076a38cca..51d282b524b5249438f7744f7f0b1cc27b76470e 100644 index 2f2ca1c6d0b329521c4545015a878418870216f0..17610196db7a1c6feb2cf74a02479a8691aa323f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2099,7 +2099,23 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2100,7 +2100,23 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Nullable @Nullable
@Override @Override
public MapItemSavedData getMapData(String id) { public MapItemSavedData getMapData(String id) {