PaperMC/patches/server/fix-MC-252817-green-map-markers-do-not-disappear.patch
2024-04-24 23:26:18 +02:00

36 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: braindead <totsuka.sama@gmail.com>
Date: Sat, 5 Nov 2022 17:47:26 -0400
Subject: [PATCH] fix MC-252817 (green map markers do not disappear).
this bug is caused by the fact that the itemframe's item is set to empty before the green marker is requested to be removed. this is fixed by getting the mapid from this method's parameter, rather than the air block now stored by the item frame.
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -0,0 +0,0 @@ public class ItemFrame extends HangingEntity {
}
private void removeFramedMap(ItemStack stack) {
- MapId mapid = this.getFramedMapId();
+ MapId mapid = this.getFramedMapIdForItem(stack); // Paper - fix MC-252817 (green map markers do not disappear)
if (mapid != null) {
MapItemSavedData worldmap = MapItem.getSavedData(mapid, this.level());
@@ -0,0 +0,0 @@ public class ItemFrame extends HangingEntity {
@Nullable
public MapId getFramedMapId() {
- return (MapId) this.getItem().get(DataComponents.MAP_ID);
+ // Paper start
+ return this.getFramedMapIdForItem(this.getItem());
+ }
+
+ @Nullable
+ public MapId getFramedMapIdForItem(ItemStack item) {
+ return (MapId) item.get(DataComponents.MAP_ID);
+ // Paper end
}
public boolean hasFramedMap() {