diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/util/datafix')
3 files changed, 78 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/util/datafix/DataFixers.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/util/datafix/DataFixers.java.patch new file mode 100644 index 0000000000..c9f3a2ae67 --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/util/datafix/DataFixers.java.patch @@ -0,0 +1,24 @@ +--- a/net/minecraft/util/datafix/DataFixers.java ++++ b/net/minecraft/util/datafix/DataFixers.java +@@ -442,7 +277,20 @@ + builder.addFixer(new VillagerTradeFix(schema43, false)); + Schema schema44 = builder.addSchema(1456, SAME_NAMESPACED); + builder.addFixer(new EntityItemFrameDirectionFix(schema44, false)); +- Schema schema45 = builder.addSchema(1458, SAME_NAMESPACED); ++ Schema schema45 = builder.addSchema(1458, DataFixers.SAME_NAMESPACED); ++ ++ // CraftBukkit start ++ builder.addFixer(new com.mojang.datafixers.DataFix(schema45, false) { ++ @Override ++ protected com.mojang.datafixers.TypeRewriteRule makeRule() { ++ return this.fixTypeEverywhereTyped("Player CustomName", this.getInputSchema().getType(DataConverterTypes.PLAYER), (typed) -> { ++ return typed.update(DSL.remainderFinder(), (dynamic) -> { ++ return EntityCustomNameToComponentFix.fixTagCustomName(dynamic); ++ }); ++ }); ++ } ++ }); ++ // CraftBukkit end + builder.addFixer(new EntityCustomNameToComponentFix(schema45, false)); + builder.addFixer(new ItemCustomNameToComponentFix(schema45, false)); + builder.addFixer(new BlockEntityCustomNameToComponentFix(schema45, false)); 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; + } diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/util/datafix/fixes/ItemStackTheFlatteningFix.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/util/datafix/fixes/ItemStackTheFlatteningFix.java.patch new file mode 100644 index 0000000000..cb554a827d --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/util/datafix/fixes/ItemStackTheFlatteningFix.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/util/datafix/fixes/ItemStackTheFlatteningFix.java ++++ b/net/minecraft/util/datafix/fixes/ItemStackTheFlatteningFix.java +@@ -421,11 +372,12 @@ + typed1 = typed.set(opticFinder, Pair.of(References.ITEM_NAME.typeName(), string)); + } + +- if (DAMAGE_IDS.contains(optional.get().getSecond())) { +- Typed<?> typed2 = typed.getOrCreateTyped(opticFinder1); +- Dynamic<?> dynamic1 = typed2.get(DSL.remainderFinder()); +- dynamic1 = dynamic1.set("Damage", dynamic1.createInt(_int)); +- typed1 = typed1.set(opticFinder1, typed2.set(DSL.remainderFinder(), dynamic1)); ++ if (ItemStackTheFlatteningFix.DAMAGE_IDS.contains(((Pair) optional.get()).getSecond())) { ++ Typed<?> typed2 = typed.getOrCreateTyped(opticfinder1); ++ Dynamic<?> dynamic1 = (Dynamic) typed2.get(DSL.remainderFinder()); ++ ++ if (i != 0) dynamic1 = dynamic1.set("Damage", dynamic1.createInt(i)); // CraftBukkit ++ typed1 = typed1.set(opticfinder1, typed2.set(DSL.remainderFinder(), dynamic1)); + } + + return typed1.set(DSL.remainderFinder(), dynamic.remove("Damage")); |