Set block with Special/No Drops?

Discussion in 'Plugin Development' started by NerdsWBNerds, Mar 23, 2015.

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

    NerdsWBNerds

    Is there any way to change an item's drops before the block break event?
    I want players to be able to place blocks which won't drop anything without having to store those blocks in a file and listen for the break, because there could be lots and lots of these drops and I don't want to have to search through large arrays on break events.

    For instance, is there anything that would work like this.

    onBlockPlace

    if(noWantDrops()){
    e.getBlockPlaced().setDrops(null);
    }

    Then if someone broke that placed block, no drops would spawn.
     
  2. Offline

    Lolmewn

    If you use a HashSet to store the blocks (or their locations), lookup time is O(1) - instant. There's no "searching" when using hashes, which makes them great for potential big sets or lists.
     
Thread Status:
Not open for further replies.

Share This Page