1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Get item/block from name?

Discussion in 'Facepalm' started by Daniktheboss, Jun 1, 2017.

  1. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    144
    GitHub:
    daniktheboss
    Hey, i want to get a block/item from a name. EX: i have a string "air", i want to somehow get its id, "0"
     
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
  3. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    144
    GitHub:
    daniktheboss
    works only for some blocks, EX: "torch" works, "cracked mossy stone" doesnt
     
  4. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Hm. You could create your own method for getting the string, by storing the information in an array in the plugin file, or in a json or yaml file. Then retrieve the string using the id(or an id and damage key). That may not be ideal for you, but that's the best alternative I can think of.
     
  5. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    You could first replace spaces with underscores and try it again.
     
  6. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    144
    GitHub:
    daniktheboss
    Who ever moved this to facepalm eat shit
     
  7. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    But it is facepalmy ¯\_(ツ)_/ ¯
     
  8. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    144
    GitHub:
    daniktheboss
    how
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.