2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/inventory/ContainerStonecutter.java
|
|
|
|
+++ b/net/minecraft/world/inventory/ContainerStonecutter.java
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -15,6 +15,13 @@
|
2021-03-15 23:00:00 +01:00
|
|
|
import net.minecraft.world.level.World;
|
|
|
|
import net.minecraft.world.level.block.Blocks;
|
2021-03-08 22:47:33 +01:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
+// CraftBukkit start
|
2020-09-03 10:37:55 +02:00
|
|
|
+import org.bukkit.Location;
|
2019-04-23 04:00:00 +02:00
|
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryStonecutter;
|
|
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
|
|
|
+import org.bukkit.entity.Player;
|
|
|
|
+// CraftBukkit end
|
2021-03-08 22:47:33 +01:00
|
|
|
+
|
2019-04-23 04:00:00 +02:00
|
|
|
public class ContainerStonecutter extends Container {
|
|
|
|
|
2021-06-11 07:00:00 +02:00
|
|
|
public static final int INPUT_SLOT = 0;
|
|
|
|
@@ -34,6 +41,21 @@
|
|
|
|
Runnable slotUpdateListener;
|
|
|
|
public final IInventory container;
|
|
|
|
final InventoryCraftResult resultContainer;
|
2019-04-23 04:00:00 +02:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ private CraftInventoryView bukkitEntity = null;
|
|
|
|
+ private Player player;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public CraftInventoryView getBukkitView() {
|
|
|
|
+ if (bukkitEntity != null) {
|
|
|
|
+ return bukkitEntity;
|
|
|
|
+ }
|
|
|
|
+
|
2021-06-11 07:00:00 +02:00
|
|
|
+ CraftInventoryStonecutter inventory = new CraftInventoryStonecutter(this.container, this.resultContainer);
|
2019-04-23 04:00:00 +02:00
|
|
|
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
|
|
|
|
+ return bukkitEntity;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
|
|
|
|
public ContainerStonecutter(int i, PlayerInventory playerinventory) {
|
2021-06-11 07:00:00 +02:00
|
|
|
this(i, playerinventory, ContainerAccess.NULL);
|
|
|
|
@@ -53,6 +75,13 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
ContainerStonecutter.this.slotsChanged(this);
|
2021-06-11 07:00:00 +02:00
|
|
|
ContainerStonecutter.this.slotUpdateListener.run();
|
2020-09-03 10:37:55 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ @Override
|
|
|
|
+ public Location getLocation() {
|
|
|
|
+ return containeraccess.getLocation();
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
};
|
2021-06-11 07:00:00 +02:00
|
|
|
this.resultContainer = new InventoryCraftResult();
|
|
|
|
this.access = containeraccess;
|
2023-06-07 17:30:00 +02:00
|
|
|
@@ -104,6 +133,7 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
}
|
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
this.addDataSlot(this.selectedRecipeIndex);
|
2019-04-23 04:00:00 +02:00
|
|
|
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
|
|
|
|
}
|
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
public int getSelectedRecipeIndex() {
|
2023-06-07 17:30:00 +02:00
|
|
|
@@ -124,6 +154,7 @@
|
2021-06-11 07:00:00 +02:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2021-11-21 23:00:00 +01:00
|
|
|
public boolean stillValid(EntityHuman entityhuman) {
|
2019-04-23 04:00:00 +02:00
|
|
|
+ if (!this.checkReachable) return true; // CraftBukkit
|
2021-11-21 23:00:00 +01:00
|
|
|
return stillValid(this.access, entityhuman, Blocks.STONECUTTER);
|
2019-04-23 04:00:00 +02:00
|
|
|
}
|
|
|
|
|