Hi all. I'm trying to get the age of a patch of vanilla potatoes from a tile entity, but I can't seem to find a way to do it. I've already seen this post regarding this in v1.10 but the code examples don't quite have enough info in them for me (an almost semi-experienced modder) to be able to replicate it and they examples aren't explained in detail. I have also read and mostly understand the concept of blockstates (painful but useful ) from this forge readthedocs page.
I have tried adding logging code and can get the properties as a PropertyInteger:
from the potatoes but can't get the actual value of age from it. It says it at the end of the first one (from printing out the results of the world.getBlockState(blockPos).getProperties() method where the blockPos is that of the potatoes), but I don't know how to retrieve that value. I've looked at the possible methods I can use and none seem to help.
-----------------------------
My tile entity class -- relevant methods at the bottom. It should break potatoes/ replace them with air and spawn a EntityItem of an Amethyst Potato at the broken block's BlockPos (can break blocks but doesn't spawn entity but that's a separate issue -- right now it just doesn't get through the check for the crop's age)
-----------------------------
Anyway! Wow that's a lot of text! Any help welcome I don't know what else I can try!
Thanks!