Solved How to get display name of a placed block?

Discussion in 'Plugin Development' started by Timpotim, Sep 2, 2013.

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


    If I change the name of a dispenser and place it, the name will be at the top of the gui, so placed blocks can have different names. My question is: Is it possible to get the display name of a placed block like a dispenser?

    Thanks in advance!
  2. Offline


  3. Offline


    Yes, it is.

    Block b; //Block of the dispenser
    Dispenser d = (Dispenser) b.getState();
    String title = d.getInventory().getName();
  4. Offline


    Thank you! I will try it
  5. Offline


    Technius Is it it also possible with other blocks, like dirt?
  6. Offline


    Only if you check the name of the item when it's being placed. The name is gone once the block is placed in the world, you can't check it again unless it has an inventory that keeps the name.
  7. Offline


    Ok! Thanks!
Thread Status:
Not open for further replies.

Share This Page