extending Container anvil

Discussion in 'Plugin Development' started by CaptainUniverse, Nov 23, 2014.

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

    CaptainUniverse

    hey guys im making a GUI and for one part i need anvil inventories open(I got that done here)
    Code:java
    1. public class AnvilContainer extends ContainerAnvil {
    2.  
    3. public AnvilContainer(EntityHuman entity) {
    4. super(entity.inventory, entity.world, 0, 0, 0, entity);
    5. }
    6.  
    7. @Override
    8. public boolean a(EntityHuman entityhuman) {
    9. return true;
    10. }
    11. }

    I open it using packets as shown here:
    Code:java
    1. EntityPlayer pl = ((CraftPlayer) p).getHandle();
    2. AnvilContainer container = new AnvilContainer(pl);
    3. container.getBukkitView().getTopInventory().setItem(0, new ItemStack(Material.NAME_TAG));
    4. int c = pl.nextContainerCounter();
    5. pl.playerConnection.sendPacket(new PacketPlayOutOpenWindow(c, 8, "Repairing", 9, true));
    6. pl.activeContainer = container;
    7. pl.activeContainer.windowId = c;
    8. pl.activeContainer.addSlotListener(pl);

    That all works fine. But now when i close the anvil inventory and there is something in it. The player picks it up. What method (or field) do i need to override so it doesn't drop items on close?
    Thanks
    CaptainUniverse
     
  2. Offline

    teej107

    CaptainUniverse What's wrong with using the methods that Bukkit provides?
     
  3. Offline

    ResultStatic

    teej107 it doesnt work at all.
     
  4. Offline

    CaptainUniverse

  5. Offline

    teej107

  6. Offline

    SuperOriginal

  7. Offline

    ResultStatic

  8. Offline

    CaptainUniverse

    So what do I have to do I know there is a method called on close but which one is it? I've seen the javadocs for ContainerAnvil but it doesn't explain anything anyone here know what I need to do?
     
  9. Offline

    Jaaakee224

  10. Offline

    CaptainUniverse

  11. Offline

    CaptainUniverse

  12. Offline

    CaptainUniverse

  13. Offline

    CaptainUniverse

  14. Offline

    CaptainUniverse

    BUUUUUUUUUUUUUUUUUUUUUUUMP
     
  15. Offline

    CaptainUniverse

    BUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUMP

    You have forced me to use tags :(
    fireblast709 Skionz mythbusterma

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

    Skionz

  17. Offline

    CaptainUniverse

    That is what i used Skionz . But I just need to know one thing. What method is called when a player closes the inventory. I need to know! Thanks
     
  18. Offline

    Skionz

  19. Offline

    CaptainUniverse

    So what do i do to remove all the items from the anvil on close because like i said the player ends up picking them up

    OOOH whole new idea Skionz !!!! But what event is called when a crafting table or chest or anvil drops an item? ItemSpawnEvent?

    <Edit by mrCookieSlime: Merged posts. Please don't double post. There is an Edit Button right next to the Date.>
     
  20. Offline

    Skionz

  21. Offline

    CaptainUniverse

    Ok I'll try that!
     
Thread Status:
Not open for further replies.

Share This Page