Baritone AI pathfinder

Baritone AI pathfinder

72.7k Downloads

Autofarm ignores edge of farming radius

AFellowPlayer opened this issue ยท 12 comments

commented

Some information

Operating system: Windows 10
Java version: 8
Minecraft version: 1.15.2 / 1.13.2
Baritone version: 1.5.3
Forge mods (if used):

How to reproduce

Just use the autofarm on a large enough farm (mine is 50 x 50). Baritone will farm crops up to 4 blocks away, but will only replant the nearest 3 crops. This leads to large spots and lines of unreplanted farmland.

Modified settings

To get the modified settings run #modified in game
assumeWalkOnWater, chatControl, replantNetherwart

I've tried it after a reset, and with several other options changed. No matter what, the problem persists.

Final checklist

  • I know how to properly use check boxes
  • I have included the version of Minecraft I'm running, baritone's version and forge mods (if used).
  • I have included logs, exceptions and / or steps to reproduce the issue.
  • I have not used any OwO's or UwU's in this issue.
commented

can't reproduce
for me it breaks crops up to 4 blocks away, replants them in a 3 block radius and then starts walking to replant the rest
I used Baritone 1.5.3 with Minecraft 1.15.2-forge-31.1.0

commented

can't reproduce
for me it breaks crops up to 4 blocks away, replants them in a 3 block radius and then starts walking to replant the rest
I used Baritone 1.5.3 with Minecraft 1.15.2-forge-31.1.0

How big is the farm you're using? The issue is specific to large farms. If it has a ton of space to move, then it'll follow a straight line. It'll move forward to replant blocks in it's current path, but the blocks on the side and behind it that are 4 blocks away and not currently in the path that the bot is using, will not be replanted.

commented

Have you cancelled it or did it say "Farm failed"?

commented

Then try getting rid of items before it stops from full inventory
I'm interested in whether it leaves the empty spots or walks to them at the end

commented

Usually it stops from having a full inventory before either of those happen.

commented

Did a test creative mode (to prevent drops) test with a 50x50 full grown farm and it did not exactly show the behaviour you described.
Basically it had a strip of grown crops surrounded by empty spots left, started planting and harvesting it from the middle to one end and then refused to find the leftover crops/ empty spots unless I moved closer.
In the end there was a square of grown crops with an outline of empty farmland left.

commented

Did the same again in survival with some command blocks to keep the inventory clean. It left a single empty spot.

commented

It fills them in whenever they are closer than the next plant and still in range.
The "in range" thing is what confuses me, because I thought that is "in renderdistance" but I saw it ignoring crops and farmland I could clearly see in about 30 blocks distance (renderdistance is 160blocks/10chunks by default and in my case)
My random guess was that it searches the n closest crops and then checks their age, but that does not explain why it ignores farmland. Guess I have to look at the code for that ๐Ÿ˜ž

commented

Does it replant them while passing through? Or does it circle back and refill them later on? Seems like the issue may come from having to stop and chest the inventory for it to get through the whole farm.

In my farms, I try to get them big enough to a point where baritone ALWAYS has crops to harvest. While it's harvesting, it may fill in old gaps while creating new gaps, but having those gaps at all reduces the overall efficiency of the farm, and there doesn't seem to be a way to avoid making those gaps in the first place.

commented

Yep. It searches the 256 nearest blocks that are crops or farmland and then filters out. That means in a full planted farm it has a viewing range of a bit more than 11 blocks. To "see" the whole 50x50 it would need to search for up to 50000 blocks. That would probably kill performance.
Also it does not cache the empty spots and instead re-builds the list every mineGoalUpdateInterval ticks

commented

Sorry for my late response.

I see. The problem with that approach of refilling blocks when they are closer than the next plant is that it creates a ton of situations where Baritone will simply ignore replanting farmland that it just broke, if the next plant up the line is closer than the furthest plant that Baritone broke previously. It could still be in range, but since it's one block further to the left or right, two entire one-block lines of crops will be completely ignored for replanting.

It would make more sense if it just replanted the blocks it broke when it breaks them, instead of waiting for future passes through the area to refill those blocks. It doesn't need to "see" anymore than it already does to do that, but I guess it would require some sort of caching to keep track of which blocks were broken. Maybe I'll fork the code and look into adding this myself if possible.

Another thing I suspect is that block reach distance has an effect on it. Perhaps the distance of the furthest line of farmland blocks is too far, and that creates a situation where the crop itself is within reach distance to break, but the farmland block isn't within reach distance to replant. I'm not entirely familiar with how block distance is calculated, so I'm not sure about this.

commented

Sorry for my late response.

No problem for me, late is better than never

I see. The problem with that approach of refilling blocks when they are closer than the next plant is that it creates a ton of situations where Baritone will simply ignore replanting farmland that it just broke, if the next plant up the line is closer than the furthest plant that Baritone broke previously. It could still be in range, but since it's one block further to the left or right, two entire one-block lines of crops will be completely ignored for replanting.

exactly

It would make more sense if it just replanted the blocks it broke when it breaks them, instead of waiting for future passes through the area to refill those blocks. It doesn't need to "see" anymore than it already does to do that, but I guess it would require some sort of caching to keep track of which blocks were broken. Maybe I'll fork the code and look into adding this myself if possible.

That cache could also be used to only replant the type of crop that was already growing there
I don't have time for it atm so I am happy if you do it

Another thing I suspect is that block reach distance has an effect on it. Perhaps the distance of the furthest line of farmland blocks is too far, and that creates a situation where the crop itself is within reach distance to break, but the farmland block isn't within reach distance to replant. I'm not entirely familiar with how block distance is calculated, so I'm not sure about this.

Yes that happens and I already had some fun-time with this and backfill