Posted September 2, 20196 yr i have an item obtained from player.inventory.getStackInSlot(i).getItem(); I was expecting to just be able to compare it as item == Items.DIRT However, it appears items does not contain any blocks, and you cannot compare it to the Blocks enum. How would i go about seeing if the item in question was a dirt block? Edit: forgot to mention, forge for 1.12.2 Edited September 2, 20196 yr by NateKomodo mark as solved
September 2, 20196 yr Check if it's an ItemBlock. If it is, cast to ItemBlock and call the getBlock() method to get the block. Edited September 2, 20196 yr by felinoid clearer
September 2, 20196 yr Author 4 minutes ago, felinoid said: Check if it's an ItemBlock. If it is, cast then call ItemBlock.getBlock(). This worked, thanks
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.