diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/util/datafix/fixes/ItemStackMapIdFix.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/util/datafix/fixes/ItemStackMapIdFix.java.patch | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/util/datafix/fixes/ItemStackMapIdFix.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/util/datafix/fixes/ItemStackMapIdFix.java.patch new file mode 100644 index 0000000000..f2a44f3590 --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/util/datafix/fixes/ItemStackMapIdFix.java.patch @@ -0,0 +1,34 @@ +--- a/net/minecraft/util/datafix/fixes/ItemStackMapIdFix.java ++++ b/net/minecraft/util/datafix/fixes/ItemStackMapIdFix.java +@@ -20,17 +20,20 @@ + + @Override + 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<?> 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<?> typed1 = typed.getOrCreateTyped(opticFinder1); +- Dynamic<?> dynamic1 = typed1.get(DSL.remainderFinder()); +- dynamic1 = dynamic1.set("map", dynamic1.createInt(dynamic.get("Damage").asInt(0))); +- return typed.set(opticFinder1, typed1.set(DSL.remainderFinder(), dynamic1)); ++ Type<?> type = this.getInputSchema().getType(DataConverterTypes.ITEM_STACK); ++ OpticFinder<Pair<String, String>> opticfinder = DSL.fieldFinder("id", DSL.named(DataConverterTypes.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(((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; + } |