Cache map ids on item frames

This commit is contained in:
Warrior
2023-08-07 12:58:28 +02:00
parent 88464f509b
commit 4c98f21716
2 changed files with 25 additions and 8 deletions

View File

@@ -71,8 +71,9 @@
ItemStack itemstack = entityitemframe.getItem();
- if (itemstack.getItem() instanceof MapItem) {
- MapId mapid = (MapId) itemstack.get(DataComponents.MAP_ID);
+ if (this.level.paperConfig().maps.itemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig().maps.itemFrameCursorUpdateInterval == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable
MapId mapid = (MapId) itemstack.get(DataComponents.MAP_ID);
+ MapId mapid = entityitemframe.cachedMapId; // Paper - Perf: Cache map ids on item frames
MapItemSavedData worldmap = MapItem.getSavedData(mapid, this.level);
if (worldmap != null) {