aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/unapplied/server/0816-Only-tick-item-frames-if-players-can-see-it.patch
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2024-12-03 17:58:41 +0100
committerNassim Jahnke <[email protected]>2024-12-03 17:58:41 +0100
commitc0a3d51ab35930e410fcd9752ceaff6c3f581c24 (patch)
treef53076a8b0787d2f544f73f468df94619e5eb1a5 /patches/unapplied/server/0816-Only-tick-item-frames-if-players-can-see-it.patch
parentda7138233f6392e791d790d1c3407414c855f9c2 (diff)
downloadPaper-c0a3d51ab35930e410fcd9752ceaff6c3f581c24.tar.gz
Paper-c0a3d51ab35930e410fcd9752ceaff6c3f581c24.zip
Start update, apply API patches
Diffstat (limited to 'patches/unapplied/server/0816-Only-tick-item-frames-if-players-can-see-it.patch')
-rw-r--r--patches/unapplied/server/0816-Only-tick-item-frames-if-players-can-see-it.patch20
1 files changed, 20 insertions, 0 deletions
diff --git a/patches/unapplied/server/0816-Only-tick-item-frames-if-players-can-see-it.patch b/patches/unapplied/server/0816-Only-tick-item-frames-if-players-can-see-it.patch
new file mode 100644
index 0000000000..c7c6cd499f
--- /dev/null
+++ b/patches/unapplied/server/0816-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();
+