--- a/net/minecraft/util/datafix/fixes/ItemStackMapIdFix.java
+++ b/net/minecraft/util/datafix/fixes/ItemStackMapIdFix.java
@@ -14,22 +14,26 @@
 import net.minecraft.util.datafix.schemas.NamespacedSchema;
 
 public class ItemStackMapIdFix extends DataFix {
+
     public ItemStackMapIdFix(Schema outputSchema, boolean changesType) {
         super(outputSchema, changesType);
     }
 
     public TypeRewriteRule makeRule() {
         Type<?> type = this.getInputSchema().getType(References.ITEM_STACK);
-        OpticFinder<Pair<String, String>> opticFinder = DSL.fieldFinder("id", DSL.named(References.ITEM_NAME.typeName(), NamespacedSchema.namespacedString()));
-        OpticFinder<?> opticFinder2 = type.findField("tag");
+        OpticFinder<Pair<String, String>> opticfinder = DSL.fieldFinder("id", DSL.named(References.ITEM_NAME.typeName(), NamespacedSchema.namespacedString()));
+        OpticFinder<?> opticfinder1 = type.findField("tag");
+
         return this.fixTypeEverywhereTyped("ItemInstanceMapIdFix", type, (typed) -> {
-            Optional<Pair<String, String>> optional = typed.getOptional(opticFinder);
-            if (optional.isPresent() && Objects.equals(optional.get().getSecond(), "minecraft:filled_map")) {
-                Dynamic<?> dynamic = typed.get(DSL.remainderFinder());
-                Typed<?> typed2 = typed.getOrCreateTyped(opticFinder2);
-                Dynamic<?> dynamic2 = typed2.get(DSL.remainderFinder());
-                dynamic2 = dynamic2.set("map", dynamic2.createInt(dynamic.get("Damage").asInt(0)));
-                return typed.set(opticFinder2, typed2.set(DSL.remainderFinder(), dynamic2));
+            Optional<Pair<String, String>> optional = typed.getOptional(opticfinder);
+
+            if (optional.isPresent() && Objects.equals(((Pair) optional.get()).getSecond(), "minecraft:filled_map")) {
+                Dynamic<?> dynamic = (Dynamic) typed.get(DSL.remainderFinder());
+                Typed<?> typed1 = typed.getOrCreateTyped(opticfinder1);
+                Dynamic<?> dynamic1 = (Dynamic) typed1.get(DSL.remainderFinder());
+
+                if (!dynamic1.getElement("map").result().isPresent()) dynamic1 = dynamic1.set("map", dynamic1.createInt(dynamic.get("Damage").asInt(0))); // CraftBukkit
+                return typed.set(opticfinder1, typed1.set(DSL.remainderFinder(), dynamic1));
             } else {
                 return typed;
             }
