Raw farmlands and custom crops

Started by Gunngg on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Raw farmlands and custom crops
Fri, 10/18/2019 - 12:11 (edited)

I am tring to make a custom crop. I made a seed procedure like this:

When right-clicked on block:

If block at x y z == farmland

    Place crop-stage-0 at x y+1 z

But if the farmland is wet, it is no longer placeable. Also, this issue has a best friend. I tried to make update tick procedure for all crop stages at once "if not block at x y-1 z == farmland: (Remove block at x y z)" And it's not working too. It works only with dry farmland. I tried to make "If NBT tag..." condition, but nothing changed.

Could you help me with that?..

Edited by Gunngg on Fri, 10/18/2019 - 12:11
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The reason why this happens…
Fri, 10/18/2019 - 12:29

The reason why this happens is because you use the double == sign.

In programming, = is for setting a value and == is for comparing. However in the procedures = is for comparing and == is for comparing + checking the metadata.

If you do "if item = iron_pickaxe" then you will get true whenever you have a pickaxe, no matter the durability, where as if you have "if item == iron_pickaxe" then it will only return true if the iron pickaxe also has a full durability state and is unaltered from the original.

If you want to check for farmland simply, do:

If block at x y z = farmland

    Place crop-stage-0 at x y+1 z

If you want to check for dry farmland, do:

If block at x y z == farmland

    Place crop-stage-0 at x y+1 z

If you want to check for wet farmland, do:

If NOT block at x y z == farmland AND block at x y z = farmland

    Place crop-stage-0 at x y+1 z

 

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you, smart person! I…
Fri, 10/18/2019 - 13:19

Thank you, smart person! I just couldn't know this, because I learned python and as you said, programming and procedure "=" and "==" are different. This thing also broke other feature of my mod.