mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 01:39:52 +03:00
58 lines
2.4 KiB
Diff
58 lines
2.4 KiB
Diff
--- ../src-base/minecraft/net/minecraft/inventory/ContainerWorkbench.java
|
|
+++ ../src-work/minecraft/net/minecraft/inventory/ContainerWorkbench.java
|
|
@@ -6,17 +6,28 @@
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.world.World;
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryCrafting;
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
|
|
|
public class ContainerWorkbench extends Container
|
|
{
|
|
- public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
|
|
- public InventoryCraftResult craftResult = new InventoryCraftResult();
|
|
+ public InventoryCrafting craftMatrix; // CraftBukkit - move initialization into constructor
|
|
+ public InventoryCraftResult craftResult; // CraftBukkit - move initialization into constructor
|
|
private final World world;
|
|
private final BlockPos pos;
|
|
private final EntityPlayer player;
|
|
|
|
+ private CraftInventoryView bukkitEntity = null;
|
|
+ private InventoryPlayer playerInventory;
|
|
+
|
|
public ContainerWorkbench(InventoryPlayer playerInventory, World worldIn, BlockPos posIn)
|
|
{
|
|
+ // CraftBukkit start - Switched order of IInventory construction and stored player
|
|
+ this.craftResult = new InventoryCraftResult();
|
|
+ this.craftMatrix = new InventoryCrafting(this, 3, 3).setOwner(playerInventory.player); // CraftBukkit - pass player // CatServer - Use setOwner for RealBench compatible
|
|
+ this.craftMatrix.resultInventory = this.craftResult;
|
|
+ this.playerInventory = playerInventory;
|
|
+ // CraftBukkit end
|
|
this.world = worldIn;
|
|
this.pos = posIn;
|
|
this.player = playerInventory.player;
|
|
@@ -61,6 +72,7 @@
|
|
|
|
public boolean canInteractWith(EntityPlayer playerIn)
|
|
{
|
|
+ if (!this.checkReachable) return true;
|
|
if (this.world.getBlockState(this.pos).getBlock() != Blocks.CRAFTING_TABLE)
|
|
{
|
|
return false;
|
|
@@ -140,4 +152,15 @@
|
|
{
|
|
return slotIn.inventory != this.craftResult && super.canMergeSlot(stack, slotIn);
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public CraftInventoryView getBukkitView() {
|
|
+ if (bukkitEntity != null) {
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+
|
|
+ CraftInventoryCrafting inventory = new CraftInventoryCrafting(this.craftMatrix, this.craftResult);
|
|
+ bukkitEntity = new CraftInventoryView(this.playerInventory.player.getBukkitEntity(), inventory, this);
|
|
+ return bukkitEntity;
|
|
+ }
|
|
}
|