Skip to content

Commit e7445e1

Browse files
authored
Prevent ticking virtual world borders multiple times per server tick (#13513)
1 parent 0bd2eca commit e7445e1

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

paper-server/patches/sources/net/minecraft/world/level/border/WorldBorder.java.patch

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
--- a/net/minecraft/world/level/border/WorldBorder.java
22
+++ b/net/minecraft/world/level/border/WorldBorder.java
3-
@@ -33,6 +_,7 @@
3+
@@ -33,6 +_,8 @@
44
double centerZ;
55
int absoluteMaxSize = 29999984;
66
WorldBorder.BorderExtent extent = new WorldBorder.StaticBorderExtent(5.999997E7F);
77
+ public net.minecraft.server.level.@org.jspecify.annotations.Nullable ServerLevel world; // CraftBukkit
8+
+ private int lastTick = -1; // Paper - Prevent ticking virtual world borders multiple times per server tick
89

910
public WorldBorder() {
1011
this(WorldBorder.Settings.DEFAULT);
@@ -91,6 +92,19 @@
9192
this.listeners.add(listener);
9293
}
9394

95+
@@ -278,6 +_,12 @@
96+
}
97+
98+
public void tick() {
99+
+ // Paper start - Prevent ticking virtual world borders multiple times per server tick
100+
+ if (this.lastTick == net.minecraft.server.MinecraftServer.currentTick) {
101+
+ return;
102+
+ }
103+
+ this.lastTick = net.minecraft.server.MinecraftServer.currentTick;
104+
+ // Paper end - Prevent ticking virtual world borders multiple times per server tick
105+
this.extent = this.extent.update();
106+
}
107+
94108
@@ -298,6 +_,22 @@
95109
}
96110
}

0 commit comments

Comments
 (0)