craftbukkit/nms-patches/net/minecraft/world/inventory/CrafterMenu.patch

39 lines
1.3 KiB
Diff
Raw Normal View History

2023-12-06 03:40:00 +11:00
--- a/net/minecraft/world/inventory/CrafterMenu.java
+++ b/net/minecraft/world/inventory/CrafterMenu.java
2024-06-14 01:05:00 +10:00
@@ -10,8 +10,27 @@
2023-12-06 03:40:00 +11:00
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.CrafterBlock;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryCrafter;
+import org.bukkit.craftbukkit.inventory.view.CraftCrafterView;
2023-12-06 03:40:00 +11:00
+// CraftBukkit end
+
public class CrafterMenu extends Container implements ICrafting {
+ // CraftBukkit start
+ private CraftCrafterView bukkitEntity = null;
2023-12-06 03:40:00 +11:00
+
+ @Override
+ public CraftCrafterView getBukkitView() {
2023-12-06 03:40:00 +11:00
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ CraftInventoryCrafter inventory = new CraftInventoryCrafter(this.container, this.resultContainer);
+ bukkitEntity = new CraftCrafterView(this.player.getBukkitEntity(), inventory, this);
2023-12-06 03:40:00 +11:00
+ 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;
2024-06-14 01:05:00 +10:00
@@ -118,6 +137,7 @@
2023-12-06 03:40:00 +11:00
@Override
public boolean stillValid(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return this.container.stillValid(entityhuman);
}