0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-22 04:16:17 +00:00
craftbukkit/nms-patches/net/minecraft/world/inventory/CrafterMenu.patch
2024-10-23 02:15:00 +11:00

39 lines
1.3 KiB
Diff

--- a/net/minecraft/world/inventory/CrafterMenu.java
+++ b/net/minecraft/world/inventory/CrafterMenu.java
@@ -10,8 +10,27 @@
import net.minecraft.world.item.crafting.RecipeCrafting;
import net.minecraft.world.level.block.CrafterBlock;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryCrafter;
+import org.bukkit.craftbukkit.inventory.view.CraftCrafterView;
+// CraftBukkit end
+
public class CrafterMenu extends Container implements ICrafting {
+ // CraftBukkit start
+ private CraftCrafterView bukkitEntity = null;
+
+ @Override
+ public CraftCrafterView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ CraftInventoryCrafter inventory = new CraftInventoryCrafter(this.container, this.resultContainer);
+ bukkitEntity = new CraftCrafterView(this.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
protected static final int SLOT_COUNT = 9;
private static final int INV_SLOT_START = 9;
private static final int INV_SLOT_END = 36;
@@ -106,6 +125,7 @@
@Override
public boolean stillValid(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return this.container.stillValid(entityhuman);
}