aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0815-fix-MC-252817-green-map-markers-do-not-disappear.patch
blob: 6f61c883624935ad34cd80fc7cc3cb1ca73a1045 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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 0c952bfc01b367a297e81768cab436c5474830f1..0cd57021cf308984415ca670f727ae61ac343fe7 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -291,7 +291,9 @@ public class ItemFrame extends HangingEntity {
     // Paper end
 
     private void removeFramedMap(ItemStack itemstack) {
-        this.getFramedMapId().ifPresent((i) -> {
+        // Paper start - fix MC-252817 (green map markers do not disappear)
+        this.getFramedMapIdFromItem(itemstack).ifPresent((i) -> {
+            // Paper end - fix MC-252817
             MapItemSavedData worldmap = MapItem.getSavedData(i, this.level());
 
             if (worldmap != null) {
@@ -309,7 +311,12 @@ public class ItemFrame extends HangingEntity {
 
     public OptionalInt getFramedMapId() {
         ItemStack itemstack = this.getItem();
+        // Paper start - fix MC-252817 (green map markers do not disappear)
+        return this.getFramedMapIdFromItem(itemstack);
+    }
 
+    public OptionalInt getFramedMapIdFromItem(ItemStack itemstack) {
+        // Paper end - fix MC-252817
         if (itemstack.is(Items.FILLED_MAP)) {
             Integer integer = MapItem.getMapId(itemstack);