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
39
patches/server/0853-Cache-map-ids-on-item-frames.patch
Normal file
39
patches/server/0853-Cache-map-ids-on-item-frames.patch
Normal file
|
@ -0,0 +1,39 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Warrior <50800980+Warriorrrr@users.noreply.github.com>
|
||||
Date: Mon, 7 Aug 2023 12:58:28 +0200
|
||||
Subject: [PATCH] Cache map ids on item frames
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index f010be9605d7458add7e5693ff473fabf679c938..a2fbbbd7a66d4e7b1063638f8467e8887a417282 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -117,7 +117,7 @@ public class ServerEntity {
|
||||
ItemStack itemstack = entityitemframe.getItem();
|
||||
|
||||
if (this.level.paperConfig().maps.itemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig().maps.itemFrameCursorUpdateInterval == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable
|
||||
- MapId mapid = (MapId) itemstack.get(DataComponents.MAP_ID);
|
||||
+ MapId mapid = entityitemframe.cachedMapId; // Paper - Perf: Cache map ids on item frames
|
||||
MapItemSavedData worldmap = MapItem.getSavedData(mapid, this.level);
|
||||
|
||||
if (worldmap != null) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
index ba4e0ad7c7c2731d61ec7f60f19d7e9ec31a28ba..5b7245cd99593ee90e17c97e0104f3aba9ae05ea 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
@@ -50,6 +50,7 @@ public class ItemFrame extends HangingEntity {
|
||||
private static final float HEIGHT = 0.75F;
|
||||
public float dropChance;
|
||||
public boolean fixed;
|
||||
+ public @Nullable MapId cachedMapId; // Paper - Perf: Cache map ids on item frames
|
||||
|
||||
public ItemFrame(EntityType<? extends ItemFrame> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -322,6 +323,7 @@ public class ItemFrame extends HangingEntity {
|
||||
}
|
||||
|
||||
private void onItemChanged(ItemStack stack) {
|
||||
+ this.cachedMapId = stack.getComponents().get(net.minecraft.core.component.DataComponents.MAP_ID); // Paper - Perf: Cache map ids on item frames
|
||||
if (!stack.isEmpty() && stack.getFrame() != this) {
|
||||
stack.setEntityRepresentation(this);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue