Hey,
I want to check, if the item in player’s hand is a block or an item and output infos about blocks / items.
I have following code (outputs block infos)
if (player.getItemInHand().isPresent()) {
//player.getItemInHand().get().getItem().getId();
BlockState blockState = player.getItemInHand().get().getItem().getBlock().get().getDefaultState();
//send message
userManager.sendLittleInfo(blockState.toString(), player);
}
Because I want to output infos about items and blocks, i have to check, if the itemInHand is a block or an item…
If it’s a block:
BlockState blockState = player.getItemInHand().get().getItem().getBlock().get().getDefaultState();
… and if it’s an item (???)
Thanks