Skip to content

Commit 0ffb20d

Browse files
committed
Fixed bug
1 parent 0630364 commit 0ffb20d

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

src/main/java/baritone/pathing/clutch/Clutch.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
import net.minecraft.world.item.Item;
3232
import net.minecraft.world.item.ItemStack;
3333
import net.minecraft.world.level.block.state.BlockState;
34-
import net.minecraft.world.phys.Vec3;
35-
import net.minecraft.world.phys.shapes.Shapes;
3634
import net.minecraft.world.phys.shapes.VoxelShape;
3735

3836
public abstract class Clutch {

src/main/java/baritone/pathing/clutch/ClutchUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static boolean isClutchBlock(BlockState state) {
5757
}
5858

5959
static boolean blockClutch(IBaritone baritone, MovementState state, BlockPos dest, MutableClutchResult result, boolean allowDown) {
60+
state.setTarget(new MovementState.MovementTarget(baritone.getPlayerContext().playerRotations().withPitch(90), true));
6061
if (MovementHelper.attemptToPlaceABlock(state, baritone, dest, allowDown, true, true, result.item.getItem()) == MovementHelper.PlaceResult.READY_TO_PLACE) {
6162
state.setInput(Input.CLICK_RIGHT, true);
6263
return true;

src/main/java/baritone/pathing/clutch/clutches/TwistingVineClutch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ public boolean isAcceptedItem(Item item) {
3333

3434
@Override
3535
public boolean compare(BlockState state) {
36-
return state.is(Blocks.TWISTING_VINES);
36+
return state.is(Blocks.TWISTING_VINES) || state.is(Blocks.TWISTING_VINES_PLANT);
3737
}
3838
}

src/main/java/baritone/pathing/movement/movements/MovementDescend.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ public static void dynamicFallCost(CalculationContext context, int x, int y, int
190190
}
191191
break;
192192
}
193-
BlockState aboveBlock = context.get(destX, newY + 1, destZ);
194193
Clutch nonSolidClutchBlock = null;
195194
if (unprotectedFallHeight > context.maxFallHeightNoClutch) {
196195
for (Clutch clutch : ClutchUtils.CLUTCHES) {
@@ -214,29 +213,32 @@ public static void dynamicFallCost(CalculationContext context, int x, int y, int
214213
}
215214
}
216215
}
216+
BlockState aboveBlock = context.get(destX, newY + 1, destZ);
217217
if (unprotectedFallHeight - 1 <= context.maxFallHeightClutch &&
218218
context.allowPlace &&
219219
!context.isPossiblyProtected(destX, newY + 1, destZ) &&
220220
context.worldBorder.canPlaceAt(destX, destZ) &&
221-
MovementHelper.isReplaceable(destX, newY + 1, destZ, aboveBlock, context.bsi) &&
222-
!aboveBlock.hasProperty(BlockStateProperties.DOUBLE_BLOCK_HALF)) {
221+
MovementHelper.isReplaceable(destX, newY + 1, destZ, aboveBlock, context.bsi)) {
223222
for (Clutch clutch : ClutchUtils.CLUTCHES) {
224223
ItemStack item = clutch.getClutchingItem(context);
225224
if (clutch.getFallDamage(unprotectedFallHeight - 1) <= context.maxFallHeightNoClutch &&
226225
clutch.isPlaceable(context, destX, newY, destZ, ontoBlock) &&
227226
item != null) {
228227
double newCost = tentativeCost + context.placeBlockCost;
228+
boolean solidPlace;
229229
if (clutch.isSolid(context)) {
230230
newCost += ActionCosts.distanceToTicks(unprotectedFallHeight, 0.08, velocity) + clutch.getAdditionalCost();
231+
solidPlace = true;
231232
} else if (MovementHelper.canWalkOn(context, destX, newY, destZ, ontoBlock)) {
232233
newCost += clutch.getCost(unprotectedFallHeight, 1.0, velocity).first();
234+
solidPlace = false;
233235
} else {
234236
continue;
235237
}
236238
if (newCost < res.cost) {
237239
res.cost = newCost;
238240
res.x = destX;
239-
res.y = newY + 2;
241+
res.y = newY + (solidPlace ? 2 : 1);
240242
res.z = destZ;
241243
if (clutchRes != null) {
242244
clutchRes.clutch = clutch;

src/main/java/baritone/pathing/movement/movements/MovementFall.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class MovementFall extends Movement {
4545
private final MutableClutchResult clutchResult = new MutableClutchResult();
4646

4747
public MovementFall(IBaritone baritone, BetterBlockPos src, BetterBlockPos dest) {
48-
super(baritone, src, dest, MovementFall.buildPositionsToBreak(src, dest)); // TODO add `toPlace`
48+
super(baritone, src, dest, MovementFall.buildPositionsToBreak(src, dest), dest.below());
4949
}
5050

5151
@Override
@@ -115,6 +115,7 @@ public MovementState updateState(MovementState state) {
115115
}
116116
Vec3 destCenterOffset = new Vec3(destCenter.x + 0.125 * avoid.getX(), destCenter.y, destCenter.z + 0.125 * avoid.getZ());
117117
return state.setTarget(new MovementTarget(RotationUtils.calcRotationFromVec3d(ctx.playerHead(), destCenterOffset, ctx.playerRotations()), true));
118+
// return state;
118119
}
119120

120121
private Direction avoid() {

0 commit comments

Comments
 (0)