Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 04:50:05 +01:00
46 Zeilen
1.4 KiB
Diff
46 Zeilen
1.4 KiB
Diff
--- a/net/minecraft/server/ContainerHopper.java
|
|
+++ b/net/minecraft/server/ContainerHopper.java
|
|
@@ -1,13 +1,34 @@
|
|
package net.minecraft.server;
|
|
|
|
import javax.annotation.Nullable;
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventory;
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
|
+// CraftBukkit end
|
|
|
|
public class ContainerHopper extends Container {
|
|
|
|
private final IInventory hopper;
|
|
|
|
+ // CraftBukkit start
|
|
+ private CraftInventoryView bukkitEntity = null;
|
|
+ private PlayerInventory player;
|
|
+
|
|
+ @Override
|
|
+ public CraftInventoryView getBukkitView() {
|
|
+ if (bukkitEntity != null) {
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+
|
|
+ CraftInventory inventory = new CraftInventory(this.hopper);
|
|
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
public ContainerHopper(PlayerInventory playerinventory, IInventory iinventory, EntityHuman entityhuman) {
|
|
this.hopper = iinventory;
|
|
+ this.player = playerinventory; // CraftBukkit - save player
|
|
iinventory.startOpen(entityhuman);
|
|
byte b0 = 51;
|
|
|
|
@@ -30,6 +51,7 @@
|
|
}
|
|
|
|
public boolean a(EntityHuman entityhuman) {
|
|
+ if (!this.checkReachable) return true; // CraftBukkit
|
|
return this.hopper.a(entityhuman);
|
|
}
|
|
|