When a block is registered, ''only'' a block is registered. The block does not automatically have an <code><nowiki>BlockItem</nowiki></code>. To create a basic <code><nowiki>BlockItem</nowiki></code> for a block, one should use <code><nowiki>new BlockItem(block)</nowiki></code> and match the registry name between the two objects. Custom subclasses of <code><nowiki>BlockItem</nowiki></code> may be used as well. Once a <code><nowiki>BlockItem</nowiki></code> has been registered for a block, <code><nowiki>Block#asItem</nowiki></code> can be used to retrieve it. <code><nowiki>Block#asItem</nowiki></code> will deafult to <code><nowiki>Items#AIR</nowiki></code> if there is no <code><nowiki>BlockItem</nowiki></code> for the <code><nowiki>Block</nowiki></code>, so if you are not certain that there is an <code><nowiki>BlockItem</nowiki></code> for the <code><nowiki>Block</nowiki></code> you are using, check for <code><nowiki>Items#AIR</nowiki></code>.}} | When a block is registered, ''only'' a block is registered. The block does not automatically have an <code><nowiki>BlockItem</nowiki></code>. To create a basic <code><nowiki>BlockItem</nowiki></code> for a block, one should use <code><nowiki>new BlockItem(block)</nowiki></code> and match the registry name between the two objects. Custom subclasses of <code><nowiki>BlockItem</nowiki></code> may be used as well. Once a <code><nowiki>BlockItem</nowiki></code> has been registered for a block, <code><nowiki>Block#asItem</nowiki></code> can be used to retrieve it. <code><nowiki>Block#asItem</nowiki></code> will deafult to <code><nowiki>Items#AIR</nowiki></code> if there is no <code><nowiki>BlockItem</nowiki></code> for the <code><nowiki>Block</nowiki></code>, so if you are not certain that there is an <code><nowiki>BlockItem</nowiki></code> for the <code><nowiki>Block</nowiki></code> you are using, check for <code><nowiki>Items#AIR</nowiki></code>.}} |