Paper/nms-patches/ContainerFurnace.patch

52 lines
1.6 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/ContainerFurnace.java
+++ b/net/minecraft/server/ContainerFurnace.java
2018-07-15 02:00:00 +02:00
@@ -1,6 +1,10 @@
package net.minecraft.server;
2018-07-15 02:00:00 +02:00
import java.util.Iterator;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
2018-07-15 02:00:00 +02:00
public class ContainerFurnace extends ContainerRecipeBook {
@@ -11,12 +15,29 @@
private int i;
2018-07-15 02:00:00 +02:00
private int j;
2015-02-26 23:41:06 +01:00
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ CraftInventoryFurnace inventory = new CraftInventoryFurnace((TileEntityFurnace) this.furnace);
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }
2015-02-26 23:41:06 +01:00
+ // CraftBukkit end
+
public ContainerFurnace(PlayerInventory playerinventory, IInventory iinventory) {
this.furnace = iinventory;
2018-07-15 02:00:00 +02:00
this.f = playerinventory.player.world;
this.a(new Slot(iinventory, 0, 56, 17));
this.a((Slot) (new SlotFurnaceFuel(iinventory, 1, 56, 53)));
this.a((Slot) (new SlotFurnaceResult(playerinventory.player, iinventory, 2, 116, 35)));
+ this.player = playerinventory; // CraftBukkit - save player
int i;
2018-07-15 02:00:00 +02:00
@@ -95,6 +116,7 @@
}
2017-09-18 12:00:00 +02:00
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return this.furnace.a(entityhuman);
}