Skip to content

Add clutches. #4787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 21 commits into
base: 1.19.4
Choose a base branch
from
Draft

Add clutches. #4787

wants to merge 21 commits into from

Conversation

Murat65536
Copy link
Contributor

@Murat65536 Murat65536 commented Jun 10, 2025

Closes #3226
Just a few more clutches to Baritone.

  • Ladders
  • Hay Bales (Fall distance should definitely be lower on this one since it only blocks 80% of damage)
  • Powdered snow
  • Twisting vines
  • Honey block (This one is risky and kinda hard to implement so probably not going to be added. Also can't have blocks adjacent to it since it's SLIGHTLY smaller than an actual block and you wont stick then)
  • Vines
  • Bed (Worse than Hay bale by 30% and has the different colors that all need to be included) (Also since this is 2 blocks wide you can't place in some orientations)
  • Slime Blocks (Usually they launch you back up in the air but this can be avoided by holding jump as you hit them)
  • Boat (An entity... might be difficult. A good thing about this is that you don't need to be directly under it, you just need the ability to right click on it) (Also has a bunch of variants) (Also has the chest boats)
  • Minecart (A little more complicated since you also need to place a rail if there isn't one already)
  • Horse (Same as boat but we need to check if it's tamed or not since untamed horses require you to have nothing in your hand to mount while tamed horses just don't care)
  • Strider (Would need to check if it has a saddle already on it. If it does, just mount. If it doesn't, check if we have a saddle and if we do, place the saddle then mount)
  • Donkey (Same has horse)
  • Mule (Same as horse)
  • Pig (Same as strider)
  • Cobweb (Hard to get out of. Makes me think that falling with different items should have different costs coming with them. Should we think of a way to fall at the edge so we get out faster or is breaking them just easier.)
  • Lava (Should there be some kind of check with this to see if the player has fire resistance? I honestly don't know)
  • Scaffolding (Can only be placed on solid blocks)
  • Literally any block (Yes, this BASICALLY does nothing but it is 1 health point less of fall damage so TECHNICALLY it's better)
  • Items (Picking up a water bucket for example and then placing it)

I might've missed a few things so let me know if there's anything else. I would say camels but they aren't in 1.19.4. Also with water, we should be checking to make sure we aren't placing on something that wouldn't stop our fall and just waterlog the block. These include leaves, mangrove roots, top slabs, etc. Also also with ladders and vines, we should be checking if there is a block north, south, east, or west of the ladder or vine being placed since it won't place otherwise. (done)

  • Should we be adding a setting for every single new clutch? Baritone's settings are already impossible to navigate in-game (we desperately need a UI) so doing this won't exactly help with that issue.
  • We aren't checking if there's an entity under the place we want to clutch, which could lead to the clutch failing. The easiest way to avoid this would just be to not do the clutch, but that wouldn't be the best solution. Maybe have Baritone clutch on a nearby wall or a few blocks away from the initial landing spot? Seems a little too annoying to program and I don't really feel like doing this for something this uncommon but I'll just put it out there I guess.
  • If the item to clutch with is in the inventory instead of the hotbar, the bot just acts like it isn't there. Even when allowInventory is on.
  • If we aren't able to do the clutch on the bottom block, we should still be able to place it off a wall and clutch there. Ideally we should be scanning from the dest spot on the floor all the way up to maxFallHeightNoClutch, so that we can either go right through the clutch or break a block to fall. Maybe even chaining multiple clutches together is also something that could happen but all of this seems like something I don't want to spend countless painful hours on to get even a rough draft working :(.
  • We should be checking the side blocks to see if we can place on those if we can't place on the bottom block. This is so we can stop completely relying on the bottom block for clutches. This also means MutableClutchResult should also have a direction parameter to keep track of this. Edit: I just repeated myself... I'll keep it in though since it adds a few more details.
  • Ladder clutches sometimes result in Baritone hitting the top of the ladder, resulting in fall damage. Maybe something that would direct Baritone away from the ladder but still close enough to clutch? I'm thinking an overridable method in Clutch that usually defaults to the middle of the block but can be changed for ladders.
  • Maybe have a setting that breaks the block you clutched on after the clutch is done. Would need to adjust costs for this.
  • Even if the block is waterloggable, if we can still be inside that water (ex. half slab), it should be allowed. An even more complicated version of this would be clutching on the parts of stairs that are waterlogged. There would need to be air/other stairs facing the opposite direction/slabs around them so we can lose the 0.5 blocks to hit the water. This is too hard though so I'm not going to bother.

@Murat65536
Copy link
Contributor Author

Murat65536 commented Jun 10, 2025

We need to define the items to clutch with in CalculationContext and MovementFall right now. It would be great if we could combine the 2 definitions.
Edit: I just put it all in MovementHelper. This should really be an enum since then it could also contain the actual block, if you can pick it up, and any other extra gimmicks (ex. needing to hold jump while slime block clutching).

@ItsAGamer214
Copy link

Hey! Maybe I can get to work on a UI? I was working on a swarm feature for Baritone and I think I have a good understanding of the codebase. Or maybe if there are any other features you'd like help with first?

@Murat65536
Copy link
Contributor Author

@ItsAGamer214 If you want to contribute to the repository, open up an issue. From there you can create a draft PR, commit to it, open it for review, and get it merged. A UI isn't in the scope of this specific issue but if you want to make one, feel free to do so. If you want to work on another thing instead, we have like 800 issues open (some are just trolls and others make no sense but there are still good ones that could be worked on).

@Murat65536
Copy link
Contributor Author

Murat65536 commented Jun 11, 2025

Actually, clutches should all be in their own separate classes extending an abstract class. That would be much cleaner.

@Murat65536
Copy link
Contributor Author

Murat65536 commented Jun 14, 2025

Codacy is probably just failing because of that weird for loop that’s basically a while true. It should actually be checking until y=(whatever the minimum height is).
Edit: changed it so it looks less like a wannabe while loop.

@Murat65536
Copy link
Contributor Author

Murat65536 commented Jun 17, 2025

Ladders and vines are able to be placed on stairs when the face is fully solid but the code doesn't let them. Looking at the source code for those blocks should help solve this.
Edit: Done

@Murat65536
Copy link
Contributor Author

Only Codacy error is for long parameter lists and I'm just going to ignore that.

@Murat65536
Copy link
Contributor Author

Murat65536 commented Jun 18, 2025

It would be really cool if I just give each clutch a properties variable corresponding to an enum. This way, we could skip repeating code segments. ex. pickupable, disableBottomBlockClutch, waterlogging, etc. Then all the logic for those could just go in a helper interface. This all kind of makes it seem like clutches should be in their own separate folder and everything but I don't really know...
Edit: Moved clutches to their own folder and added an enum with properties. A helper interface is probably unnecessary though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make more use of clutchs
2 participants