mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
37 lines
1.9 KiB
Diff
37 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MrPowerGamerBR <git@mrpowergamerbr.com>
|
|
Date: Fri, 17 Nov 2023 14:22:41 -0300
|
|
Subject: [PATCH] SparklyPaper: Skip "MapItem#update()" if the map does not
|
|
have the CraftMapRenderer present
|
|
|
|
Original project: https://github.com/SparklyPower/SparklyPaper
|
|
|
|
Optimizes "image in map" maps, without requiring the map to be locked, which some old map plugins may not do
|
|
|
|
This has the disadvantage that the vanilla map data will never be updated while the CraftMapRenderer is not present, but that's not a huuuge problem for u
|
|
|
|
diff --git a/net/minecraft/world/item/MapItem.java b/net/minecraft/world/item/MapItem.java
|
|
index 780793750c99185e8139a1cd0ad52bc7b80899a9..dd20922e25710fe79fb4d37d04dd5cb59cb896fe 100644
|
|
--- a/net/minecraft/world/item/MapItem.java
|
|
+++ b/net/minecraft/world/item/MapItem.java
|
|
@@ -275,7 +275,18 @@ public class MapItem extends Item {
|
|
savedData.tickCarriedBy(player, stack);
|
|
}
|
|
|
|
- if (!savedData.locked && slot != null && slot.getType() == EquipmentSlot.Type.HAND) {
|
|
+ // SparklyPaper start - don't update maps if they don't have the CraftMapRenderer in the render list
|
|
+ boolean shouldUpdateMap = !savedData.locked && slot != null && slot.getType() == EquipmentSlot.Type.HAND;
|
|
+ if (org.dreeam.leaf.config.modules.opt.SkipMapItemDataUpdates.enabled) {
|
|
+ for (org.bukkit.map.MapRenderer mapRenderer : savedData.mapView.getRenderers()) {
|
|
+ if (mapRenderer.getClass() == org.bukkit.craftbukkit.map.CraftMapRenderer.class) {
|
|
+ shouldUpdateMap = true;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ if (shouldUpdateMap) {
|
|
+ // SparklyPaper end - don't update maps if they don't have the CraftMapRenderer in the render list
|
|
this.update(level, entity, savedData);
|
|
}
|
|
}
|