setting goal to playerFeet is fixed and misc cleanup
This commit is contained in:
parent
ae2d1131a5
commit
d3ae1d27c8
@ -67,6 +67,9 @@ public class PathingBehavior extends Behavior {
|
|||||||
if (msg.toLowerCase().startsWith("goal")) {
|
if (msg.toLowerCase().startsWith("goal")) {
|
||||||
event.cancel();
|
event.cancel();
|
||||||
String[] params = msg.toLowerCase().substring(4).trim().split(" ");
|
String[] params = msg.toLowerCase().substring(4).trim().split(" ");
|
||||||
|
if (params[0].equals("")) {
|
||||||
|
params = new String[]{};
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
switch (params.length) {
|
switch (params.length) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -28,7 +28,6 @@ import baritone.bot.utils.BlockStateInterface;
|
|||||||
import baritone.bot.utils.Utils;
|
import baritone.bot.utils.Utils;
|
||||||
import net.minecraft.block.BlockFalling;
|
import net.minecraft.block.BlockFalling;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.entity.EntityPlayerSP;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
@ -103,7 +102,6 @@ public class MovementAscend extends Movement {
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityPlayerSP thePlayer = Minecraft.getMinecraft().player;
|
|
||||||
if (!MovementHelper.canWalkOn(positionsToPlace[0])) {
|
if (!MovementHelper.canWalkOn(positionsToPlace[0])) {
|
||||||
for (int i = 0; i < against.length; i++) {
|
for (int i = 0; i < against.length; i++) {
|
||||||
if (BlockStateInterface.get(against[i]).isBlockNormalCube()) {
|
if (BlockStateInterface.get(against[i]).isBlockNormalCube()) {
|
||||||
@ -114,12 +112,11 @@ public class MovementAscend extends Movement {
|
|||||||
double faceY = (dest.getY() + against[i].getY()) * 0.5D;
|
double faceY = (dest.getY() + against[i].getY()) * 0.5D;
|
||||||
double faceZ = (dest.getZ() + against[i].getZ() + 1.0D) * 0.5D;
|
double faceZ = (dest.getZ() + against[i].getZ() + 1.0D) * 0.5D;
|
||||||
state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), new Vec3d(faceX, faceY, faceZ), playerRotations())));
|
state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), new Vec3d(faceX, faceY, faceZ), playerRotations())));
|
||||||
|
|
||||||
EnumFacing side = Minecraft.getMinecraft().objectMouseOver.sideHit;
|
EnumFacing side = Minecraft.getMinecraft().objectMouseOver.sideHit;
|
||||||
if (Objects.equals(LookBehaviorUtils.getSelectedBlock().orElse(null), against[i]) && LookBehaviorUtils.getSelectedBlock().get().offset(side).equals(positionsToPlace[0])) {
|
if (Objects.equals(LookBehaviorUtils.getSelectedBlock().orElse(null), against[i]) && LookBehaviorUtils.getSelectedBlock().get().offset(side).equals(positionsToPlace[0])) {
|
||||||
ticksWithoutPlacement++;
|
ticksWithoutPlacement++;
|
||||||
state.setInput(InputOverrideHandler.Input.SNEAK, true);
|
state.setInput(InputOverrideHandler.Input.SNEAK, true);
|
||||||
if (Minecraft.getMinecraft().player.isSneaking()) {
|
if (player().isSneaking()) {
|
||||||
state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true);
|
state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true);
|
||||||
}
|
}
|
||||||
if (ticksWithoutPlacement > 20) {
|
if (ticksWithoutPlacement > 20) {
|
||||||
@ -134,6 +131,8 @@ public class MovementAscend extends Movement {
|
|||||||
}
|
}
|
||||||
MovementHelper.moveTowards(state, dest);
|
MovementHelper.moveTowards(state, dest);
|
||||||
state.setInput(InputOverrideHandler.Input.JUMP, true);
|
state.setInput(InputOverrideHandler.Input.JUMP, true);
|
||||||
|
|
||||||
|
// TODO check if the below actually helps or hurts, it's weird
|
||||||
//double flatDistToNext = Math.abs(to.getX() - from.getX()) * Math.abs((to.getX() + 0.5D) - thePlayer.posX) + Math.abs(to.getZ() - from.getZ()) * Math.abs((to.getZ() + 0.5D) - thePlayer.posZ);
|
//double flatDistToNext = Math.abs(to.getX() - from.getX()) * Math.abs((to.getX() + 0.5D) - thePlayer.posX) + Math.abs(to.getZ() - from.getZ()) * Math.abs((to.getZ() + 0.5D) - thePlayer.posZ);
|
||||||
//boolean pointingInCorrectDirection = MovementManager.moveTowardsBlock(to);
|
//boolean pointingInCorrectDirection = MovementManager.moveTowardsBlock(to);
|
||||||
//MovementManager.jumping = flatDistToNext < 1.2 && pointingInCorrectDirection;
|
//MovementManager.jumping = flatDistToNext < 1.2 && pointingInCorrectDirection;
|
||||||
|
Loading…
Reference in New Issue
Block a user