Commits

md_5 authored 1f8414b489e
Rebuilt patches
No tags

nms-patches/ContainerWorkbench.patch

Modified
1 ---- ../work/decompile-8eb82bde//net/minecraft/server/ContainerWorkbench.java 2014-12-09 20:39:54.821706281 +0100
2 -+++ src/main/java/net/minecraft/server/ContainerWorkbench.java 2014-12-09 20:39:42.000000000 +0100
1 +--- ../work/decompile-8eb82bde/net/minecraft/server/ContainerWorkbench.java 2014-12-12 11:04:49.302794059 +1100
2 ++++ src/main/java/net/minecraft/server/ContainerWorkbench.java 2014-12-12 11:04:29.771003013 +1100
3 3 @@ -1,13 +1,28 @@
4 4 package net.minecraft.server;
5 5
6 6 +// CraftBukkit start
7 7 +import org.bukkit.craftbukkit.inventory.CraftInventoryCrafting;
8 8 +import org.bukkit.craftbukkit.inventory.CraftInventoryView;
9 9 +// CraftBukkit end
10 10 +
11 11 public class ContainerWorkbench extends Container {
12 12
24 24 public ContainerWorkbench(PlayerInventory playerinventory, World world, BlockPosition blockposition) {
25 25 + // CraftBukkit start - Switched order of IInventory construction and stored player
26 26 + this.resultInventory = new InventoryCraftResult();
27 27 + this.craftInventory = new InventoryCrafting(this, 3, 3, playerinventory.player); // CraftBukkit - pass player
28 28 + this.craftInventory.resultInventory = this.resultInventory;
29 29 + this.player = playerinventory;
30 30 + // CraftBukkit end
31 31 this.g = world;
32 32 this.h = blockposition;
33 33 this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 124, 35)));
34 -@@ -35,7 +50,20 @@
34 +@@ -35,7 +50,21 @@
35 35 }
36 36
37 37 public void a(IInventory iinventory) {
38 38 - this.resultInventory.setItem(0, CraftingManager.getInstance().craft(this.craftInventory, this.g));
39 39 + // this.resultInventory.setItem(0, CraftingManager.getInstance().craft(this.craftInventory, this.g));
40 40 + // CraftBukkit start
41 41 + CraftingManager.getInstance().lastCraftView = getBukkitView();
42 42 + ItemStack craftResult = CraftingManager.getInstance().craft(this.craftInventory, this.g);
43 43 + this.resultInventory.setItem(0, craftResult);
44 44 + if (super.listeners.size() < 1) {
45 45 + return;
46 46 + }
47 ++ // See CraftBukkit PR #39
47 48 + if (craftResult != null && craftResult.getItem() == Items.FILLED_MAP) {
48 49 + return;
49 -+ }
50 ++ }
50 51 + EntityPlayer player = (EntityPlayer) super.listeners.get(0); // TODO: Is this _always_ correct? Seems like it.
51 52 + player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.activeContainer.windowId, 0, craftResult));
52 53 + // CraftBukkit end
53 54 }
54 55
55 56 public void b(EntityHuman entityhuman) {
56 -@@ -53,6 +81,7 @@
57 +@@ -53,6 +82,7 @@
57 58 }
58 59
59 60 public boolean a(EntityHuman entityhuman) {
60 61 + if (!this.checkReachable) return true; // CraftBukkit
61 62 return this.g.getType(this.h).getBlock() != Blocks.CRAFTING_TABLE ? false : entityhuman.e((double) this.h.getX() + 0.5D, (double) this.h.getY() + 0.5D, (double) this.h.getZ() + 0.5D) <= 64.0D;
62 63 }
63 64
64 -@@ -101,4 +130,17 @@
65 +@@ -101,4 +131,17 @@
65 66 public boolean a(ItemStack itemstack, Slot slot) {
66 67 return slot.inventory != this.resultInventory && super.a(itemstack, slot);
67 68 }
68 69 +
69 70 + // CraftBukkit start
70 71 + @Override
71 72 + public CraftInventoryView getBukkitView() {
72 73 + if (bukkitEntity != null) {
73 74 + return bukkitEntity;
74 75 + }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut