Topic category: Help with Minecraft modding (Java Edition)
So essentially, I wanted to make an item that when you right-click full-grown wheat, it has a 50% chance to drop extra wheat, simple enough, right? But the way that 1.9.0 is set up is that if I select the wheat crop through the block coding, then it applies to every stage of wheat. So the if statement is,
if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getBlock() == Blocks.WHEAT.getDefaultState().getBlock())) {
world.setBlockToAir(new BlockPos((int) x, (int) y, (int) z));
I understand that much, but how can I make it so that it identifies what stage of wheat it applies to. I feel like such an idiot for asking a question like this, so sorry in advance for wasting anyone's time, I'm new to any coding that isn't blocks/scratch (I know, kind of sad right).
Thank you in advance.
I assume you have to get the Age value of BlockCrop and make the game check, if it's age value equals 7 or higher. Not sure but I think you have to use "Blocks.WHEAT.getDefaultState().withProperty(this.getAgeProperty().intValue(7))))" Instead of "Blocks.WHEAT.getDefaultState().getBlock()))". Not sure though.
Can you do that with block code?
Basically, what the code means is: "Get integer property of [block] > [6]"
So, ja, you can.