public static Item ParseItemType ( String s , boolean checkBlocks ) { if ( s == null ) return null ; Item item = ( Item ) Item . REGISTRY . getObject ( new ResourceLocation ( s ) ) ; // Minecraft returns null when it doesn't recognise the string if ( item == null && checkBlocks ) { // Maybe this is a request for a block item? IBlockState block = MinecraftTypeHelper . ParseBlockType ( s ) ; item = ( block != null && block . getBlock ( ) != null ) ? Item . getItemFromBlock ( block . getBlock ( ) ) : null ; } return item ; }
Attempts to parse the item type string .