Anvil GUI

Discussion in 'Plugin Development' started by Samthelord1, Aug 11, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Samthelord1

    Hi, I've been working on the command /anvil making the anvil GUI appear, and I've come across a few problems on the way, first, I tried making a new inventory, setting it to anvil, as chasechocolate suggested
    Code:java
    1.  
    Code:java
    1. [quote="chasechocolate, post: 1563388, member: 90645296"][/quote]
    Code:java
    1. [quote="chasechocolate, post: 1563388, member: 90645296"][/quote]
    Code:java
    1. [quote="chasechocolate, post: 1563388, member: 90645296"]
    2. [SIZE=4][FONT=Times][COLOR=#000000]player.openInventory(anvil);[/COLOR][/FONT][/SIZE][/quote]
    then I found out that that didn't work, so I continued to read through the thread and found @Tirelessly's method
    which also didn't work, so finally I went on to use @Cybermaxke's method, which didn't work either,
    [/FONT][/SIZE][/COLOR]

    I'm running out of ideas and I don't know what to try next, help would be greatly appreciated.
    I went on to test chasechocolate's method, but changing it to furnace instead, and it worked, I'm starting to think theres something wrong with the anvil GUI... the thread is here: https://forums.bukkit.org/threads/how-can-i-open-an-anvil-window.131493/[/CODE][/COLOR][/FONT][/SIZE][/quote]

    I have no idea whats happened to some of the code on this o.0

    somethings wrong with bukkit, it's generating random lines o.0

    hopefully you can still read despite the mess up...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  2. Offline

    Tirelessly


    Code:
    public static void openAnvil(Player player) {
        EntityPlayer p = ((CraftPlayer) player).getHandle();
        AnvilContainer container = new AnvilContainer(p);
        int c = p.nextContainerCounter();
        p.playerConnection.sendPacket(new Packet100OpenWindow(c, 8, "Repairing", 9));
        p.activeContainer = container;
        p.activeContainer.windowId = c;
        p.activeContainer.addSlotListener(p);
    }
     
    public class AnvilContainer extends ContainerAnvil {
        public AnvilContainer(EntityHuman entity) {
            super(entity.inventory, entity.world, 0, 0, 0, entity);
        }
     
        @Override
        public boolean a(EntityHuman entityhuman) {
            return true;
        }
    }
    
    I'd be willing to bet it's a bukkit API error at this point
     
  3. Offline

    Samthelord1

    Tirelessly tbh, thats what I have concluded, I've tested several of the different ones, and this seems to be the only one not working, HOWEVER, using the furnace to cook posts a VERY LONG stack trace in the console.

    Tirelessly I thought I would be best of generating the blocks in -'s then opening them for the players, then scheduling a minute and deleting them.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
Thread Status:
Not open for further replies.

Share This Page