aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/util/datafix/fixes/ItemStackTheFlatteningFix.java.patch
diff options
context:
space:
mode:
authorMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
committerMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
commitbee74680e607c2e29b038329f62181238911cd83 (patch)
tree708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/mache-spigotflower/net/minecraft/util/datafix/fixes/ItemStackTheFlatteningFix.java.patch
parent0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff)
downloadPaper-softspoon.tar.gz
Paper-softspoon.zip
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/util/datafix/fixes/ItemStackTheFlatteningFix.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/util/datafix/fixes/ItemStackTheFlatteningFix.java.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/util/datafix/fixes/ItemStackTheFlatteningFix.java.patch b/patch-remap/mache-spigotflower/net/minecraft/util/datafix/fixes/ItemStackTheFlatteningFix.java.patch
new file mode 100644
index 0000000000..b73428dfd5
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/util/datafix/fixes/ItemStackTheFlatteningFix.java.patch
@@ -0,0 +1,54 @@
+--- a/net/minecraft/util/datafix/fixes/ItemStackTheFlatteningFix.java
++++ b/net/minecraft/util/datafix/fixes/ItemStackTheFlatteningFix.java
+@@ -348,14 +348,13 @@
+ }).collect(Collectors.toSet());
+ private static final Set<String> DAMAGE_IDS = Sets.newHashSet(new String[]{"minecraft:bow", "minecraft:carrot_on_a_stick", "minecraft:chainmail_boots", "minecraft:chainmail_chestplate", "minecraft:chainmail_helmet", "minecraft:chainmail_leggings", "minecraft:diamond_axe", "minecraft:diamond_boots", "minecraft:diamond_chestplate", "minecraft:diamond_helmet", "minecraft:diamond_hoe", "minecraft:diamond_leggings", "minecraft:diamond_pickaxe", "minecraft:diamond_shovel", "minecraft:diamond_sword", "minecraft:elytra", "minecraft:fishing_rod", "minecraft:flint_and_steel", "minecraft:golden_axe", "minecraft:golden_boots", "minecraft:golden_chestplate", "minecraft:golden_helmet", "minecraft:golden_hoe", "minecraft:golden_leggings", "minecraft:golden_pickaxe", "minecraft:golden_shovel", "minecraft:golden_sword", "minecraft:iron_axe", "minecraft:iron_boots", "minecraft:iron_chestplate", "minecraft:iron_helmet", "minecraft:iron_hoe", "minecraft:iron_leggings", "minecraft:iron_pickaxe", "minecraft:iron_shovel", "minecraft:iron_sword", "minecraft:leather_boots", "minecraft:leather_chestplate", "minecraft:leather_helmet", "minecraft:leather_leggings", "minecraft:shears", "minecraft:shield", "minecraft:stone_axe", "minecraft:stone_hoe", "minecraft:stone_pickaxe", "minecraft:stone_shovel", "minecraft:stone_sword", "minecraft:wooden_axe", "minecraft:wooden_hoe", "minecraft:wooden_pickaxe", "minecraft:wooden_shovel", "minecraft:wooden_sword"});
+
+- public ItemStackTheFlatteningFix(Schema schema, boolean flag) {
+- super(schema, flag);
++ public ItemStackTheFlatteningFix(Schema outputSchema, boolean changesType) {
++ super(outputSchema, changesType);
+ }
+
+- @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()));
++ 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("ItemInstanceTheFlatteningFix", type, (typed) -> {
+@@ -370,14 +369,14 @@
+ String s = updateItem((String) ((Pair) optional.get()).getSecond(), i);
+
+ if (s != null) {
+- typed1 = typed.set(opticfinder, Pair.of(References.ITEM_NAME.typeName(), s));
++ typed1 = typed.set(opticfinder, Pair.of(DataConverterTypes.ITEM_NAME.typeName(), s));
+ }
+
+ if (ItemStackTheFlatteningFix.DAMAGE_IDS.contains(((Pair) optional.get()).getSecond())) {
+ Typed<?> typed2 = typed.getOrCreateTyped(opticfinder1);
+ Dynamic<?> dynamic1 = (Dynamic) typed2.get(DSL.remainderFinder());
+
+- dynamic1 = dynamic1.set("Damage", dynamic1.createInt(i));
++ if (i != 0) dynamic1 = dynamic1.set("Damage", dynamic1.createInt(i)); // CraftBukkit
+ typed1 = typed1.set(opticfinder1, typed2.set(DSL.remainderFinder(), dynamic1));
+ }
+
+@@ -388,11 +387,11 @@
+ }
+
+ @Nullable
+- public static String updateItem(@Nullable String s, int i) {
+- if (ItemStackTheFlatteningFix.IDS.contains(s)) {
+- String s1 = (String) ItemStackTheFlatteningFix.MAP.get(s + "." + i);
++ public static String updateItem(@Nullable String item, int dataValue) {
++ if (ItemStackTheFlatteningFix.IDS.contains(item)) {
++ String s1 = (String) ItemStackTheFlatteningFix.MAP.get(item + "." + dataValue);
+
+- return s1 == null ? (String) ItemStackTheFlatteningFix.MAP.get(s + ".0") : s1;
++ return s1 == null ? (String) ItemStackTheFlatteningFix.MAP.get(item + ".0") : s1;
+ } else {
+ return null;
+ }