Hi, I was wondering if there was any way to force the little inventory popup to show with a given inventory? I was thinking whether or not it was possible to make a plugin that let you open chests that had a block on top, but that requires me to somehow open the inventory popup at will.
Yes there is. Give this a shot: Code: CraftInventory cInventory = (CraftInventory)theChest.getInventory(); CraftPlayer cPlayer = (CraftPlayer)thePlayer; cPlayer.getHandle().a((IInventory)cInventory.getInventory());
Thanks, I'll give it a try! Works! Mostly. It's having a problem opening double chests, it seems like that method "a" only opens a single chest. Well, it will open a double chest, but only with one side of it.. if that makes sense. Is there anywhere you're getting what that method means, or did you figure it out working on one of your plugins? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
I figured it out just looking in the minecraft source-code just now. I did realise it wouldn't work for double chests, but I thought it would complicate matters less to give you the solution a bit at a time ;D You can combine two single chests into a double chest as follows: Code: CraftInventory cInventory1 = (CraftInventory)theFirstChest.getInventory(); CraftInventory cInventory2 = (CraftInventory)theSecondChest.getInventory(); IInventory IChest = (IInventory)new InventoryLargeChest("Large chest", cInventory1.getInventory(), cInventory2.getInventory()); cPlayer.getHandle().a(IChest); But you'll have to manually search adjacent blocks for chests to get the two separate cInventories
Thanks! Just got working on that part of it sorta. I think I'll release this tomorrow, you're gonna get basically all of the credit though
Release http://forums.bukkit.org/threads/mech-cabinet-v0-3-get-rid-of-arbitrary-chest-restrictions-556.9015/