From d38930d51ee57ccbd17b6f30a063782c1d2e3f83 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Mon, 14 Jun 2021 02:06:46 -0700 Subject: [PATCH 1/2] Add missing getLevel implementation to Hopper Minecart, add mapping to fix reobf --- .../additional-spigot-member-mappings.csrg | 5 +++++ patches/server/Optimize-Hoppers.patch | 20 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/build-data/additional-spigot-member-mappings.csrg b/build-data/additional-spigot-member-mappings.csrg index 962d83c9a2..33f15ea1ca 100644 --- a/build-data/additional-spigot-member-mappings.csrg +++ b/build-data/additional-spigot-member-mappings.csrg @@ -20,3 +20,8 @@ net/minecraft/world/entity/npc/EntityVillagerAbstract fD ()Lnet/minecraft/world/ # BehaviorWorkComposter -> BehaviorWork net/minecraft/world/entity/ai/behavior/BehaviorWorkComposter a (Lnet/minecraft/server/level/WorldServer;Lnet/minecraft/world/entity/npc/EntityVillager;)V doWork + +# We add getLevel to the Hopper interface (implemented by Hoppers and Hopper Minecarts), but this also exists on BlockEntity, +# which Hoppers also extend. We need to map the method we add to the Hopper interface to the same name used for the method on BlockEntity +# to avoid remap causing issues +net/minecraft/world/level/block/entity/IHopper getWorld ()Lnet/minecraft/world/level/World; getLevel diff --git a/patches/server/Optimize-Hoppers.patch b/patches/server/Optimize-Hoppers.patch index 48bbc09754..641aeeb368 100644 --- a/patches/server/Optimize-Hoppers.patch +++ b/patches/server/Optimize-Hoppers.patch @@ -43,6 +43,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.profiler.push(() -> { return worldserver + " " + worldserver.dimension().location(); +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java +@@ -0,0 +0,0 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper + this.enabled = enabled; + } + ++ // Paper start - add back getLevel ++ @Override ++ public net.minecraft.world.level.Level getLevel() { ++ return this.level; ++ } ++ // Paper end ++ + @Override + public double getLevelX() { + return this.getX(); diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java @@ -91,7 +109,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return SUCK; } -+ net.minecraft.world.level.Level getLevel(); ++ net.minecraft.world.level.Level getLevel(); // Paper + + default net.minecraft.core.BlockPos getBlockPosition() { return new net.minecraft.core.BlockPos(getLevelX(), getLevelY(), getLevelZ()); } // Paper + From eb75bb7c8dab3dee2e292d38962c8accce594c48 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Mon, 14 Jun 2021 02:15:37 -0700 Subject: [PATCH 2/2] decomp fixes --- .../Support-old-UUID-format-for-NBT.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/patches/server/Support-old-UUID-format-for-NBT.patch b/patches/server/Support-old-UUID-format-for-NBT.patch index 264d3aaff7..2ce312717e 100644 --- a/patches/server/Support-old-UUID-format-for-NBT.patch +++ b/patches/server/Support-old-UUID-format-for-NBT.patch @@ -78,3 +78,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (compound.hasUUID("Id")) { uUID = compound.getUUID("Id"); } +@@ -0,0 +0,0 @@ public final class NbtUtils { + } + + public static CompoundTag update(DataFixer fixer, DataFixTypes fixTypes, CompoundTag compound, int oldVersion, int targetVersion) { +- return fixer.update(fixTypes.getType(), new Dynamic<>(NbtOps.INSTANCE, compound), oldVersion, targetVersion).getValue(); ++ return (CompoundTag) fixer.update(fixTypes.getType(), new com.mojang.serialization.Dynamic<>(NbtOps.INSTANCE, compound), oldVersion, targetVersion).getValue(); // Paper - decompile fix + } + + public static Component toPrettyComponent(Tag element) { +@@ -0,0 +0,0 @@ public final class NbtUtils { + CompoundTag compoundTag2 = new CompoundTag(); + if (i + 2 <= string.length()) { + String string3 = string.substring(i + 1, string.indexOf(125, i)); +- COMMA_SPLITTER.split(string3).forEach((string2) -> { +- List list = COLON_SPLITTER.splitToList(string2); ++ COMMA_SPLITTER.split(string3).forEach(it -> { // Paper - decompile fix ++ List list = COLON_SPLITTER.splitToList(it); // Paper - decompile fix + if (list.size() == 2) { + compoundTag2.putString(list.get(0), list.get(1)); + } else {