Remove wall-time / unused skip tick protection (#11412)
Spigot still maintains some partial implementation of "tick skipping", a practice in which the MinecraftServer.currentTick field is updated not by an increment of one per actual tick, but instead set to System.currentTimeMillis() / 50. This behaviour means that the tracked tick may "skip" a tick value in case a previous tick took more than the expected 50ms. To compensate for this in important paths, spigot/craftbukkit implements "wall-time". Instead of incrementing/decrementing ticks on block entities/entities by one for each call to their tick() method, they instead increment/decrement important values, like an ItemEntity's age or pickupDelay, by the difference of `currentTick - lastTick`, where `lastTick` is the value of `currentTick` during the last tick() call. These "fixes" however do not play nicely with minecraft's simulation distance as entities/block entities implementing the above behaviour would "catch up" their values when moving from a non-ticking chunk to a ticking one as their `lastTick` value remains stuck on the last tick in a ticking chunk and hence lead to a large "catch up" once ticked again. Paper completely removes the "tick skipping" behaviour (See patch "Further-improve-server-tick-loop"), making the above precautions completely unnecessary, which also rids paper of the previous described incompatibility with non-ticking chunks.
This commit is contained in:
parent
5c82955733
commit
c5a10665b8
794 changed files with 402 additions and 282 deletions
57
patches/server/0516-More-World-API.patch
Normal file
57
patches/server/0516-More-World-API.patch
Normal file
|
@ -0,0 +1,57 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Tue, 7 Jul 2020 10:52:34 -0700
|
||||
Subject: [PATCH] More World API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 08124dd65d1f950bdec8fcb55d2553c601b30a66..c3581aa9a2d708e410c7eae1b7abe6c6f3427ad6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -2130,6 +2130,28 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
return new CraftStructureSearchResult(CraftStructure.minecraftToBukkit(found.getSecond().value()), CraftLocation.toBukkit(found.getFirst(), this));
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public double getCoordinateScale() {
|
||||
+ return getHandle().dimensionType().coordinateScale();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isFixedTime() {
|
||||
+ return getHandle().dimensionType().hasFixedTime();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Collection<org.bukkit.Material> getInfiniburn() {
|
||||
+ return com.google.common.collect.Sets.newHashSet(com.google.common.collect.Iterators.transform(net.minecraft.core.registries.BuiltInRegistries.BLOCK.getTagOrEmpty(this.getHandle().dimensionType().infiniburn()).iterator(), blockHolder -> CraftBlockType.minecraftToBukkit(blockHolder.value())));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendGameEvent(Entity sourceEntity, org.bukkit.GameEvent gameEvent, Vector position) {
|
||||
+ getHandle().gameEvent(sourceEntity != null ? ((CraftEntity) sourceEntity).getHandle(): null, net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT.getHolder(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(gameEvent.getKey())).orElseThrow(), org.bukkit.craftbukkit.util.CraftVector.toBlockPos(position));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public BiomeSearchResult locateNearestBiome(Location origin, int radius, Biome... biomes) {
|
||||
return this.locateNearestBiome(origin, radius, 32, 64, biomes);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java b/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java
|
||||
index 3071ac1ac0e733d73dade49597a39f7d156bbc04..967445b2eb158454100a27369a1f463d69f54f27 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java
|
||||
@@ -12,4 +12,13 @@ public final class CraftVector {
|
||||
public static net.minecraft.world.phys.Vec3 toNMS(org.bukkit.util.Vector bukkit) {
|
||||
return new net.minecraft.world.phys.Vec3(bukkit.getX(), bukkit.getY(), bukkit.getZ());
|
||||
}
|
||||
+ // Paper start
|
||||
+ public static org.bukkit.util.Vector toBukkit(net.minecraft.core.BlockPos blockPosition) {
|
||||
+ return new org.bukkit.util.Vector(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ());
|
||||
+ }
|
||||
+
|
||||
+ public static net.minecraft.core.BlockPos toBlockPos(org.bukkit.util.Vector bukkit) {
|
||||
+ return net.minecraft.core.BlockPos.containing(bukkit.getX(), bukkit.getY(), bukkit.getZ());
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue