Baritone AI pathfinder

Baritone AI pathfinder

72.7k Downloads

Sel cleararea with lava/ water source

aria1th opened this issue ยท 0 comments

commented

If I try to use command #sel cleararea with selection which has lava or water in it, baritone will stop with printing message "Unable to do it".
Also, If we try to mine lava or water with water bucket, it prints error. (maybe similar to this?)
2020-05-16_16 26 28
[It happens when there are spilled lava, frequently.]

But, we could do 'replace lava netherrack', or some temporary blocks to remove lava. But since baritone does not distinguish lava source or flowing lava, it takes more time to replace it. or it even fails to do it.

To make cleararea possible with water or lava, I think the appropriate step would be:
def get_diagonal_safepoint(sourcepoint):
points = [p for p in (x +- 1, z +- 1, y + 1) in block(p) != lava (or water)]
if not points:
points = [p for p in (x +- 1, z +- 1, y + 2) in block(p) != lava (or water)]
return points

find safepoint to place netherrack directly at source. If sands (or gravity block) available, height could be ignored.

def expandarea(selection, liquidtype):
if liquidtype == minecraft.water: return selection.expand_volumetric(8)
if liquidtype == minecraft.lava : return selection.expand_volumetric(4)
return return selection

expand new temporary set of selection by considering possible liquid. chunkcaching or exploring would be needed to complete vast area.

while sources:= find_liquid_source():
max_height_source = max(sources.sortby_height)
baritone.goto(get_diagonal_safepoint(max_height_source))
waypoints = [get_diagonal_safepoint(ds) for ds in sources]
goals, points = pathfind(goals = sources.coordinates, wp = waypoints)
baritone.replaceblock(goals[0], baritone.throwawayblock) (or sand)
if goalnear() :
baritone.replaceblock(goalnear)
else:
baritone.sleep(60)

To clear liquids, maximum height would be important. go to highest safepoint, place block, wait 60 gametick( or place block for available goal), and go to next safepoint...

I think the smartest way to do it is using gravity block, but it could be unreliable for water(especially because of kelp and seagrass). Temporarily, adding sequences like 'replaceblock lava netherrack' before doing cleararea could reach the goal, but since baritone does not distinguish liquid source and flowing liquids, it wastes significant amount of time.

I believe there are several smarter way to do it, such as clearing area by layer.

Final checklist

  • I know how to properly use check boxes
  • I have not used any OwO's or UwU's in this issue.