mirror of
https://github.com/PaperMC/Folia.git
synced 2024-11-10 10:19:30 +01:00
6928284a56
The region shift is configurable under `grid-exponent`, which allows setting the region shift to any value in [0, 31]. Note that values above 6 affect the lock shift, as the lock shift currently is computed as max(ticket shift = 6, region shift). The shift is left configurable for now as the lower default shift of 2 may have negative performance impacts. The default region shift has been adjusted to 2 from 4, and the empty chunk buffer has been reduced to 8 from 16. These changes reduce, but do not eliminate, player spread requirements. The previous block range was around ~1500 blocks at VD = 10, but is now closer to ~900 blocks at VD = 10. This roughly reduces the area that each player uses in the regioniser by 2.5x.
40 lines
1.8 KiB
Diff
40 lines
1.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Sun, 23 Apr 2023 07:38:50 -0700
|
|
Subject: [PATCH] Skip worldstate access when waking players up during data
|
|
deserialization
|
|
|
|
In general, worldstate read/write is unacceptable during
|
|
data deserialization and is racey even in Vanilla. But in Folia,
|
|
some accesses may throw and as such we need to fix this directly.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
index e479129a977721fc8061be968eefab4daa407f5c..3d2b059254fdc08d1e4f9281946028a46884d7c8 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -644,7 +644,7 @@ public class ServerPlayer extends Player {
|
|
this.getBukkitEntity().readExtraData(nbt); // CraftBukkit
|
|
|
|
if (this.isSleeping()) {
|
|
- this.stopSleeping();
|
|
+ this.stopSleepingRaw(); // Folia - do not modify or read worldstate during data deserialization
|
|
}
|
|
|
|
// CraftBukkit start
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index 46b835f65ec64720efa54cc524f16a3fa536e90b..abf455d165004240e0b5fd96543f7da7c520e729 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -4360,6 +4360,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
}
|
|
|
|
});
|
|
+ // Folia start - separate out
|
|
+ this.stopSleepingRaw();
|
|
+ }
|
|
+ public void stopSleepingRaw() {
|
|
+ // Folia end - separate out
|
|
Vec3 vec3d = this.position();
|
|
|
|
this.setPose(Pose.STANDING);
|