diff options
Diffstat (limited to 'patches/server/0820-Only-tick-item-frames-if-players-can-see-it.patch')
-rw-r--r-- | patches/server/0820-Only-tick-item-frames-if-players-can-see-it.patch | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/patches/server/0820-Only-tick-item-frames-if-players-can-see-it.patch b/patches/server/0820-Only-tick-item-frames-if-players-can-see-it.patch new file mode 100644 index 0000000000..c7c6cd499f --- /dev/null +++ b/patches/server/0820-Only-tick-item-frames-if-players-can-see-it.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Redned <[email protected]> +Date: Mon, 19 Jun 2023 15:45:53 -0500 +Subject: [PATCH] Only tick item frames if players can see it + +In the event that an item frame cannot be seen by any players, ticking the item frame every tick is unnecessary. This can be a very hot section of the entity tracker when lots of item frames are present on a server, so this reduces the logic which speeds it up. + +diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java +index bc0f1aa61e68d2a8638d89c10bc5c71922d057f9..3cdcc4f44608d24550f2a8c6f3f5ce675d7777c5 100644 +--- a/src/main/java/net/minecraft/server/level/ServerEntity.java ++++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +@@ -116,7 +116,7 @@ public class ServerEntity { + + Entity entity = this.entity; + +- if (entity instanceof ItemFrame entityitemframe) { ++ if (!this.trackedPlayers.isEmpty() && entity instanceof ItemFrame entityitemframe) { // Paper - Perf: Only tick item frames if players can see it + if (true || this.tickCount % 10 == 0) { // CraftBukkit - Moved below, should always enter this block + ItemStack itemstack = entityitemframe.getItem(); + |