Started by
Gunngg
on
Topic category: Help with Minecraft modding (Java Edition)
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
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 you want to check for dry farmland, do:
If you want to check for wet farmland, do:
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.