Add missing getLevel implementation to Hopper Minecart, add mapping to fix reobf

This commit is contained in:
Jason Penilla 2021-06-14 02:06:46 -07:00
parent 97f581f459
commit d38930d51e
2 changed files with 24 additions and 1 deletions

View file

@ -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

View file

@ -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
+