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

    Timpotim

    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

    TGF

  3. Offline

    Technius

    Yes, it is.

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

    Timpotim


    Thank you! I will try it
     
  5. Offline

    Timpotim

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

    Garris0n

    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

    Timpotim

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

Share This Page