Description of issue
MapItemSavedData#tickCarriedBy is currently used by both a map itemstack ticked inside an ItemFrame as well as the items in the player inventory.
Given that maps can be duplicated, MapItemSavedData#tickCarriedBy is potentially called multiple times per tick, for each instance of the map around (either in player inventories or item frames). #tickCarriedBy however is terribly designed in regards to the duplicate existence of the same map and should be thoroughly investigated for potential performance improvements:
Examples
carriedByPlayers is used to track which players currently carry the map. However, the itemframe calls this method for each player tracking the itemframe entity, meaning that in a single tick, a player may be added to said list just to be removed later by the iteration through the carried list.
The tickCarriedBy additionally loads Decorations from the compound tag of the item stack over and over.
Description of issue
MapItemSavedData#tickCarriedBy is currently used by both a map itemstack ticked inside an ItemFrame as well as the items in the player inventory.
Given that maps can be duplicated, MapItemSavedData#tickCarriedBy is potentially called multiple times per tick, for each instance of the map around (either in player inventories or item frames). #tickCarriedBy however is terribly designed in regards to the duplicate existence of the same map and should be thoroughly investigated for potential performance improvements:
Examples
carriedByPlayersis used to track which players currently carry the map. However, the itemframe calls this method for each player tracking the itemframe entity, meaning that in a single tick, a player may be added to said list just to be removed later by the iteration through the carried list.The tickCarriedBy additionally loads Decorations from the compound tag of the item stack over and over.