michaelzangl / minebot

Minebot
GNU General Public License v3.0
144 stars 48 forks source link

How to detect if lumberjack finished cutting tree #191

Closed ghost closed 3 years ago

ghost commented 7 years ago

Checked API and examples and saw that only option is to try to check coordinates if player standing in tree. My tree farm is in grid so I made two for loops to get all tree coords however I cant reliably check if player is standing on these coords since you sometimes need to round down or round up player pos and I cant figure it out. Is there any other method to check if tree is finished?

I think another methods would be to check hotbar to see when bot switch to sapling (to replant) and back to axe or detect if bot did right click. However no idea how to do it using script.

michaelzangl commented 7 years ago

No, there is currently no reliable method. The bot may even be interrupt inside a tree (e.g. eating), so this is pretty hard to detect.

The easiest way is to catch the player while walking to the next tree. Simply add a one wide barrier as stop condition (like 9 < x && x < 10). You need to use the force option, otherwise your check won't be done.

ghost commented 7 years ago

My tree farm only have 2 blocks gap so no space to add barriers. If it was 3 blocks gap then it would work. (dont have space for that). And if I set barrier like 0.10 of first block and 0.10 second block then I dont think that it would trigger

michaelzangl commented 7 years ago

It triggers as soon as the barrier is wider than the character moves in one game tick (~0.3m)