How do you Specify a Crop's Stage?

Started by CreeperMinion on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do you Specify a Crop's Stage?

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.

Joined Dec 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I assume you have to get the…
Thu, 08/01/2019 - 08:51

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.

 

Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can you do that with block…
Sun, 04/26/2020 - 09:14

Can you do that with block code?

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Basically, what the code…
Thu, 12/21/2023 - 02:46

Basically, what the code means is: "Get integer property of [block] > [6]"