Baritone AI pathfinder

Baritone AI pathfinder

72.7k Downloads

Add a 'loot' / 'pickup' command to pickup dropped items

DyonR opened this issue ยท 11 comments

commented

I would like to see a 'loot' or 'pickup' command which allows Baritone to pickup the specified list of items. It is similar to #mine, but instead of actually mining the block or items, it will just loot them.
A use case for how this can be used: I chop down a lot of trees, but because all the leaves decay sticks, apples and some remaining logs will remain on the ground. Using #pickup or #loot Baritone will automatically pickup these blocks and items
Example command:
#pickup minecraft:sticks, minecraft:oak_log, minecraft:apples
#loot minecraft:sticks, minecraft:oak_log, minecraft:apples
As far as I know, the #mine command already does something when the specified blocks are nearby, but it would be great to have this as a 'standalone' feature without needing Baritone to mine.

commented

+1

commented

Mob farming would be easier w/ this

commented

This workaround should be linked here: #3935 (comment)

commented

Yes

commented
commented

Here's some python code if it helps getting this started:

                        case "@@pickup"|"##pickup":
                            range = int(args[0]) if len(args) > 0 else 0
                            target_id = args[1].lower() if len(args) > 1 else None
                            playerPos = Player.getPlayer().getPos()
                            def simplePos(pos): return f"{int(pos.getX())} {int(pos.getY())} {int(pos.getZ())}"
                            items = dict()
                            for entity in World.getEntities():
                                if entity.getType() == "minecraft:item" and (target_id is None or entity.asItem().getContainedItemStack().getItemID()==target_id):
                                    pos = entity.getPos()
                                    if not range or distance(playerPos, pos) < range: items[pos] = entity
                            item_count = len(items)
                            if item_count > 0:
                                Chat.log(f"Picking up {item_count} dropped items within {range if range else 'infinity'} blocks")
                                for pos, item in items.items():
                                    if item.isAlive():
                                        exec(f"{cmd[0]}goto {simplePos(pos)}")
                                        wait_for_altoclef(task) if cmd[0]=="@" else wait_for_baritone(task)
                                Chat.log("JsMacros"+": "+f"Finished picking up {item_count} dropped items")
commented

Like a "pick these items up" list? Sounds useful. I would like to see this added.

commented

I'm pretty sure baritone already does this as it highlights all items that are dropped by the blocks that you break and for me, it goes back and picks them up

DyonR says that decaying blocks are not counted by Baritone, and drops like sticks and apples will not be picked up / highlighted

commented

Yeah! That would be awesome. For example when clearing out a huge area for building a huge castle, you still want those huge amounts of material, right? Now they are just being left there, waiting for the end of there existence... โ—๏ธฟโ—

commented

this would be a really great addition, maybe have a priority list for items that need to be picked up. what would really be cool is if it would place shulkers, put picked up items inside them (if there's no space) and the break them again

commented

I would really like this feature added, so you can farm stuff like apples if they drop from trees.