mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-15 14:13:56 +01:00
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.
This commit is contained in:
parent
6702fe7546
commit
4bb84c46ac
1 changed files with 4 additions and 2 deletions
|
@ -60,11 +60,13 @@
|
|||
ServerEntity.removedPassengers(list, this.lastPassengers).forEach((entity) -> {
|
||||
if (entity instanceof ServerPlayer entityplayer) {
|
||||
entityplayer.connection.teleport(entityplayer.getX(), entityplayer.getY(), entityplayer.getZ(), entityplayer.getYRot(), entityplayer.getXRot());
|
||||
@@ -107,18 +117,18 @@
|
||||
@@ -106,19 +116,19 @@
|
||||
|
||||
Entity entity = this.entity;
|
||||
|
||||
if (entity instanceof ItemFrame entityitemframe) {
|
||||
- if (entity instanceof ItemFrame entityitemframe) {
|
||||
- if (this.tickCount % 10 == 0) {
|
||||
+ 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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue