Solved How to get all available Blocks

Discussion in 'Spigot Plugin Development' started by RoiEX, Jun 26, 2016.

  1. Hi there, I'm trying to get a Collection (Array would also be possible) of all available Blocks in the currently used version e.g. {"air","stone"...} etc.
    I think this requires NMS - no problem at all...
    In the NMS Block class there is a registry field which contains the required Block types:
    Code (Text):
    public static final RegistryBlocks<MinecraftKey, Block> REGISTRY = new RegistryBlocks(a);
    My problem is, that I can get this field via reflection, but I can't get the String names of those blocks being registered in there e.g. "minecraft:air","gold_ore" etc.
    Any ideas?
  2. Omnivion


    Use Arrays#stream on the values() of Material, then filter it by Material#isBlock
    • Winner Winner x 1
  3. Thanks! That was what I was searching for!