3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/nms-patches/ContainerAnvil.patch
2014-11-28 11:23:19 +00:00

52 Zeilen
1.9 KiB
Diff

--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerAnvil.java 2014-11-28 11:22:55.806823166 +0000
+++ src/main/java/net/minecraft/server/ContainerAnvil.java 2014-11-28 11:01:54.000000000 +0000
@@ -6,6 +6,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
+
public class ContainerAnvil extends Container {
private static final Logger f = LogManager.getLogger();
@@ -17,8 +19,13 @@
private int k;
private String l;
private final EntityHuman m;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
+ // CraftBukkit end
public ContainerAnvil(PlayerInventory playerinventory, World world, BlockPosition blockposition, EntityHuman entityhuman) {
+ this.player = playerinventory; // CraftBukkit
this.j = blockposition;
this.i = world;
this.m = entityhuman;
@@ -265,6 +272,7 @@
}
public boolean a(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return this.i.getType(this.j).getBlock() != Blocks.ANVIL ? false : entityhuman.e((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D;
}
@@ -328,4 +336,17 @@
static int b(ContainerAnvil containeranvil) {
return containeranvil.k;
}
+
+ // CraftBukkit start
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryAnvil(this.h, this.g);
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
}