mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-06 15:51:31 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@b0da38c2 Repository details in RuntimeException for MavenLibraryResolver#addRepository (#12939) PaperMC/Paper@1922be90 Update custom tags (#12183) PaperMC/Paper@79cf1353 Ignore HopperInventorySearchEvent when it has no listeners (#13009) PaperMC/Paper@ea014f7a feat: add stuckEntityPoiRetryDelay config (#12949) PaperMC/Paper@a9e76749 Support for showNotification in PlayerRecipeDiscoverEvent (#12992) PaperMC/Paper@5622c9dd Expose attribute sentiment (#12974) PaperMC/Paper@42b653b1 Expose more argument types (#12665) PaperMC/Paper@52d9a221 [ci/skip] Fix typo in Display javadoc (#13010) PaperMC/Paper@614e9acf Improve APIs around riptide tridents (#12996) PaperMC/Paper@51706e5a Fixed DyeItem sheep dye hunk
43 lines
2.2 KiB
Diff
43 lines
2.2 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..0073f21245c98e7b5791f9db1ad221aef7cb594a 100644
|
|
--- a/net/minecraft/world/item/MapItem.java
|
|
+++ b/net/minecraft/world/item/MapItem.java
|
|
@@ -275,12 +275,24 @@ public class MapItem extends Item {
|
|
savedData.tickCarriedBy(player, stack);
|
|
}
|
|
|
|
- if (!savedData.locked && slot != null && slot.getType() == EquipmentSlot.Type.HAND) {
|
|
+ if (!savedData.locked && (!org.dreeam.leaf.config.modules.opt.SkipMapItemDataUpdates.enabled || shouldUpdateMap(savedData)) && slot != null && slot.getType() == EquipmentSlot.Type.HAND) { // SparklyPaper - don't update maps if they don't have the CraftMapRenderer in the render list
|
|
this.update(level, entity, savedData);
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // SparklyPaper start - don't update maps if they don't have the CraftMapRenderer in the render list
|
|
+ private static boolean shouldUpdateMap(MapItemSavedData savedData) {
|
|
+ for (org.bukkit.map.MapRenderer mapRenderer : savedData.mapView.getRenderers()) {
|
|
+ if (mapRenderer.getClass() == org.bukkit.craftbukkit.map.CraftMapRenderer.class) {
|
|
+ return true;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return false;
|
|
+ }
|
|
+ // SparklyPaper end - don't update maps if they don't have the CraftMapRenderer in the render list
|
|
+
|
|
@Override
|
|
public void onCraftedPostProcess(ItemStack stack, Level level) {
|
|
MapPostProcessing mapPostProcessing = stack.remove(DataComponents.MAP_POST_PROCESSING);
|