first attempt at settings
This commit is contained in:
parent
eee43ad5d1
commit
f881ba5e59
@ -44,6 +44,7 @@ public enum Baritone {
|
||||
|
||||
private GameEventHandler gameEventHandler;
|
||||
private InputOverrideHandler inputOverrideHandler;
|
||||
private Settings settings;
|
||||
private List<Behavior> behaviors;
|
||||
|
||||
/**
|
||||
@ -82,4 +83,12 @@ public enum Baritone {
|
||||
public final boolean isActive() {
|
||||
return this.active;
|
||||
}
|
||||
|
||||
public final Settings getSettings() {
|
||||
return this.settings;
|
||||
}
|
||||
|
||||
public static Settings settings() {
|
||||
return Baritone.INSTANCE.settings; // yolo
|
||||
}
|
||||
}
|
||||
|
36
src/main/java/baritone/bot/Settings.java
Normal file
36
src/main/java/baritone/bot/Settings.java
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* This file is part of Baritone.
|
||||
*
|
||||
* Baritone is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Baritone is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package baritone.bot;
|
||||
|
||||
/**
|
||||
* Baritone's settings
|
||||
*
|
||||
* @author leijurv
|
||||
*/
|
||||
public class Settings {
|
||||
public boolean allowBreak = true;
|
||||
public boolean allowPlaceThrowaway = true;
|
||||
public double costHeuristic = 4;
|
||||
public boolean chuckCaching = false;
|
||||
public boolean allowWaterBucketFall = true;
|
||||
public int planningTickLookAhead = 150;
|
||||
|
||||
Settings() {
|
||||
|
||||
}
|
||||
}
|
@ -125,7 +125,7 @@ public class PathingBehavior extends Behavior {
|
||||
// and this path dosen't get us all the way there
|
||||
return;
|
||||
}
|
||||
if (current.getPath().ticksRemainingFrom(current.getPosition()) < 150) {
|
||||
if (current.getPath().ticksRemainingFrom(current.getPosition()) < Baritone.settings().planningTickLookAhead) {
|
||||
// and this path has 5 seconds or less left
|
||||
displayChatMessageRaw("Path almost over. Planning ahead...");
|
||||
findPathInNewThread(current.getPath().getDest(), false);
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.bot.pathing.goals;
|
||||
|
||||
import baritone.bot.Baritone;
|
||||
import baritone.bot.utils.Utils;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
@ -98,7 +99,7 @@ public class GoalXZ implements Goal {
|
||||
diagonal = z;
|
||||
}
|
||||
diagonal *= SQRT_2;
|
||||
return (diagonal + straight) * 4; // big TODO tune
|
||||
return (diagonal + straight) * Baritone.settings().costHeuristic; // big TODO tune
|
||||
}
|
||||
|
||||
public static GoalXZ fromDirection(Vec3d origin, float yaw, double distance) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.bot.pathing.movement;
|
||||
|
||||
import baritone.bot.Baritone;
|
||||
import baritone.bot.utils.Helper;
|
||||
import baritone.bot.utils.ToolSet;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@ -41,8 +42,8 @@ public class CalculationContext implements Helper {
|
||||
|
||||
public CalculationContext(ToolSet toolSet) {
|
||||
this.toolSet = toolSet;
|
||||
this.hasWaterBucket = InventoryPlayer.isHotbar(player().inventory.getSlotFor(STACK_BUCKET_WATER)) && !world().provider.isNether();
|
||||
this.hasThrowaway = MovementHelper.throwaway(false);
|
||||
this.hasWaterBucket = Baritone.settings().allowWaterBucketFall && InventoryPlayer.isHotbar(player().inventory.getSlotFor(STACK_BUCKET_WATER)) && !world().provider.isNether();
|
||||
this.hasThrowaway = Baritone.settings().allowPlaceThrowaway && MovementHelper.throwaway(false);
|
||||
}
|
||||
|
||||
public ToolSet getToolSet() {
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.bot.pathing.movement;
|
||||
|
||||
import baritone.bot.Baritone;
|
||||
import baritone.bot.InputOverrideHandler;
|
||||
import baritone.bot.behavior.impl.LookBehaviorUtils;
|
||||
import baritone.bot.pathing.movement.MovementState.MovementTarget;
|
||||
@ -140,6 +141,9 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||
if (avoidBreaking(position)) {
|
||||
return COST_INF;
|
||||
}
|
||||
if (!Baritone.settings().allowBreak) {
|
||||
return COST_INF;
|
||||
}
|
||||
//if (!Baritone.allowBreakOrPlace) {
|
||||
// return COST_INF;
|
||||
//}
|
||||
|
Loading…
Reference in New Issue
Block a user