Commits
Jan Boerman authored and md_5 committed 93bc6c95534
264 264 | } |
265 265 | if (getHandle().activeContainer == formerContainer) { |
266 266 | return null; |
267 267 | } |
268 268 | getHandle().activeContainer.checkReachable = false; |
269 269 | return getHandle().activeContainer.getBukkitView(); |
270 270 | } |
271 271 | |
272 272 | private void openCustomInventory(Inventory inventory, EntityPlayer player, String windowType) { |
273 273 | if (player.playerConnection == null) return; |
274 - | Container container = new CraftContainer(inventory, this, player.nextContainerCounter()); |
274 + | Container container = new CraftContainer(inventory, this.getHandle(), player.nextContainerCounter()); |
275 275 | |
276 276 | container = CraftEventFactory.callInventoryOpenEvent(player, container); |
277 277 | if(container == null) return; |
278 278 | |
279 279 | String title = container.getBukkitView().getTitle(); |
280 280 | int size = container.getBukkitView().getTopInventory().getSize(); |
281 281 | |
282 282 | // Special cases |
283 283 | if (windowType.equals("minecraft:crafting_table") |
284 284 | || windowType.equals("minecraft:anvil") |
338 338 | if (((EntityPlayer) getHandle()).playerConnection == null) return; |
339 339 | if (getHandle().activeContainer != getHandle().defaultContainer) { |
340 340 | // fire INVENTORY_CLOSE if one already open |
341 341 | ((EntityPlayer)getHandle()).playerConnection.a(new PacketPlayInCloseWindow(getHandle().activeContainer.windowId)); |
342 342 | } |
343 343 | EntityPlayer player = (EntityPlayer) getHandle(); |
344 344 | Container container; |
345 345 | if (inventory instanceof CraftInventoryView) { |
346 346 | container = ((CraftInventoryView) inventory).getHandle(); |
347 347 | } else { |
348 - | container = new CraftContainer(inventory, player.nextContainerCounter()); |
348 + | container = new CraftContainer(inventory, this.getHandle(), player.nextContainerCounter()); |
349 349 | } |
350 350 | |
351 351 | // Trigger an INVENTORY_OPEN event |
352 352 | container = CraftEventFactory.callInventoryOpenEvent(player, container); |
353 353 | if (container == null) { |
354 354 | return; |
355 355 | } |
356 356 | |
357 357 | // Now open the window |
358 358 | InventoryType type = inventory.getType(); |