my baritone dont work
Halqq opened this issue ยท 6 comments
(I only have this Baritone code in my entire client, nothing else, just this:
IBaritone baritone = BaritoneAPI.getProvider().getPrimaryBaritone();
if (baritone.getPathingBehavior().isPathing()) {
baritone.getPathingBehavior().cancelEverything();
}
if (target != null && target.isEntityAlive()) {
int targetX = (int) target.posX;
double targetY = target.posY;
int targetZ = (int) target.posZ;
baritone.getCustomGoalProcess().setGoalAndPath(new GoalXZ(targetX, targetZ));
) ```
I don't have any logs or crashes; Baritone simply doesn't work.
wild guess because i only have a code sniplet but you probably call a method before it is properly initialized
wild guess because i only have a code sniplet but you probably call a method before it is properly initialized
How do I fix it?
wild guess because i only have a code sniplet but you probably call a method before it is properly initialized
How do I fix it?
@Override
public void onUpdate() {
if (mc.world != null && mc.player != null) {
EntityPlayerSP player = mc.player;
WorldClient world = mc.world;
double closestDistanceSq = Double.MAX_VALUE;
for (EntityPlayer entity : mc.world.playerEntities) {
if (entity != mc.player) {
double distanceSq = player.getDistanceSq(entity);
if (distanceSq < closestDistanceSq && isInRange(player, entity)) {
closestDistanceSq = distanceSq;
target = entity;
}
}
}
if (target != null && target.isEntityAlive() && canAttack(target)) {
if (attackThroughWalls.getValue() || isVisible(player, target)) {
if (autoSwitch.getValue()) {
int bestSlot = getBestWeaponSlot();
if (bestSlot != -1) {
player.inventory.currentItem = bestSlot;
}
}
if (rotateHead.getValue()) {
rotateHeadTowards(player, target);
}
if (rotateBody.getValue()) {
rotateBodyTowards(player, target);
}
if (criticals.getValue()) {
// Custom attack logic with critical hits
attackEntityCritical(player, target);
} else {
// Custom attack logic without critical hits
attackEntity(player, target);
}
}
if (chaseTarget.getValue()) {
IBaritone baritone = BaritoneAPI.getProvider().getPrimaryBaritone();
if (baritone.getPathingBehavior().isPathing()) {
baritone.getPathingBehavior().cancelEverything();
}
if (target != null && target.isEntityAlive()) {
int targetX = (int) target.posX;
double targetY = target.posY;
int targetZ = (int) target.posZ;
BaritoneAPI.getProvider().getPrimaryBaritone().getFollowProcess().follow(aaaaaaaa); }
}
}
}
} ```
idk try this?
@Override
public void onUpdate() {
if (mc.world != null && mc.player != null) {
EntityPlayerSP player = mc.player;
WorldClient world = mc.world;
double closestDistanceSq = Double.MAX_VALUE;
for (EntityPlayer entity : mc.world.playerEntities) {
if (entity != mc.player) {
double distanceSq = player.getDistanceSq(entity);
if (distanceSq < closestDistanceSq && isInRange(player, entity)) {
closestDistanceSq = distanceSq;
target = entity;
}
}
}
if (target != null && target.isEntityAlive() && canAttack(target)) {
BaritoneAPI.getProvider().getPrimaryBaritone().getFollowProcess().onLostControl(); //when in attack range cancel following
if (attackThroughWalls.getValue() || isVisible(player, target)) {
if (autoSwitch.getValue()) {
int bestSlot = getBestWeaponSlot();
if (bestSlot != -1) {
player.inventory.currentItem = bestSlot;
}
}
if (rotateHead.getValue()) {
rotateHeadTowards(player, target);
}
if (rotateBody.getValue()) {
rotateBodyTowards(player, target);
}
if (criticals.getValue()) {
// Custom attack logic with critical hits
attackEntityCritical(player, target);
} else {
// Custom attack logic without critical hits
attackEntity(player, target);
}
}
if (chaseTarget.getValue()) {
IBaritone baritone = BaritoneAPI.getProvider().getPrimaryBaritone();
baritone.cancelEverything(); //cancels all active baritone processes. not sure why any should be active anyway.
if (target != null && target.isEntityAlive()) {
baritone.getFollowProcess().follow(target); //if you have a alive target follow it
}
}
}
}
}
idk try this?
@Override public void onUpdate() { if (mc.world != null && mc.player != null) { EntityPlayerSP player = mc.player; WorldClient world = mc.world; double closestDistanceSq = Double.MAX_VALUE; for (EntityPlayer entity : mc.world.playerEntities) { if (entity != mc.player) { double distanceSq = player.getDistanceSq(entity); if (distanceSq < closestDistanceSq && isInRange(player, entity)) { closestDistanceSq = distanceSq; target = entity; } } } if (target != null && target.isEntityAlive() && canAttack(target)) { BaritoneAPI.getProvider().getPrimaryBaritone().getFollowProcess().onLostControl(); //when in attack range cancel following if (attackThroughWalls.getValue() || isVisible(player, target)) { if (autoSwitch.getValue()) { int bestSlot = getBestWeaponSlot(); if (bestSlot != -1) { player.inventory.currentItem = bestSlot; } } if (rotateHead.getValue()) { rotateHeadTowards(player, target); } if (rotateBody.getValue()) { rotateBodyTowards(player, target); } if (criticals.getValue()) { // Custom attack logic with critical hits attackEntityCritical(player, target); } else { // Custom attack logic without critical hits attackEntity(player, target); } } if (chaseTarget.getValue()) { IBaritone baritone = BaritoneAPI.getProvider().getPrimaryBaritone(); baritone.cancelEverything(); //cancels all active baritone processes. not sure why any should be active anyway. if (target != null && target.isEntityAlive()) { baritone.getFollowProcess().follow(target); //if you have a alive target follow it } } } } }
Required type:
Predicate
<net.minecraft.entity.Entity>
Provided:
EntityPlayer
predicate??
predicate??
Yes. The documentation for FollowProcess indicates that the follow
method accepts a Predicate
, which is used to match the target entity.
Because Predicate
is a functional interface, it may implemented as a lambda expression.