[Solved] Get BlockType by ID

I know, this question was already posted but I’m totally new to Sponge and don’t seem to be able to make this to work:

BlockType blockType = GameRegistry.getType(BlockType.class, "id");

This should work:

Sponge.getRegistry().getType(BlockType.class, "minecraft:dirt")

Remember the item types are still being registered in the preinit/init phase so you should only try to access it in GamePostInitializationEvent or afterwards

1 Like

Thanks :grinning:

Anything provided by Vanilla however is ready as soon as plugins are initialized.