no more .get 😎
This commit is contained in:
parent
459720c348
commit
8050b69f2f
@ -721,9 +721,9 @@ public final class Settings {
|
||||
this.klass = (Class<T>) value.getClass();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final <K extends T> K get() {
|
||||
return (K) value;
|
||||
@Deprecated
|
||||
public final T get() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public final String getName() {
|
||||
|
@ -25,7 +25,7 @@ public class GoalAxis implements Goal {
|
||||
|
||||
@Override
|
||||
public boolean isInGoal(int x, int y, int z) {
|
||||
return y == BaritoneAPI.getSettings().axisHeight.get() && (x == 0 || z == 0 || Math.abs(x) == Math.abs(z));
|
||||
return y == BaritoneAPI.getSettings().axisHeight.value && (x == 0 || z == 0 || Math.abs(x) == Math.abs(z));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -39,7 +39,7 @@ public class GoalAxis implements Goal {
|
||||
|
||||
double flatAxisDistance = Math.min(x, Math.min(z, diff * SQRT_2_OVER_2));
|
||||
|
||||
return flatAxisDistance * BaritoneAPI.getSettings().costHeuristic.get() + GoalYLevel.calculate(BaritoneAPI.getSettings().axisHeight.get(), y);
|
||||
return flatAxisDistance * BaritoneAPI.getSettings().costHeuristic.value + GoalYLevel.calculate(BaritoneAPI.getSettings().axisHeight.value, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,7 +80,7 @@ public class GoalXZ implements Goal {
|
||||
diagonal = z;
|
||||
}
|
||||
diagonal *= SQRT_2;
|
||||
return (diagonal + straight) * BaritoneAPI.getSettings().costHeuristic.get(); // big TODO tune
|
||||
return (diagonal + straight) * BaritoneAPI.getSettings().costHeuristic.value; // big TODO tune
|
||||
}
|
||||
|
||||
public static GoalXZ fromDirection(Vec3d origin, float yaw, double distance) {
|
||||
|
@ -99,7 +99,7 @@ public class SettingsUtil {
|
||||
public static List<Settings.Setting> modifiedSettings(Settings settings) {
|
||||
List<Settings.Setting> modified = new ArrayList<>();
|
||||
for (Settings.Setting setting : settings.allSettings) {
|
||||
if (setting.get() == null) {
|
||||
if (setting.value == null) {
|
||||
System.out.println("NULL SETTING?" + setting.getName());
|
||||
continue;
|
||||
}
|
||||
@ -122,7 +122,7 @@ public class SettingsUtil {
|
||||
if (io == null) {
|
||||
throw new IllegalStateException("Missing " + setting.getValueClass() + " " + setting.getName());
|
||||
}
|
||||
return setting.getName() + " " + io.toString.apply(setting.get());
|
||||
return setting.getName() + " " + io.toString.apply(setting.value);
|
||||
}
|
||||
|
||||
public static void parseAndApply(Settings settings, String settingName, String settingValue) throws IllegalStateException, NumberFormatException {
|
||||
|
@ -41,10 +41,10 @@ public class MixinChunkRenderContainer {
|
||||
)
|
||||
)
|
||||
private BlockPos getPosition(RenderChunk renderChunkIn) {
|
||||
if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null && Minecraft.getMinecraft().world.getChunk(renderChunkIn.getPosition()).isEmpty()) {
|
||||
if (Baritone.settings().renderCachedChunks.value && Minecraft.getMinecraft().getIntegratedServer() == null && Minecraft.getMinecraft().world.getChunk(renderChunkIn.getPosition()).isEmpty()) {
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableBlend();
|
||||
GL14.glBlendColor(0, 0, 0, Baritone.settings().cachedChunksOpacity.get());
|
||||
GL14.glBlendColor(0, 0, 0, Baritone.settings().cachedChunksOpacity.value);
|
||||
GlStateManager.tryBlendFuncSeparate(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA, GL_ONE, GL_ZERO);
|
||||
}
|
||||
return renderChunkIn.getPosition();
|
||||
|
@ -43,7 +43,7 @@ public abstract class MixinChunkRenderWorker {
|
||||
)
|
||||
)
|
||||
private boolean isChunkExisting(ChunkRenderWorker worker, BlockPos pos, World world) {
|
||||
if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||
if (Baritone.settings().renderCachedChunks.value && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||
IPlayerContext ctx = baritone.getPlayerContext();
|
||||
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
||||
|
@ -47,7 +47,7 @@ public class MixinRenderChunk {
|
||||
if (!chunkCache.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||
if (Baritone.settings().renderCachedChunks.value && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||
IPlayerContext ctx = baritone.getPlayerContext();
|
||||
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
||||
@ -76,7 +76,7 @@ public class MixinRenderChunk {
|
||||
)
|
||||
)
|
||||
private IBlockState getBlockState(ChunkCache chunkCache, BlockPos pos) {
|
||||
if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||
if (Baritone.settings().renderCachedChunks.value && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||
IPlayerContext ctx = baritone.getPlayerContext();
|
||||
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
||||
|
@ -38,7 +38,7 @@ public class MixinRenderList {
|
||||
)
|
||||
)
|
||||
private void popMatrix() {
|
||||
if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||
if (Baritone.settings().renderCachedChunks.value && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||
// reset the blend func to normal (not dependent on constant alpha)
|
||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class MixinVboRenderList {
|
||||
)
|
||||
)
|
||||
private void popMatrix() {
|
||||
if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||
if (Baritone.settings().renderCachedChunks.value && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||
// reset the blend func to normal (not dependent on constant alpha)
|
||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class InventoryBehavior extends Behavior {
|
||||
|
||||
@Override
|
||||
public void onTick(TickEvent event) {
|
||||
if (!Baritone.settings().allowInventory.get()) {
|
||||
if (!Baritone.settings().allowInventory.value) {
|
||||
return;
|
||||
}
|
||||
if (event.getType() == TickEvent.Type.OUT) {
|
||||
@ -61,7 +61,7 @@ public class InventoryBehavior extends Behavior {
|
||||
private int firstValidThrowaway() { // TODO offhand idk
|
||||
NonNullList<ItemStack> invy = ctx.player().inventory.mainInventory;
|
||||
for (int i = 0; i < invy.size(); i++) {
|
||||
if (Baritone.settings().acceptableThrowawayItems.get().contains(invy.get(i).getItem())) {
|
||||
if (Baritone.settings().acceptableThrowawayItems.value.contains(invy.get(i).getItem())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
|
||||
@Override
|
||||
public void updateTarget(Rotation target, boolean force) {
|
||||
this.target = target;
|
||||
this.force = force || !Baritone.settings().freeLook.get();
|
||||
this.force = force || !Baritone.settings().freeLook.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -63,7 +63,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
|
||||
}
|
||||
|
||||
// Whether or not we're going to silently set our angles
|
||||
boolean silent = Baritone.settings().antiCheatCompatibility.get() && !this.force;
|
||||
boolean silent = Baritone.settings().antiCheatCompatibility.value && !this.force;
|
||||
|
||||
switch (event.getState()) {
|
||||
case PRE: {
|
||||
@ -109,7 +109,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
|
||||
|
||||
// If we have antiCheatCompatibility on, we're going to use the target value later in onPlayerUpdate()
|
||||
// Also the type has to be MOTION_UPDATE because that is called after JUMP
|
||||
if (!Baritone.settings().antiCheatCompatibility.get() && event.getType() == RotationMoveEvent.Type.MOTION_UPDATE && !this.force) {
|
||||
if (!Baritone.settings().antiCheatCompatibility.value && event.getType() == RotationMoveEvent.Type.MOTION_UPDATE && !this.force) {
|
||||
this.target = null;
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public final class MemoryBehavior extends Behavior {
|
||||
|
||||
@Override
|
||||
public synchronized void onTick(TickEvent event) {
|
||||
if (!Baritone.settings().containerMemory.get()) {
|
||||
if (!Baritone.settings().containerMemory.value) {
|
||||
return;
|
||||
}
|
||||
if (event.getType() == TickEvent.Type.OUT) {
|
||||
@ -83,7 +83,7 @@ public final class MemoryBehavior extends Behavior {
|
||||
|
||||
@Override
|
||||
public synchronized void onSendPacket(PacketEvent event) {
|
||||
if (!Baritone.settings().containerMemory.get()) {
|
||||
if (!Baritone.settings().containerMemory.value) {
|
||||
return;
|
||||
}
|
||||
Packet p = event.getPacket();
|
||||
@ -122,7 +122,7 @@ public final class MemoryBehavior extends Behavior {
|
||||
|
||||
@Override
|
||||
public synchronized void onReceivePacket(PacketEvent event) {
|
||||
if (!Baritone.settings().containerMemory.get()) {
|
||||
if (!Baritone.settings().containerMemory.value) {
|
||||
return;
|
||||
}
|
||||
Packet p = event.getPacket();
|
||||
@ -171,7 +171,7 @@ public final class MemoryBehavior extends Behavior {
|
||||
|
||||
|
||||
private void updateInventory() {
|
||||
if (!Baritone.settings().containerMemory.get()) {
|
||||
if (!Baritone.settings().containerMemory.value) {
|
||||
return;
|
||||
}
|
||||
int windowId = ctx.player().openContainer.windowId;
|
||||
|
@ -201,7 +201,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
||||
// and this path doesn't get us all the way there
|
||||
return;
|
||||
}
|
||||
if (ticksRemainingInSegment(false).get() < Baritone.settings().planningTickLookahead.get()) {
|
||||
if (ticksRemainingInSegment(false).get() < Baritone.settings().planningTickLookahead.value) {
|
||||
// and this path has 7.5 seconds or less left
|
||||
// don't include the current movement so a very long last movement (e.g. descend) doesn't trip it up
|
||||
// if we actually included current, it wouldn't start planning ahead until the last movement was done, if the last movement took more than 7.5 seconds on its own
|
||||
@ -426,11 +426,11 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
||||
long primaryTimeout;
|
||||
long failureTimeout;
|
||||
if (current == null) {
|
||||
primaryTimeout = Baritone.settings().primaryTimeoutMS.get();
|
||||
failureTimeout = Baritone.settings().failureTimeoutMS.get();
|
||||
primaryTimeout = Baritone.settings().primaryTimeoutMS.value;
|
||||
failureTimeout = Baritone.settings().failureTimeoutMS.value;
|
||||
} else {
|
||||
primaryTimeout = Baritone.settings().planAheadPrimaryTimeoutMS.get();
|
||||
failureTimeout = Baritone.settings().planAheadFailureTimeoutMS.get();
|
||||
primaryTimeout = Baritone.settings().planAheadPrimaryTimeoutMS.value;
|
||||
failureTimeout = Baritone.settings().planAheadFailureTimeoutMS.value;
|
||||
}
|
||||
CalculationContext context = new CalculationContext(baritone, true); // not safe to create on the other thread, it looks up a lot of stuff in minecraft
|
||||
AbstractNodeCostSearch pathfinder = createPathfinder(start, goal, current == null ? null : current.getPath(), context);
|
||||
@ -494,7 +494,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
||||
|
||||
public static AbstractNodeCostSearch createPathfinder(BlockPos start, Goal goal, IPath previous, CalculationContext context) {
|
||||
Goal transformed = goal;
|
||||
if (Baritone.settings().simplifyUnloadedYCoord.get() && goal instanceof IGoalRenderPos) {
|
||||
if (Baritone.settings().simplifyUnloadedYCoord.value && goal instanceof IGoalRenderPos) {
|
||||
BlockPos pos = ((IGoalRenderPos) goal).getGoalPos();
|
||||
if (!context.bsi.worldContainsLoadedChunk(pos.getX(), pos.getZ())) {
|
||||
transformed = new GoalXZ(pos.getX(), pos.getZ());
|
||||
|
@ -303,7 +303,7 @@ public final class CachedRegion implements ICachedRegion {
|
||||
}
|
||||
|
||||
public synchronized final void removeExpired() {
|
||||
long expiry = Baritone.settings().cachedChunksExpirySeconds.get();
|
||||
long expiry = Baritone.settings().cachedChunksExpirySeconds.value;
|
||||
if (expiry < 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public final class CachedWorld implements ICachedWorld, Helper {
|
||||
|
||||
@Override
|
||||
public final void save() {
|
||||
if (!Baritone.settings().chunkCaching.get()) {
|
||||
if (!Baritone.settings().chunkCaching.value) {
|
||||
System.out.println("Not saving to disk; chunk caching is disabled.");
|
||||
allRegions().forEach(region -> {
|
||||
if (region != null) {
|
||||
@ -170,7 +170,7 @@ public final class CachedWorld implements ICachedWorld, Helper {
|
||||
* Delete regions that are too far from the player
|
||||
*/
|
||||
private synchronized void prune() {
|
||||
if (!Baritone.settings().pruneRegionsFromRAM.get()) {
|
||||
if (!Baritone.settings().pruneRegionsFromRAM.value) {
|
||||
return;
|
||||
}
|
||||
BlockPos pruneCenter = guessPosition();
|
||||
|
@ -70,7 +70,7 @@ public class ContainerMemory implements IContainerMemory {
|
||||
}
|
||||
|
||||
public synchronized void save() throws IOException {
|
||||
if (!Baritone.settings().containerMemory.get()) {
|
||||
if (!Baritone.settings().containerMemory.value) {
|
||||
return;
|
||||
}
|
||||
ByteBuf buf = Unpooled.buffer(0, Integer.MAX_VALUE);
|
||||
|
@ -62,20 +62,20 @@ public final class AStarPathFinder extends AbstractNodeCostSearch {
|
||||
MutableMoveResult res = new MutableMoveResult();
|
||||
BetterWorldBorder worldBorder = new BetterWorldBorder(calcContext.world.getWorldBorder());
|
||||
long startTime = System.currentTimeMillis();
|
||||
boolean slowPath = Baritone.settings().slowPath.get();
|
||||
boolean slowPath = Baritone.settings().slowPath.value;
|
||||
if (slowPath) {
|
||||
logDebug("slowPath is on, path timeout will be " + Baritone.settings().slowPathTimeoutMS.<Long>get() + "ms instead of " + primaryTimeout + "ms");
|
||||
logDebug("slowPath is on, path timeout will be " + Baritone.settings().slowPathTimeoutMS.value + "ms instead of " + primaryTimeout + "ms");
|
||||
}
|
||||
long primaryTimeoutTime = startTime + (slowPath ? Baritone.settings().slowPathTimeoutMS.<Long>get() : primaryTimeout);
|
||||
long failureTimeoutTime = startTime + (slowPath ? Baritone.settings().slowPathTimeoutMS.<Long>get() : failureTimeout);
|
||||
long primaryTimeoutTime = startTime + (slowPath ? Baritone.settings().slowPathTimeoutMS.value : primaryTimeout);
|
||||
long failureTimeoutTime = startTime + (slowPath ? Baritone.settings().slowPathTimeoutMS.value : failureTimeout);
|
||||
boolean failing = true;
|
||||
int numNodes = 0;
|
||||
int numMovementsConsidered = 0;
|
||||
int numEmptyChunk = 0;
|
||||
boolean isFavoring = !favoring.isEmpty();
|
||||
int timeCheckInterval = 1 << 6;
|
||||
int pathingMaxChunkBorderFetch = Baritone.settings().pathingMaxChunkBorderFetch.get(); // grab all settings beforehand so that changing settings during pathing doesn't cause a crash or unpredictable behavior
|
||||
double minimumImprovement = Baritone.settings().minimumImprovementRepropagation.get() ? MIN_IMPROVEMENT : 0;
|
||||
int pathingMaxChunkBorderFetch = Baritone.settings().pathingMaxChunkBorderFetch.value; // grab all settings beforehand so that changing settings during pathing doesn't cause a crash or unpredictable behavior
|
||||
double minimumImprovement = Baritone.settings().minimumImprovementRepropagation.value ? MIN_IMPROVEMENT : 0;
|
||||
while (!openSet.isEmpty() && numEmptyChunk < pathingMaxChunkBorderFetch && !cancelRequested) {
|
||||
if ((numNodes & (timeCheckInterval - 1)) == 0) { // only call this once every 64 nodes (about half a millisecond)
|
||||
long now = System.currentTimeMillis(); // since nanoTime is slow on windows (takes many microseconds)
|
||||
@ -85,7 +85,7 @@ public final class AStarPathFinder extends AbstractNodeCostSearch {
|
||||
}
|
||||
if (slowPath) {
|
||||
try {
|
||||
Thread.sleep(Baritone.settings().slowPathTimeDelayMS.<Long>get());
|
||||
Thread.sleep(Baritone.settings().slowPathTimeDelayMS.value);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public abstract class AbstractNodeCostSearch implements IPathFinder, Helper {
|
||||
this.startZ = startZ;
|
||||
this.goal = goal;
|
||||
this.context = context;
|
||||
this.map = new Long2ObjectOpenHashMap<>(Baritone.settings().pathingMapDefaultSize.value, Baritone.settings().pathingMapLoadFactor.get());
|
||||
this.map = new Long2ObjectOpenHashMap<>(Baritone.settings().pathingMapDefaultSize.value, Baritone.settings().pathingMapLoadFactor.value);
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
|
@ -76,27 +76,27 @@ public class CalculationContext {
|
||||
this.worldData = (WorldData) baritone.getWorldProvider().getCurrentWorld();
|
||||
this.bsi = new BlockStateInterface(world, worldData, forUseOnAnotherThread); // TODO TODO TODO
|
||||
this.toolSet = new ToolSet(player);
|
||||
this.hasThrowaway = Baritone.settings().allowPlace.get() && MovementHelper.throwaway(baritone.getPlayerContext(), false);
|
||||
this.hasWaterBucket = Baritone.settings().allowWaterBucketFall.get() && InventoryPlayer.isHotbar(player.inventory.getSlotFor(STACK_BUCKET_WATER)) && !world.provider.isNether();
|
||||
this.canSprint = Baritone.settings().allowSprint.get() && player.getFoodStats().getFoodLevel() > 6;
|
||||
this.placeBlockCost = Baritone.settings().blockPlacementPenalty.get();
|
||||
this.allowBreak = Baritone.settings().allowBreak.get();
|
||||
this.allowParkour = Baritone.settings().allowParkour.get();
|
||||
this.allowParkourPlace = Baritone.settings().allowParkourPlace.get();
|
||||
this.allowJumpAt256 = Baritone.settings().allowJumpAt256.get();
|
||||
this.assumeWalkOnWater = Baritone.settings().assumeWalkOnWater.get();
|
||||
this.allowDiagonalDescend = Baritone.settings().allowDiagonalDescend.get();
|
||||
this.maxFallHeightNoWater = Baritone.settings().maxFallHeightNoWater.get();
|
||||
this.maxFallHeightBucket = Baritone.settings().maxFallHeightBucket.get();
|
||||
this.hasThrowaway = Baritone.settings().allowPlace.value && MovementHelper.throwaway(baritone.getPlayerContext(), false);
|
||||
this.hasWaterBucket = Baritone.settings().allowWaterBucketFall.value && InventoryPlayer.isHotbar(player.inventory.getSlotFor(STACK_BUCKET_WATER)) && !world.provider.isNether();
|
||||
this.canSprint = Baritone.settings().allowSprint.value && player.getFoodStats().getFoodLevel() > 6;
|
||||
this.placeBlockCost = Baritone.settings().blockPlacementPenalty.value;
|
||||
this.allowBreak = Baritone.settings().allowBreak.value;
|
||||
this.allowParkour = Baritone.settings().allowParkour.value;
|
||||
this.allowParkourPlace = Baritone.settings().allowParkourPlace.value;
|
||||
this.allowJumpAt256 = Baritone.settings().allowJumpAt256.value;
|
||||
this.assumeWalkOnWater = Baritone.settings().assumeWalkOnWater.value;
|
||||
this.allowDiagonalDescend = Baritone.settings().allowDiagonalDescend.value;
|
||||
this.maxFallHeightNoWater = Baritone.settings().maxFallHeightNoWater.value;
|
||||
this.maxFallHeightBucket = Baritone.settings().maxFallHeightBucket.value;
|
||||
int depth = EnchantmentHelper.getDepthStriderModifier(player);
|
||||
if (depth > 3) {
|
||||
depth = 3;
|
||||
}
|
||||
float mult = depth / 3.0F;
|
||||
this.waterWalkSpeed = ActionCosts.WALK_ONE_IN_WATER_COST * (1 - mult) + ActionCosts.WALK_ONE_BLOCK_COST * mult;
|
||||
this.breakBlockAdditionalCost = Baritone.settings().blockBreakAdditionalPenalty.get();
|
||||
this.jumpPenalty = Baritone.settings().jumpPenalty.get();
|
||||
this.walkOnWaterOnePenalty = Baritone.settings().walkOnWaterOnePenalty.get();
|
||||
this.breakBlockAdditionalCost = Baritone.settings().blockBreakAdditionalPenalty.value;
|
||||
this.jumpPenalty = Baritone.settings().jumpPenalty.value;
|
||||
this.walkOnWaterOnePenalty = Baritone.settings().walkOnWaterOnePenalty.value;
|
||||
// why cache these things here, why not let the movements just get directly from settings?
|
||||
// because if some movements are calculated one way and others are calculated another way,
|
||||
// then you get a wildly inconsistent path that isn't optimal for either scenario.
|
||||
|
@ -113,7 +113,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||
return false; // Don't walk through flowing liquids
|
||||
}
|
||||
if (block instanceof BlockLiquid) {
|
||||
if (Baritone.settings().assumeWalkOnWater.get()) {
|
||||
if (Baritone.settings().assumeWalkOnWater.value) {
|
||||
return false;
|
||||
}
|
||||
IBlockState up = bsi.get0(x, y + 1, z);
|
||||
@ -275,7 +275,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||
if (state.isBlockNormalCube()) {
|
||||
return true;
|
||||
}
|
||||
if (block == Blocks.LADDER || (block == Blocks.VINE && Baritone.settings().allowVines.get())) { // TODO reconsider this
|
||||
if (block == Blocks.LADDER || (block == Blocks.VINE && Baritone.settings().allowVines.value)) { // TODO reconsider this
|
||||
return true;
|
||||
}
|
||||
if (block == Blocks.FARMLAND || block == Blocks.GRASS_PATH) {
|
||||
@ -293,17 +293,17 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||
}
|
||||
if (isFlowing(x, y, z, state, bsi) || block == Blocks.FLOWING_WATER) {
|
||||
// the only scenario in which we can walk on flowing water is if it's under still water with jesus off
|
||||
return isWater(up) && !Baritone.settings().assumeWalkOnWater.get();
|
||||
return isWater(up) && !Baritone.settings().assumeWalkOnWater.value;
|
||||
}
|
||||
// if assumeWalkOnWater is on, we can only walk on water if there isn't water above it
|
||||
// if assumeWalkOnWater is off, we can only walk on water if there is water above it
|
||||
return isWater(up) ^ Baritone.settings().assumeWalkOnWater.get();
|
||||
return isWater(up) ^ Baritone.settings().assumeWalkOnWater.value;
|
||||
}
|
||||
if (block == Blocks.GLASS || block == Blocks.STAINED_GLASS) {
|
||||
return true;
|
||||
}
|
||||
if (block instanceof BlockSlab) {
|
||||
if (!Baritone.settings().allowWalkOnBottomSlab.get()) {
|
||||
if (!Baritone.settings().allowWalkOnBottomSlab.value) {
|
||||
if (((BlockSlab) block).isDouble()) {
|
||||
return true;
|
||||
}
|
||||
@ -415,14 +415,14 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||
// and then it's called during execution
|
||||
// since this function is never called during cost calculation, we don't need to migrate
|
||||
// acceptableThrowawayItems to the CalculationContext
|
||||
if (Baritone.settings().acceptableThrowawayItems.get().contains(item.getItem())) {
|
||||
if (Baritone.settings().acceptableThrowawayItems.value.contains(item.getItem())) {
|
||||
if (select) {
|
||||
p.inventory.currentItem = i;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (Baritone.settings().acceptableThrowawayItems.get().contains(p.inventory.offHandInventory.get(0).getItem())) {
|
||||
if (Baritone.settings().acceptableThrowawayItems.value.contains(p.inventory.offHandInventory.get(0).getItem())) {
|
||||
// main hand takes precedence over off hand
|
||||
// that means that if we have block A selected in main hand and block B in off hand, right clicking places block B
|
||||
// we've already checked above ^ and the main hand can't possible have an acceptablethrowawayitem
|
||||
|
@ -176,7 +176,7 @@ public class MovementAscend extends Movement {
|
||||
return state; // don't jump while walking from a non double slab into a bottom slab
|
||||
}
|
||||
|
||||
if (Baritone.settings().assumeStep.get() || ctx.playerFeet().equals(src.up())) {
|
||||
if (Baritone.settings().assumeStep.value || ctx.playerFeet().equals(src.up())) {
|
||||
// no need to hit space if we're already jumping
|
||||
return state;
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ public class MovementDiagonal extends Movement {
|
||||
}
|
||||
|
||||
public boolean sprint() {
|
||||
if (MovementHelper.isLiquid(ctx, ctx.playerFeet()) && !Baritone.settings().sprintInWater.get()) {
|
||||
if (MovementHelper.isLiquid(ctx, ctx.playerFeet()) && !Baritone.settings().sprintInWater.value) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
@ -152,7 +152,7 @@ public class MovementTraverse extends Movement {
|
||||
super.updateState(state);
|
||||
if (state.getStatus() != MovementStatus.RUNNING) {
|
||||
// if the setting is enabled
|
||||
if (!Baritone.settings().walkWhileBreaking.get()) {
|
||||
if (!Baritone.settings().walkWhileBreaking.value) {
|
||||
return state;
|
||||
}
|
||||
// and if we're prepping (aka mining the block in front)
|
||||
@ -241,7 +241,7 @@ public class MovementTraverse extends Movement {
|
||||
BlockPos into = dest.subtract(src).add(dest);
|
||||
Block intoBelow = BlockStateInterface.get(ctx, into).getBlock();
|
||||
Block intoAbove = BlockStateInterface.get(ctx, into.up()).getBlock();
|
||||
if (wasTheBridgeBlockAlwaysThere && (!MovementHelper.isLiquid(ctx, ctx.playerFeet()) || Baritone.settings().sprintInWater.get()) && (!MovementHelper.avoidWalkingInto(intoBelow) || MovementHelper.isWater(intoBelow)) && !MovementHelper.avoidWalkingInto(intoAbove)) {
|
||||
if (wasTheBridgeBlockAlwaysThere && (!MovementHelper.isLiquid(ctx, ctx.playerFeet()) || Baritone.settings().sprintInWater.value) && (!MovementHelper.avoidWalkingInto(intoBelow) || MovementHelper.isWater(intoBelow)) && !MovementHelper.avoidWalkingInto(intoAbove)) {
|
||||
state.setInput(Input.SPRINT, true);
|
||||
}
|
||||
Block destDown = BlockStateInterface.get(ctx, dest.down()).getBlock();
|
||||
@ -264,12 +264,12 @@ public class MovementTraverse extends Movement {
|
||||
}
|
||||
double dist1 = Math.max(Math.abs(ctx.player().posX - (dest.getX() + 0.5D)), Math.abs(ctx.player().posZ - (dest.getZ() + 0.5D)));
|
||||
PlaceResult p = MovementHelper.attemptToPlaceABlock(state, baritone, dest.down(), false);
|
||||
if ((p == PlaceResult.READY_TO_PLACE || dist1 < 0.6) && !Baritone.settings().assumeSafeWalk.get()) {
|
||||
if ((p == PlaceResult.READY_TO_PLACE || dist1 < 0.6) && !Baritone.settings().assumeSafeWalk.value) {
|
||||
state.setInput(Input.SNEAK, true);
|
||||
}
|
||||
switch (p) {
|
||||
case READY_TO_PLACE: {
|
||||
if (ctx.player().isSneaking() || Baritone.settings().assumeSafeWalk.get()) {
|
||||
if (ctx.player().isSneaking() || Baritone.settings().assumeSafeWalk.value) {
|
||||
state.setInput(Input.CLICK_RIGHT, true);
|
||||
}
|
||||
return state;
|
||||
@ -343,4 +343,4 @@ public class MovementTraverse extends Movement {
|
||||
}
|
||||
return super.prepared(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ public class PathExecutor implements IPathExecutor, Helper {
|
||||
costEstimateIndex = pathPosition;
|
||||
// do this only once, when the movement starts, and deliberately get the cost as cached when this path was calculated, not the cost as it is right now
|
||||
currentMovementOriginalCostEstimate = movement.getCost();
|
||||
for (int i = 1; i < Baritone.settings().costVerificationLookahead.get() && pathPosition + i < path.length() - 1; i++) {
|
||||
for (int i = 1; i < Baritone.settings().costVerificationLookahead.value && pathPosition + i < path.length() - 1; i++) {
|
||||
if (path.movements().get(pathPosition + i).calculateCostWithoutCaching() >= ActionCosts.COST_INF && canCancel) {
|
||||
logDebug("Something has changed in the world and a future movement has become impossible. Cancelling.");
|
||||
cancel();
|
||||
@ -243,7 +243,7 @@ public class PathExecutor implements IPathExecutor, Helper {
|
||||
cancel();
|
||||
return true;
|
||||
}
|
||||
if (!movement.calculatedWhileLoaded() && currentCost - currentMovementOriginalCostEstimate > Baritone.settings().maxCostIncrease.get() && canCancel) {
|
||||
if (!movement.calculatedWhileLoaded() && currentCost - currentMovementOriginalCostEstimate > Baritone.settings().maxCostIncrease.value && canCancel) {
|
||||
// don't do this if the movement was calculated while loaded
|
||||
// that means that this isn't a cache error, it's just part of the path interfering with a later part
|
||||
logDebug("Original cost " + currentMovementOriginalCostEstimate + " current cost " + currentCost + ". Cancelling.");
|
||||
@ -273,7 +273,7 @@ public class PathExecutor implements IPathExecutor, Helper {
|
||||
ctx.player().setSprinting(false); // letting go of control doesn't make you stop sprinting actually
|
||||
}
|
||||
ticksOnCurrent++;
|
||||
if (ticksOnCurrent > currentMovementOriginalCostEstimate + Baritone.settings().movementTimeoutTicks.get()) {
|
||||
if (ticksOnCurrent > currentMovementOriginalCostEstimate + Baritone.settings().movementTimeoutTicks.value) {
|
||||
// only cancel if the total time has exceeded the initial estimate
|
||||
// as you break the blocks required, the remaining cost goes down, to the point where
|
||||
// ticksOnCurrent is greater than recalculateCost + 100
|
||||
@ -527,7 +527,7 @@ public class PathExecutor implements IPathExecutor, Helper {
|
||||
}
|
||||
|
||||
private static boolean sprintableAscend(IPlayerContext ctx, MovementTraverse current, MovementAscend next, IMovement nextnext) {
|
||||
if (!Baritone.settings().sprintAscends.get()) {
|
||||
if (!Baritone.settings().sprintAscends.value) {
|
||||
return false;
|
||||
}
|
||||
if (!current.getDirection().equals(next.getDirection().down())) {
|
||||
@ -569,7 +569,7 @@ public class PathExecutor implements IPathExecutor, Helper {
|
||||
if (next instanceof MovementTraverse && next.getDirection().down().equals(current.getDirection()) && MovementHelper.canWalkOn(ctx, next.getDest().down())) {
|
||||
return true;
|
||||
}
|
||||
return next instanceof MovementDiagonal && Baritone.settings().allowOvershootDiagonalDescend.get();
|
||||
return next instanceof MovementDiagonal && Baritone.settings().allowOvershootDiagonalDescend.value;
|
||||
}
|
||||
|
||||
private void onChangeInPathPosition() {
|
||||
@ -612,8 +612,8 @@ public class PathExecutor implements IPathExecutor, Helper {
|
||||
}
|
||||
|
||||
private PathExecutor cutIfTooLong() {
|
||||
if (pathPosition > Baritone.settings().maxPathHistoryLength.get()) {
|
||||
int cutoffAmt = Baritone.settings().pathHistoryCutoffAmount.get();
|
||||
if (pathPosition > Baritone.settings().maxPathHistoryLength.value) {
|
||||
int cutoffAmt = Baritone.settings().pathHistoryCutoffAmount.value;
|
||||
CutoffPath newPath = new CutoffPath(path, cutoffAmt, path.length() - 1);
|
||||
if (!newPath.getDest().equals(path.getDest())) {
|
||||
throw new IllegalStateException();
|
||||
|
@ -58,13 +58,13 @@ public final class FollowProcess extends BaritoneProcessHelper implements IFollo
|
||||
|
||||
private Goal towards(Entity following) {
|
||||
BlockPos pos;
|
||||
if (Baritone.settings().followOffsetDistance.get() == 0) {
|
||||
if (Baritone.settings().followOffsetDistance.value == 0) {
|
||||
pos = new BlockPos(following);
|
||||
} else {
|
||||
GoalXZ g = GoalXZ.fromDirection(following.getPositionVector(), Baritone.settings().followOffsetDirection.get(), Baritone.settings().followOffsetDistance.get());
|
||||
GoalXZ g = GoalXZ.fromDirection(following.getPositionVector(), Baritone.settings().followOffsetDirection.value, Baritone.settings().followOffsetDistance.value);
|
||||
pos = new BlockPos(g.getX(), following.posY, g.getZ());
|
||||
}
|
||||
return new GoalNear(pos, Baritone.settings().followRadius.get());
|
||||
return new GoalNear(pos, Baritone.settings().followRadius.value);
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
|
||||
rescan(new ArrayList<>(), new CalculationContext(baritone));
|
||||
}
|
||||
if (knownLocations.isEmpty()) {
|
||||
if (Baritone.settings().exploreForBlocks.get() && !calcFailed) {
|
||||
if (Baritone.settings().exploreForBlocks.value && !calcFailed) {
|
||||
return new PathingCommand(new GoalRunAway(1, start) {
|
||||
@Override
|
||||
public boolean isInGoal(int x, int y, int z) {
|
||||
@ -83,7 +83,7 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
|
||||
}
|
||||
Goal goal = new GoalComposite(knownLocations.stream().map(this::createGoal).toArray(Goal[]::new));
|
||||
if (calcFailed) {
|
||||
if (Baritone.settings().blacklistOnGetToBlockFailure.get()) {
|
||||
if (Baritone.settings().blacklistOnGetToBlockFailure.value) {
|
||||
logDirect("Unable to find any path to " + gettingTo + ", blacklisting presumably unreachable closest instances");
|
||||
blacklistClosest();
|
||||
return onTick(false, isSafeToCancel); // gamer moment
|
||||
@ -95,7 +95,7 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
|
||||
return new PathingCommand(goal, PathingCommandType.CANCEL_AND_SET_GOAL);
|
||||
}
|
||||
}
|
||||
int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.get();
|
||||
int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.value;
|
||||
if (mineGoalUpdateInterval != 0 && tickCount++ % mineGoalUpdateInterval == 0) { // big brain
|
||||
List<BlockPos> current = new ArrayList<>(knownLocations);
|
||||
CalculationContext context = new CalculationContext(baritone, true);
|
||||
@ -200,14 +200,14 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
|
||||
}
|
||||
|
||||
private boolean walkIntoInsteadOfAdjacent(Block block) {
|
||||
if (!Baritone.settings().enterPortal.get()) {
|
||||
if (!Baritone.settings().enterPortal.value) {
|
||||
return false;
|
||||
}
|
||||
return block == Blocks.PORTAL;
|
||||
}
|
||||
|
||||
private boolean rightClickOnArrival(Block block) {
|
||||
if (!Baritone.settings().rightClickContainerOnArrival.get()) {
|
||||
if (!Baritone.settings().rightClickContainerOnArrival.value) {
|
||||
return false;
|
||||
}
|
||||
return block == Blocks.CRAFTING_TABLE || block == Blocks.FURNACE || block == Blocks.ENDER_CHEST || block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST;
|
||||
|
@ -85,13 +85,13 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
||||
cancel();
|
||||
return null;
|
||||
}
|
||||
int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.get();
|
||||
int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.value;
|
||||
if (mineGoalUpdateInterval != 0 && tickCount++ % mineGoalUpdateInterval == 0) { // big brain
|
||||
List<BlockPos> curr = new ArrayList<>(knownOreLocations);
|
||||
CalculationContext context = new CalculationContext(baritone, true);
|
||||
Baritone.getExecutor().execute(() -> rescan(curr, context));
|
||||
}
|
||||
if (Baritone.settings().legitMine.get()) {
|
||||
if (Baritone.settings().legitMine.value) {
|
||||
addNearby();
|
||||
}
|
||||
PathingCommand command = updateGoal();
|
||||
@ -115,7 +115,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
||||
}
|
||||
|
||||
private PathingCommand updateGoal() {
|
||||
boolean legit = Baritone.settings().legitMine.get();
|
||||
boolean legit = Baritone.settings().legitMine.value;
|
||||
List<BlockPos> locs = knownOreLocations;
|
||||
if (!locs.isEmpty()) {
|
||||
List<BlockPos> locs2 = prune(new CalculationContext(baritone), new ArrayList<>(locs), mining, ORE_LOCATIONS_COUNT);
|
||||
@ -129,7 +129,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
||||
return null;
|
||||
}
|
||||
// only in non-Xray mode (aka legit mode) do we do this
|
||||
int y = Baritone.settings().legitMineYLevel.get();
|
||||
int y = Baritone.settings().legitMineYLevel.value;
|
||||
if (branchPoint == null) {
|
||||
/*if (!baritone.getPathingBehavior().isPathing() && playerFeet().y == y) {
|
||||
// cool, path is over and we are at desired y
|
||||
@ -157,7 +157,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
||||
if (mining == null) {
|
||||
return;
|
||||
}
|
||||
if (Baritone.settings().legitMine.get()) {
|
||||
if (Baritone.settings().legitMine.value) {
|
||||
return;
|
||||
}
|
||||
List<BlockPos> locs = searchWorld(context, mining, ORE_LOCATIONS_COUNT, already);
|
||||
@ -171,18 +171,18 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
||||
}
|
||||
|
||||
private static Goal coalesce(IPlayerContext ctx, BlockPos loc, List<BlockPos> locs) {
|
||||
if (!Baritone.settings().forceInternalMining.get()) {
|
||||
if (!Baritone.settings().forceInternalMining.value) {
|
||||
return new GoalTwoBlocks(loc);
|
||||
}
|
||||
|
||||
// Here, BlockStateInterface is used because the position may be in a cached chunk (the targeted block is one that is kept track of)
|
||||
boolean upwardGoal = locs.contains(loc.up()) || (Baritone.settings().internalMiningAirException.get() && BlockStateInterface.getBlock(ctx, loc.up()) == Blocks.AIR);
|
||||
boolean downwardGoal = locs.contains(loc.down()) || (Baritone.settings().internalMiningAirException.get() && BlockStateInterface.getBlock(ctx, loc.down()) == Blocks.AIR);
|
||||
boolean upwardGoal = locs.contains(loc.up()) || (Baritone.settings().internalMiningAirException.value && BlockStateInterface.getBlock(ctx, loc.up()) == Blocks.AIR);
|
||||
boolean downwardGoal = locs.contains(loc.down()) || (Baritone.settings().internalMiningAirException.value && BlockStateInterface.getBlock(ctx, loc.down()) == Blocks.AIR);
|
||||
return upwardGoal == downwardGoal ? new GoalTwoBlocks(loc) : upwardGoal ? new GoalBlock(loc) : new GoalBlock(loc.down());
|
||||
}
|
||||
|
||||
public static List<BlockPos> droppedItemsScan(List<Block> mining, World world) {
|
||||
if (!Baritone.settings().mineScanDroppedItems.get()) {
|
||||
if (!Baritone.settings().mineScanDroppedItems.value) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Set<Item> searchingFor = new HashSet<>();
|
||||
@ -211,7 +211,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
||||
for (Block m : mining) {
|
||||
if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(m)) {
|
||||
// maxRegionDistanceSq 2 means adjacent directly or adjacent diagonally; nothing further than that
|
||||
locs.addAll(ctx.worldData.getCachedWorld().getLocationsOf(ChunkPacker.blockToString(m), Baritone.settings().maxCachedWorldScanCount.get(), ctx.getBaritone().getPlayerContext().playerFeet().getX(), ctx.getBaritone().getPlayerContext().playerFeet().getZ(), 2));
|
||||
locs.addAll(ctx.worldData.getCachedWorld().getLocationsOf(ChunkPacker.blockToString(m), Baritone.settings().maxCachedWorldScanCount.value, ctx.getBaritone().getPlayerContext().playerFeet().getX(), ctx.getBaritone().getPlayerContext().playerFeet().getZ(), 2));
|
||||
} else {
|
||||
uninteresting.add(m);
|
||||
}
|
||||
@ -242,7 +242,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
||||
// is an x-ray and it'll get caught
|
||||
if (mining.contains(bsi.get0(x, y, z).getBlock())) {
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
if ((Baritone.settings().legitMineIncludeDiagonals.get() && knownOreLocations.stream().anyMatch(ore -> ore.distanceSq(pos) <= 2 /* sq means this is pytha dist <= sqrt(2) */)) || RotationUtils.reachable(ctx.player(), pos, fakedBlockReachDistance).isPresent()) {
|
||||
if ((Baritone.settings().legitMineIncludeDiagonals.value && knownOreLocations.stream().anyMatch(ore -> ore.distanceSq(pos) <= 2 /* sq means this is pytha dist <= sqrt(2) */)) || RotationUtils.reachable(ctx.player(), pos, fakedBlockReachDistance).isPresent()) {
|
||||
knownOreLocations.add(pos);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class BlockPlaceHelper implements Helper {
|
||||
if (!rightClickRequested || ctx.player().isRowingBoat() || mouseOver == null || mouseOver.getBlockPos() == null || mouseOver.typeOfHit != RayTraceResult.Type.BLOCK) {
|
||||
return;
|
||||
}
|
||||
rightClickTimer = Baritone.settings().rightClickSpeed.get();
|
||||
rightClickTimer = Baritone.settings().rightClickSpeed.value;
|
||||
for (EnumHand hand : EnumHand.values()) {
|
||||
if (ctx.playerController().processRightClickBlock(ctx.player(), ctx.world(), mouseOver.getBlockPos(), mouseOver.sideHit, mouseOver.hitVec, hand) == EnumActionResult.SUCCESS) {
|
||||
ctx.player().swingArm(hand);
|
||||
|
@ -66,7 +66,7 @@ public class BlockStateInterface {
|
||||
} else {
|
||||
this.loadedChunks = worldLoaded; // this will only be used on the main thread
|
||||
}
|
||||
this.useTheRealWorld = !Baritone.settings().pathThroughCachedOnly.get();
|
||||
this.useTheRealWorld = !Baritone.settings().pathThroughCachedOnly.value;
|
||||
if (!Minecraft.getMinecraft().isCallingFromMinecraftThread()) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
@ -89,14 +89,14 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
|
||||
@Override
|
||||
public void onSendChatMessage(ChatEvent event) {
|
||||
String msg = event.getMessage();
|
||||
if (Baritone.settings().prefixControl.get() && msg.startsWith(COMMAND_PREFIX)) {
|
||||
if (Baritone.settings().prefixControl.value && msg.startsWith(COMMAND_PREFIX)) {
|
||||
if (!runCommand(msg.substring(COMMAND_PREFIX.length()))) {
|
||||
logDirect("Invalid command");
|
||||
}
|
||||
event.cancel(); // always cancel if using prefixControl
|
||||
return;
|
||||
}
|
||||
if (!Baritone.settings().chatControl.get() && !Baritone.settings().removePrefix.get()) {
|
||||
if (!Baritone.settings().chatControl.value && !Baritone.settings().removePrefix.value) {
|
||||
return;
|
||||
}
|
||||
if (runCommand(msg)) {
|
||||
|
@ -50,7 +50,7 @@ public interface Helper {
|
||||
* @param message The message to display in chat
|
||||
*/
|
||||
default void logDebug(String message) {
|
||||
if (!Baritone.settings().chatDebug.get()) {
|
||||
if (!Baritone.settings().chatDebug.value) {
|
||||
//System.out.println("Suppressed debug message:");
|
||||
//System.out.println(message);
|
||||
return;
|
||||
@ -67,6 +67,6 @@ public interface Helper {
|
||||
ITextComponent component = MESSAGE_PREFIX.createCopy();
|
||||
component.getStyle().setColor(TextFormatting.GRAY);
|
||||
component.appendSibling(new TextComponentString(" " + message));
|
||||
Minecraft.getMinecraft().addScheduledTask(() -> Baritone.settings().logger.get().accept(component));
|
||||
Minecraft.getMinecraft().addScheduledTask(() -> Baritone.settings().logger.value.accept(component));
|
||||
}
|
||||
}
|
||||
|
@ -81,9 +81,9 @@ public final class PathRenderer implements Helper {
|
||||
}
|
||||
|
||||
if (goal != null && Baritone.settings().renderGoal.value) {
|
||||
drawDankLitGoalBox(renderView, goal, partialTicks, Baritone.settings().colorGoalBox.get());
|
||||
drawDankLitGoalBox(renderView, goal, partialTicks, Baritone.settings().colorGoalBox.value);
|
||||
}
|
||||
if (!Baritone.settings().renderPath.get()) {
|
||||
if (!Baritone.settings().renderPath.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -97,28 +97,28 @@ public final class PathRenderer implements Helper {
|
||||
// Render the current path, if there is one
|
||||
if (current != null && current.getPath() != null) {
|
||||
int renderBegin = Math.max(current.getPosition() - 3, 0);
|
||||
drawPath(current.getPath(), renderBegin, renderView, partialTicks, Baritone.settings().colorCurrentPath.get(), Baritone.settings().fadePath.get(), 10, 20);
|
||||
drawPath(current.getPath(), renderBegin, renderView, partialTicks, Baritone.settings().colorCurrentPath.value, Baritone.settings().fadePath.value, 10, 20);
|
||||
}
|
||||
if (next != null && next.getPath() != null) {
|
||||
drawPath(next.getPath(), 0, renderView, partialTicks, Baritone.settings().colorNextPath.get(), Baritone.settings().fadePath.get(), 10, 20);
|
||||
drawPath(next.getPath(), 0, renderView, partialTicks, Baritone.settings().colorNextPath.value, Baritone.settings().fadePath.value, 10, 20);
|
||||
}
|
||||
|
||||
//long split = System.nanoTime();
|
||||
if (current != null) {
|
||||
drawManySelectionBoxes(renderView, current.toBreak(), Baritone.settings().colorBlocksToBreak.get());
|
||||
drawManySelectionBoxes(renderView, current.toPlace(), Baritone.settings().colorBlocksToPlace.get());
|
||||
drawManySelectionBoxes(renderView, current.toWalkInto(), Baritone.settings().colorBlocksToWalkInto.get());
|
||||
drawManySelectionBoxes(renderView, current.toBreak(), Baritone.settings().colorBlocksToBreak.value);
|
||||
drawManySelectionBoxes(renderView, current.toPlace(), Baritone.settings().colorBlocksToPlace.value);
|
||||
drawManySelectionBoxes(renderView, current.toWalkInto(), Baritone.settings().colorBlocksToWalkInto.value);
|
||||
}
|
||||
|
||||
// If there is a path calculation currently running, render the path calculation process
|
||||
behavior.getInProgress().ifPresent(currentlyRunning -> {
|
||||
currentlyRunning.bestPathSoFar().ifPresent(p -> {
|
||||
drawPath(p, 0, renderView, partialTicks, Baritone.settings().colorBestPathSoFar.get(), Baritone.settings().fadePath.get(), 10, 20);
|
||||
drawPath(p, 0, renderView, partialTicks, Baritone.settings().colorBestPathSoFar.value, Baritone.settings().fadePath.value, 10, 20);
|
||||
});
|
||||
currentlyRunning.pathToMostRecentNodeConsidered().ifPresent(mr -> {
|
||||
|
||||
drawPath(mr, 0, renderView, partialTicks, Baritone.settings().colorMostRecentConsidered.get(), Baritone.settings().fadePath.get(), 10, 20);
|
||||
drawManySelectionBoxes(renderView, Collections.singletonList(mr.getDest()), Baritone.settings().colorMostRecentConsidered.get());
|
||||
drawPath(mr, 0, renderView, partialTicks, Baritone.settings().colorMostRecentConsidered.value, Baritone.settings().fadePath.value, 10, 20);
|
||||
drawManySelectionBoxes(renderView, Collections.singletonList(mr.getDest()), Baritone.settings().colorMostRecentConsidered.value);
|
||||
});
|
||||
});
|
||||
//long end = System.nanoTime();
|
||||
@ -132,10 +132,10 @@ public final class PathRenderer implements Helper {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
||||
GlStateManager.glLineWidth(Baritone.settings().pathRenderLineWidthPixels.get());
|
||||
GlStateManager.glLineWidth(Baritone.settings().pathRenderLineWidthPixels.value);
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.depthMask(false);
|
||||
if (Baritone.settings().renderPathIgnoreDepth.get()) {
|
||||
if (Baritone.settings().renderPathIgnoreDepth.value) {
|
||||
GlStateManager.disableDepth();
|
||||
}
|
||||
List<BetterBlockPos> positions = path.positions();
|
||||
@ -178,7 +178,7 @@ public final class PathRenderer implements Helper {
|
||||
drawLine(player, x1, y1, z1, x2, y2, z2);
|
||||
tessellator.draw();
|
||||
}
|
||||
if (Baritone.settings().renderPathIgnoreDepth.get()) {
|
||||
if (Baritone.settings().renderPathIgnoreDepth.value) {
|
||||
GlStateManager.enableDepth();
|
||||
}
|
||||
//GlStateManager.color(0.0f, 0.0f, 0.0f, 0.4f);
|
||||
@ -203,11 +203,11 @@ public final class PathRenderer implements Helper {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
||||
GlStateManager.glLineWidth(Baritone.settings().pathRenderLineWidthPixels.get());
|
||||
GlStateManager.glLineWidth(Baritone.settings().pathRenderLineWidthPixels.value);
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.depthMask(false);
|
||||
|
||||
if (Baritone.settings().renderSelectionBoxesIgnoreDepth.get()) {
|
||||
if (Baritone.settings().renderSelectionBoxesIgnoreDepth.value) {
|
||||
GlStateManager.disableDepth();
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@ public final class PathRenderer implements Helper {
|
||||
TESSELLATOR.draw();
|
||||
});
|
||||
|
||||
if (Baritone.settings().renderSelectionBoxesIgnoreDepth.get()) {
|
||||
if (Baritone.settings().renderSelectionBoxesIgnoreDepth.value) {
|
||||
GlStateManager.enableDepth();
|
||||
}
|
||||
|
||||
@ -292,12 +292,12 @@ public final class PathRenderer implements Helper {
|
||||
} else if (goal instanceof GoalXZ) {
|
||||
GoalXZ goalPos = (GoalXZ) goal;
|
||||
|
||||
if (Baritone.settings().renderGoalXZBeacon.get()) {
|
||||
if (Baritone.settings().renderGoalXZBeacon.value) {
|
||||
glPushAttrib(GL_LIGHTING_BIT);
|
||||
|
||||
mc.getTextureManager().bindTexture(TileEntityBeaconRenderer.TEXTURE_BEACON_BEAM);
|
||||
|
||||
if (Baritone.settings().renderGoalIgnoreDepth.get()) {
|
||||
if (Baritone.settings().renderGoalIgnoreDepth.value) {
|
||||
GlStateManager.disableDepth();
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ public final class PathRenderer implements Helper {
|
||||
color.getColorComponents(null)
|
||||
);
|
||||
|
||||
if (Baritone.settings().renderGoalIgnoreDepth.get()) {
|
||||
if (Baritone.settings().renderGoalIgnoreDepth.value) {
|
||||
GlStateManager.enableDepth();
|
||||
}
|
||||
|
||||
@ -342,10 +342,10 @@ public final class PathRenderer implements Helper {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.6F);
|
||||
GlStateManager.glLineWidth(Baritone.settings().goalRenderLineWidthPixels.get());
|
||||
GlStateManager.glLineWidth(Baritone.settings().goalRenderLineWidthPixels.value);
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.depthMask(false);
|
||||
if (Baritone.settings().renderGoalIgnoreDepth.get()) {
|
||||
if (Baritone.settings().renderGoalIgnoreDepth.value) {
|
||||
GlStateManager.disableDepth();
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ public final class PathRenderer implements Helper {
|
||||
BUFFER.pos(minX, maxY, maxZ).endVertex();
|
||||
TESSELLATOR.draw();
|
||||
|
||||
if (Baritone.settings().renderGoalIgnoreDepth.get()) {
|
||||
if (Baritone.settings().renderGoalIgnoreDepth.value) {
|
||||
GlStateManager.enableDepth();
|
||||
}
|
||||
GlStateManager.depthMask(true);
|
||||
|
@ -136,7 +136,7 @@ public class PathingControlManager implements IPathingControlManager {
|
||||
p.secretInternalSetGoalAndPath(command.goal);
|
||||
break;
|
||||
case REVALIDATE_GOAL_AND_PATH:
|
||||
if (Baritone.settings().cancelOnGoalInvalidation.get() && (command.goal == null || revalidateGoal(command.goal))) {
|
||||
if (Baritone.settings().cancelOnGoalInvalidation.value && (command.goal == null || revalidateGoal(command.goal))) {
|
||||
p.softCancelIfSafe();
|
||||
}
|
||||
p.secretInternalSetGoalAndPath(command.goal);
|
||||
|
@ -55,7 +55,7 @@ public class ToolSet {
|
||||
breakStrengthCache = new HashMap<>();
|
||||
this.player = player;
|
||||
|
||||
if (Baritone.settings().considerPotionEffects.get()) {
|
||||
if (Baritone.settings().considerPotionEffects.value) {
|
||||
double amplifier = potionAmplifier();
|
||||
Function<Double, Double> amplify = x -> amplifier * x;
|
||||
backendCalculation = amplify.compose(this::getBestDestructionTime);
|
||||
|
@ -57,17 +57,17 @@ public class Avoidance {
|
||||
}
|
||||
|
||||
public static List<Avoidance> create(IPlayerContext ctx) {
|
||||
if (!Baritone.settings().avoidance.get()) {
|
||||
if (!Baritone.settings().avoidance.value) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<Avoidance> res = new ArrayList<>();
|
||||
double mobSpawnerCoeff = Baritone.settings().mobSpawnerAvoidanceCoefficient.get();
|
||||
double mobCoeff = Baritone.settings().mobAvoidanceCoefficient.get();
|
||||
double mobSpawnerCoeff = Baritone.settings().mobSpawnerAvoidanceCoefficient.value;
|
||||
double mobCoeff = Baritone.settings().mobAvoidanceCoefficient.value;
|
||||
if (mobSpawnerCoeff != 1.0D) {
|
||||
ctx.worldData().getCachedWorld().getLocationsOf("mob_spawner", 1, ctx.playerFeet().x, ctx.playerFeet().z, 2).forEach(mobspawner -> res.add(new Avoidance(mobspawner, mobSpawnerCoeff, Baritone.settings().mobSpawnerAvoidanceRadius.get())));
|
||||
ctx.worldData().getCachedWorld().getLocationsOf("mob_spawner", 1, ctx.playerFeet().x, ctx.playerFeet().z, 2).forEach(mobspawner -> res.add(new Avoidance(mobspawner, mobSpawnerCoeff, Baritone.settings().mobSpawnerAvoidanceRadius.value)));
|
||||
}
|
||||
if (mobCoeff != 1.0D) {
|
||||
ctx.world().loadedEntityList.stream().filter(entity -> entity instanceof EntityMob).forEach(entity -> res.add(new Avoidance(new BlockPos(entity), mobCoeff, Baritone.settings().mobAvoidanceRadius.get())));
|
||||
ctx.world().loadedEntityList.stream().filter(entity -> entity instanceof EntityMob).forEach(entity -> res.add(new Avoidance(new BlockPos(entity), mobCoeff, Baritone.settings().mobAvoidanceRadius.value)));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public final class Favoring {
|
||||
public Favoring(IPath previous) { // create one just from previous path, no mob avoidances
|
||||
favorings = new Long2DoubleOpenHashMap();
|
||||
favorings.defaultReturnValue(1.0D);
|
||||
double coeff = Baritone.settings().backtrackCostFavoringCoefficient.get();
|
||||
double coeff = Baritone.settings().backtrackCostFavoringCoefficient.value;
|
||||
if (coeff != 1D && previous != null) {
|
||||
previous.positions().forEach(pos -> favorings.put(BetterBlockPos.longHash(pos), coeff));
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
public abstract class PathBase implements IPath {
|
||||
@Override
|
||||
public PathBase cutoffAtLoadedChunks(Object bsi0) { // <-- cursed cursed cursed
|
||||
if (!Baritone.settings().cutoffAtLoadBoundary.get()) {
|
||||
if (!Baritone.settings().cutoffAtLoadBoundary.value) {
|
||||
return this;
|
||||
}
|
||||
BlockStateInterface bsi = (BlockStateInterface) bsi0;
|
||||
@ -43,14 +43,14 @@ public abstract class PathBase implements IPath {
|
||||
|
||||
@Override
|
||||
public PathBase staticCutoff(Goal destination) {
|
||||
int min = BaritoneAPI.getSettings().pathCutoffMinimumLength.get();
|
||||
int min = BaritoneAPI.getSettings().pathCutoffMinimumLength.value;
|
||||
if (length() < min) {
|
||||
return this;
|
||||
}
|
||||
if (destination == null || destination.isInGoal(getDest())) {
|
||||
return this;
|
||||
}
|
||||
double factor = BaritoneAPI.getSettings().pathCutoffFactor.get();
|
||||
double factor = BaritoneAPI.getSettings().pathCutoffFactor.value;
|
||||
int newLength = (int) ((length() - min) * factor) + min - 1;
|
||||
return new CutoffPath(this, newLength);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class SegmentedCalculator {
|
||||
private PathCalculationResult segment(Optional<IPath> previous) {
|
||||
BetterBlockPos segmentStart = previous.map(IPath::getDest).orElse(start); // <-- e p i c
|
||||
AbstractNodeCostSearch search = new AStarPathFinder(segmentStart.x, segmentStart.y, segmentStart.z, goal, new Favoring(previous.orElse(null)), context); // this is on another thread, so cannot include mob avoidances.
|
||||
return search.calculate(Baritone.settings().primaryTimeoutMS.get(), Baritone.settings().failureTimeoutMS.get()); // use normal time settings, not the plan ahead settings, so as to not overwhelm the computer
|
||||
return search.calculate(Baritone.settings().primaryTimeoutMS.value, Baritone.settings().failureTimeoutMS.value); // use normal time settings, not the plan ahead settings, so as to not overwhelm the computer
|
||||
}
|
||||
|
||||
public static void calculateSegmentsThreaded(BetterBlockPos start, Goal goal, CalculationContext context, Consumer<IPath> onCompletion, Runnable onFailure) {
|
||||
|
Loading…
Reference in New Issue
Block a user