Stop item dropping from a workbench?

Discussion in 'Plugin Development' started by Rprrr, Jan 25, 2013.

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

    Rprrr

    Hi,

    I want to cancel the dropping of items when you close a workbench with things in it.. I tried a few events, but I couldn't figure out how to do it.

    Does anyone know if this possible, and if yes, how?

    Thanks!
     
  2. Offline

    CorrieKay

    Do you want the items to just dissapear, or go into the players inventory?
     
  3. Offline

    Rprrr

    CorrieKay
    I would like them to dissapear.
     
  4. Offline

    Codisimus

    I have been trying to do this myself and I cannot get either way to work.
     
  5. Offline

    RealDope

    I don't think this is currently possible. InventoryCloseEvent only fires for player inventories as far as I can tell.
     
  6. Offline

    skipperguy12

  7. Offline

    Codisimus

    no the event is called but even if you remove the item from the inventory at that point it still seems to drop.

    I thought about that... hoping there is a better way.
     
  8. Offline

    skipperguy12

    Codisimus

    Why? Have a hashmap that stores player, and miliseconds since last used a crafting table. Then have a set variable, and keep checking every like 2 seconds if:
    var - hashmap_time > var

    Do that in a itemSpawnEvent, and if it returns true, then the nearest entity/player JUST used a crafting table, and you can then just delete the drop.
     
  9. Offline

    Codisimus

    skipperguy12 yes, I suppose that wouldn't be too bad. I am actually no longer in need of this bc I will be using a chest inventory instead but I wasn't the OP anyway.
     
Thread Status:
Not open for further replies.

Share This Page