[MC-9886] Maps in item frames cause un-necessary lag Created: 16/Feb/13  Updated: 03/Mar/14  Resolved: 15/Dec/13

Status: Resolved
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Minecraft 1.4.7, Snapshot 13w10b, Minecraft 1.5
Fix Version/s: None

Type: Bug
Reporter: Aikar Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MC-1138 Item frames cause lag / huge FPS drop... Resolved
Confirmation Status: Unconfirmed

 Description   

Currently, EntityTrackerEntry.track when sending map data for item frames is sending the data to all players in the same world.

Theres 2 issues:
1) The code is using the supplied "list" parameter passed to .track() which includes every player in the current world.

It should actually be using this.trackedPlayers, so that only players in range of the itemframe will receive the data.

2) It is checking the low priority queue for load, which is not used anymore so will always be true.

So on a large server, a single user can setup a large number of maps in item frames and totally destroy the servers performance as it spams the map data to every player in the world.

The main issue can be fixed by simply with CraftBukkit naming:

diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index c629046..f482f34 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -80,7 +80,7 @@ public class EntityTrackerEntry {
 
             if (i5 != null && i5.getItem() instanceof ItemWorldMap) {
                 WorldMap i7 = Item.MAP.getSavedMap(i5, this.tracker.world);
-                Iterator j0 = list.iterator();
+                Iterator j0 = this.trackedPlayers.iterator(); // CraftBukkit - Only send to players in range


 Comments   
Comment by Aikar [ 15/Dec/13 ]

This was not a duplicate of that issue, but this is likely improved slightly in 1.7.

Comment by Talven81 [ 26/Nov/13 ]

Is this still a concern in the current Minecraft version 1.7.2 / Launcher version 1.3.4 ? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

Comment by [Mod] CubeTheThird [ 27/Feb/13 ]

I will re-open this, however note that all issues have the same priority, and this cannot be changed.

Comment by Aikar [ 26/Feb/13 ]

I contributed to the Spigot project with this fix, and multiple server owners are now running this slightly modified (to only send the map once) with great results.

Previously this issue was tearing servers apart.

It needs to be fixed ASAP before its wide spread to the public that you can take down servers and waste massive amounts of bandwidth with very little effort.

Comment by Aikar [ 26/Feb/13 ]

Also, I have found another issue in the code.

The boolean logic for the "is an item frame and once every 10 ticks" is broken.

The update counter is never incremented, so this code will run EVERY tick, not one in ten.

The code needs to look something like this:

if (this.tracker instanceof EntityItemFrame) {
            EntityItemFrame i4 = (EntityItemFrame) this.tracker;
            ItemStack i5 = i4.i();

            if (this.m++ % 10 == 0 && i5 != null && i5.getItem() instanceof ItemWorldMap && this.trackedPlayers.size() > 0) {
                 WorldMap i7 = Item.MAP.getSavedMap(i5, this.tracker.world);
                 Iterator j0 = this.trackedPlayers.iterator(); 

Id also recommend lowering the default itemframe tracking range so that so many people arent tracking them so far away.... at distances they cant even see the things really.

Comment by Aikar [ 26/Feb/13 ]

I did, this is not a duplicate. Please reopen and raise the priority of this.

This issue has nothing to do with that issue. This is a server issue, that is a client issue.

This needs to be fixed for 1.5 so please open and get it pushed to proper people ASAP.

Comment by [Mod] CubeTheThird [ 26/Feb/13 ]

Duplicate of MC-1138. Please use the search function to check before posting in the future.

Generated at Sun Jan 12 12:22:34 UTC 2025 using Jira 9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13.