diff --git a/src/api/java/baritone/api/command/datatypes/RelativeCoordinate.java b/src/api/java/baritone/api/command/datatypes/RelativeCoordinate.java index b8f30a774..3d0f2613f 100644 --- a/src/api/java/baritone/api/command/datatypes/RelativeCoordinate.java +++ b/src/api/java/baritone/api/command/datatypes/RelativeCoordinate.java @@ -27,7 +27,7 @@ public enum RelativeCoordinate implements IDatatypePost { INSTANCE; private static String ScalesAliasRegex = "[kKmM]"; - private static Pattern PATTERN = Pattern.compile("^(~?)([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)("+ScalesAliasRegex+"?)|)$"); + private static Pattern PATTERN = Pattern.compile("^(~?)([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(" + ScalesAliasRegex + "?)|)$"); @Override public Double apply(IDatatypeContext ctx, Double origin) throws CommandException { @@ -43,7 +43,7 @@ public Double apply(IDatatypeContext ctx, Double origin) throws CommandException boolean isRelative = !matcher.group(1).isEmpty(); double offset = matcher.group(2).isEmpty() ? 0 : Double.parseDouble(matcher.group(2).replaceAll(ScalesAliasRegex, "")); - + if (matcher.group(2).toLowerCase().contains("k")) { offset *= 1000; } diff --git a/src/api/java/baritone/api/command/datatypes/RelativeFile.java b/src/api/java/baritone/api/command/datatypes/RelativeFile.java index 2c7adf98f..0bc3604ab 100644 --- a/src/api/java/baritone/api/command/datatypes/RelativeFile.java +++ b/src/api/java/baritone/api/command/datatypes/RelativeFile.java @@ -83,10 +83,10 @@ public static Stream tabComplete(IArgConsumer consumer, File base0) thro boolean useParent = !currentPathStringThing.isEmpty() && !currentPathStringThing.endsWith(File.separator); File currentFile = currentPath.isAbsolute() ? currentPath.toFile() : new File(base, currentPathStringThing); return Stream.of(Objects.requireNonNull(getCanonicalFileUnchecked( - useParent - ? currentFile.getParentFile() - : currentFile - ).listFiles())) + useParent + ? currentFile.getParentFile() + : currentFile + ).listFiles())) .map(f -> (currentPath.isAbsolute() ? f : basePath.relativize(f.toPath()).toString()) + (f.isDirectory() ? File.separator : "")) .filter(s -> s.toLowerCase(Locale.US).startsWith(currentPathStringThing.toLowerCase(Locale.US))) diff --git a/src/api/java/baritone/api/pathing/goals/GoalNear.java b/src/api/java/baritone/api/pathing/goals/GoalNear.java index 6a8226fb4..2252446cd 100644 --- a/src/api/java/baritone/api/pathing/goals/GoalNear.java +++ b/src/api/java/baritone/api/pathing/goals/GoalNear.java @@ -19,8 +19,8 @@ import baritone.api.utils.SettingsUtil; import baritone.api.utils.interfaces.IGoalRenderPos; -import it.unimi.dsi.fastutil.doubles.DoubleOpenHashSet; import it.unimi.dsi.fastutil.doubles.DoubleIterator; +import it.unimi.dsi.fastutil.doubles.DoubleOpenHashSet; import net.minecraft.util.math.BlockPos; public class GoalNear implements Goal, IGoalRenderPos { diff --git a/src/api/java/baritone/api/pathing/goals/GoalRunAway.java b/src/api/java/baritone/api/pathing/goals/GoalRunAway.java index 503ae7f43..b704ae4a6 100644 --- a/src/api/java/baritone/api/pathing/goals/GoalRunAway.java +++ b/src/api/java/baritone/api/pathing/goals/GoalRunAway.java @@ -18,8 +18,8 @@ package baritone.api.pathing.goals; import baritone.api.utils.SettingsUtil; -import it.unimi.dsi.fastutil.doubles.DoubleOpenHashSet; import it.unimi.dsi.fastutil.doubles.DoubleIterator; +import it.unimi.dsi.fastutil.doubles.DoubleOpenHashSet; import net.minecraft.util.math.BlockPos; import java.util.Arrays; diff --git a/src/api/java/baritone/api/schematic/SubstituteSchematic.java b/src/api/java/baritone/api/schematic/SubstituteSchematic.java index 72787c243..9f2013683 100644 --- a/src/api/java/baritone/api/schematic/SubstituteSchematic.java +++ b/src/api/java/baritone/api/schematic/SubstituteSchematic.java @@ -22,6 +22,7 @@ import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; + import java.util.Collection; import java.util.HashMap; import java.util.List; @@ -33,7 +34,7 @@ public class SubstituteSchematic extends AbstractSchematic { private final Map> substitutions; private final Map> blockStateCache = new HashMap<>(); - public SubstituteSchematic(ISchematic schematic, Map> substitutions) { + public SubstituteSchematic(ISchematic schematic, Map> substitutions) { super(schematic.widthX(), schematic.heightY(), schematic.lengthZ()); this.schematic = schematic; this.substitutions = substitutions; @@ -80,9 +81,10 @@ private IBlockState withBlock(IBlockState state, Block block) { } catch (IllegalArgumentException e) { //property does not exist for target block } } - blockStateCache.computeIfAbsent(state, s -> new HashMap()).put(block, newState); + blockStateCache.computeIfAbsent(state, s -> new HashMap()).put(block, newState); return newState; } + private > IBlockState copySingleProp(IBlockState fromState, IBlockState toState, IProperty prop) { return toState.withProperty(prop, fromState.getValue(prop)); } diff --git a/src/api/java/baritone/api/utils/SettingsUtil.java b/src/api/java/baritone/api/utils/SettingsUtil.java index 8b4b90b17..f47f515a8 100644 --- a/src/api/java/baritone/api/utils/SettingsUtil.java +++ b/src/api/java/baritone/api/utils/SettingsUtil.java @@ -299,7 +299,7 @@ public String toString(ParserContext context, Object value) { Parser keyParser = Parser.getParser(keyType); Parser valueParser = Parser.getParser(valueType); - return ((Map) value).entrySet().stream() + return ((Map) value).entrySet().stream() .map(o -> keyParser.toString(context, o.getKey()) + "->" + valueParser.toString(context, o.getValue())) .collect(Collectors.joining(",")); } diff --git a/src/launch/java/baritone/launch/mixins/MixinItemTool.java b/src/launch/java/baritone/launch/mixins/MixinItemTool.java index 4f5d025bf..8be3a837d 100644 --- a/src/launch/java/baritone/launch/mixins/MixinItemTool.java +++ b/src/launch/java/baritone/launch/mixins/MixinItemTool.java @@ -25,7 +25,8 @@ @Mixin(ItemTool.class) public class MixinItemTool implements IItemTool { - @Shadow protected Item.ToolMaterial toolMaterial; + @Shadow + protected Item.ToolMaterial toolMaterial; @Override public int getHarvestLevel() { diff --git a/src/main/java/baritone/behavior/InventoryBehavior.java b/src/main/java/baritone/behavior/InventoryBehavior.java index e96f1d54c..3dce5c0b5 100644 --- a/src/main/java/baritone/behavior/InventoryBehavior.java +++ b/src/main/java/baritone/behavior/InventoryBehavior.java @@ -18,7 +18,6 @@ package baritone.behavior; import baritone.Baritone; -import baritone.api.BaritoneAPI; import baritone.api.event.events.TickEvent; import baritone.utils.ToolSet; import net.minecraft.block.Block; diff --git a/src/main/java/baritone/behavior/WaypointBehavior.java b/src/main/java/baritone/behavior/WaypointBehavior.java index b21e080e7..dfc91af82 100644 --- a/src/main/java/baritone/behavior/WaypointBehavior.java +++ b/src/main/java/baritone/behavior/WaypointBehavior.java @@ -71,21 +71,21 @@ public void onPlayerDeath() { baritone.getWorldProvider().getCurrentWorld().getWaypoints().addWaypoint(deathWaypoint); ITextComponent component = new TextComponentString("Death position saved."); component.getStyle() - .setColor(TextFormatting.WHITE) - .setHoverEvent(new HoverEvent( - HoverEvent.Action.SHOW_TEXT, - new TextComponentString("Click to goto death") - )) - .setClickEvent(new ClickEvent( - ClickEvent.Action.RUN_COMMAND, - String.format( - "%s%s goto %s @ %d", - FORCE_COMMAND_PREFIX, - "wp", - deathWaypoint.getTag().getName(), - deathWaypoint.getCreationTimestamp() - ) - )); + .setColor(TextFormatting.WHITE) + .setHoverEvent(new HoverEvent( + HoverEvent.Action.SHOW_TEXT, + new TextComponentString("Click to goto death") + )) + .setClickEvent(new ClickEvent( + ClickEvent.Action.RUN_COMMAND, + String.format( + "%s%s goto %s @ %d", + FORCE_COMMAND_PREFIX, + "wp", + deathWaypoint.getTag().getName(), + deathWaypoint.getCreationTimestamp() + ) + )); Helper.HELPER.logDirect(component); } diff --git a/src/main/java/baritone/cache/WorldData.java b/src/main/java/baritone/cache/WorldData.java index cbdda3687..5a9ab389d 100644 --- a/src/main/java/baritone/cache/WorldData.java +++ b/src/main/java/baritone/cache/WorldData.java @@ -22,7 +22,6 @@ import baritone.api.cache.IWaypointCollection; import baritone.api.cache.IWorldData; -import java.io.IOException; import java.nio.file.Path; /** diff --git a/src/main/java/baritone/cache/WorldProvider.java b/src/main/java/baritone/cache/WorldProvider.java index 98ec1bbb2..97b15a137 100644 --- a/src/main/java/baritone/cache/WorldProvider.java +++ b/src/main/java/baritone/cache/WorldProvider.java @@ -23,8 +23,8 @@ import baritone.utils.accessor.IAnvilChunkLoader; import baritone.utils.accessor.IChunkProviderServer; import net.minecraft.server.integrated.IntegratedServer; -import net.minecraft.world.WorldServer; import net.minecraft.world.World; +import net.minecraft.world.WorldServer; import org.apache.commons.lang3.SystemUtils; import java.io.File; diff --git a/src/main/java/baritone/command/defaults/ETACommand.java b/src/main/java/baritone/command/defaults/ETACommand.java index 47b6ae9fa..4116d65b0 100644 --- a/src/main/java/baritone/command/defaults/ETACommand.java +++ b/src/main/java/baritone/command/defaults/ETACommand.java @@ -18,17 +18,16 @@ package baritone.command.defaults; import baritone.api.IBaritone; -import baritone.api.pathing.calc.IPathingControlManager; -import baritone.api.process.IBaritoneProcess; import baritone.api.behavior.IPathingBehavior; import baritone.api.command.Command; +import baritone.api.command.argument.IArgConsumer; import baritone.api.command.exception.CommandException; import baritone.api.command.exception.CommandInvalidStateException; -import baritone.api.command.argument.IArgConsumer; +import baritone.api.pathing.calc.IPathingControlManager; +import baritone.api.process.IBaritoneProcess; import java.util.Arrays; import java.util.List; -import java.util.Optional; import java.util.stream.Stream; public class ETACommand extends Command { diff --git a/src/main/java/baritone/command/defaults/FindCommand.java b/src/main/java/baritone/command/defaults/FindCommand.java index b20f14e98..2063d9300 100644 --- a/src/main/java/baritone/command/defaults/FindCommand.java +++ b/src/main/java/baritone/command/defaults/FindCommand.java @@ -79,10 +79,10 @@ private ITextComponent positionToComponent(BetterBlockPos pos) { ITextComponent baseComponent = new TextComponentString(pos.toString()); ITextComponent hoverComponent = new TextComponentString("Click to set goal to this position"); baseComponent.getStyle() - .setColor(TextFormatting.GRAY) - .setInsertion(positionText) - .setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command)) - .setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent)); + .setColor(TextFormatting.GRAY) + .setInsertion(positionText) + .setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command)) + .setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent)); return baseComponent; } @@ -90,9 +90,9 @@ private ITextComponent positionToComponent(BetterBlockPos pos) { public Stream tabComplete(String label, IArgConsumer args) throws CommandException { return new TabCompleteHelper() .append( - CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.stream() - .map(Block.REGISTRY::getNameForObject) - .map(Object::toString) + CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.stream() + .map(Block.REGISTRY::getNameForObject) + .map(Object::toString) ) .filterPrefixNamespaced(args.getString()) .sortAlphabetically() diff --git a/src/main/java/baritone/command/defaults/SelCommand.java b/src/main/java/baritone/command/defaults/SelCommand.java index 659a31835..5677eec3c 100644 --- a/src/main/java/baritone/command/defaults/SelCommand.java +++ b/src/main/java/baritone/command/defaults/SelCommand.java @@ -36,8 +36,8 @@ import baritone.api.utils.BetterBlockPos; import baritone.api.utils.BlockOptionalMeta; import baritone.api.utils.BlockOptionalMetaLookup; -import baritone.utils.IRenderer; import baritone.utils.BlockStateInterface; +import baritone.utils.IRenderer; import baritone.utils.schematic.StaticSchematic; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -193,7 +193,7 @@ public void execute(String label, IArgConsumer args) throws CommandException { } } } - ISchematic schematic = new StaticSchematic(){{ + ISchematic schematic = new StaticSchematic() {{ states = blockstates; x = size.getX(); y = size.getY(); diff --git a/src/main/java/baritone/command/defaults/WaypointsCommand.java b/src/main/java/baritone/command/defaults/WaypointsCommand.java index 5a45686a3..cf420e90a 100644 --- a/src/main/java/baritone/command/defaults/WaypointsCommand.java +++ b/src/main/java/baritone/command/defaults/WaypointsCommand.java @@ -20,8 +20,8 @@ import baritone.Baritone; import baritone.api.IBaritone; import baritone.api.cache.IWaypoint; -import baritone.api.cache.Waypoint; import baritone.api.cache.IWorldData; +import baritone.api.cache.Waypoint; import baritone.api.command.Command; import baritone.api.command.argument.IArgConsumer; import baritone.api.command.datatypes.ForWaypoints; @@ -50,7 +50,7 @@ public class WaypointsCommand extends Command { - private Map> deletedWaypoints = new HashMap<>(); + private Map> deletedWaypoints = new HashMap<>(); public WaypointsCommand(IBaritone baritone) { super(baritone, "waypoints", "waypoint", "wp"); diff --git a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java index c8a3528ee..1d79b0514 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java @@ -73,7 +73,7 @@ public static double cost(CalculationContext context, int x, int y, int z, int d IBlockState destOn = context.get(destX, y - 1, destZ); IBlockState srcDown = context.get(x, y - 1, z); Block srcDownBlock = srcDown.getBlock(); - boolean standingOnABlock = MovementHelper.mustBeSolidToWalkOn(context, x, y-1, z, srcDown); + boolean standingOnABlock = MovementHelper.mustBeSolidToWalkOn(context, x, y - 1, z, srcDown); boolean frostWalker = standingOnABlock && !context.assumeWalkOnWater && MovementHelper.canUseFrostWalker(context, destOn); if (frostWalker || MovementHelper.canWalkOn(context, destX, y - 1, destZ, destOn)) { //this is a walk, not a bridge double WC = WALK_ONE_BLOCK_COST; diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index e79cb815b..34f5c4c35 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -28,7 +28,6 @@ import baritone.cache.WorldScanner; import baritone.pathing.movement.CalculationContext; import baritone.pathing.movement.MovementHelper; -import baritone.pathing.precompute.PrecomputedData; import baritone.utils.BaritoneProcessHelper; import baritone.utils.BlockStateInterface; import net.minecraft.block.Block; @@ -215,6 +214,7 @@ private PathingCommand updateGoal() { public boolean isInGoal(int x, int y, int z) { return false; } + @Override public double heuristic() { return Double.NEGATIVE_INFINITY; @@ -500,9 +500,9 @@ private BlockOptionalMetaLookup filterFilter() { } if (!Baritone.settings().allowBreak.value) { BlockOptionalMetaLookup f = new BlockOptionalMetaLookup(this.filter.blocks() - .stream() - .filter(e -> Baritone.settings().allowBreakAnyway.value.contains(e.getBlock())) - .toArray(BlockOptionalMeta[]::new)); + .stream() + .filter(e -> Baritone.settings().allowBreakAnyway.value.contains(e.getBlock())) + .toArray(BlockOptionalMeta[]::new)); if (f.blocks().isEmpty()) { logDirect("Unable to mine when allowBreak is false and target block is not in allowBreakAnyway!"); return null; diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java index de29bca43..2fe224706 100644 --- a/src/main/java/baritone/utils/PathRenderer.java +++ b/src/main/java/baritone/utils/PathRenderer.java @@ -211,8 +211,7 @@ public static void drawDankLitGoalBox(Entity player, Goal goal, float partialTic if (!settings.renderGoalAnimated.value) { // y = 1 causes rendering issues when the player is at the same y as the top of a block for some reason y = 0.999F; - } - else { + } else { y = MathHelper.cos((float) (((float) ((System.nanoTime() / 100000L) % 20000L)) / 20000F * Math.PI * 2)); } if (goal instanceof IGoalRenderPos) { diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index 0ad4665d6..61f11e563 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -25,7 +25,6 @@ import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.init.Enchantments; import net.minecraft.init.MobEffects; -import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.item.ItemTool; @@ -130,7 +129,7 @@ possible, this lets us make pathing depend on the actual tool to be used (if aut if (!Baritone.settings().useSwordToMine.value && itemStack.getItem() instanceof ItemSword) { continue; } - + if (Baritone.settings().itemSaver.value && (itemStack.getItemDamage() + Baritone.settings().itemSaverThreshold.value) >= itemStack.getMaxDamage() && itemStack.getMaxDamage() > 1) { continue; } diff --git a/src/main/java/baritone/utils/schematic/SelectionSchematic.java b/src/main/java/baritone/utils/schematic/SelectionSchematic.java index 243a3d4d0..156a80918 100644 --- a/src/main/java/baritone/utils/schematic/SelectionSchematic.java +++ b/src/main/java/baritone/utils/schematic/SelectionSchematic.java @@ -33,10 +33,10 @@ public class SelectionSchematic extends MaskSchematic { public SelectionSchematic(ISchematic schematic, Vec3i origin, ISelection[] selections) { super(schematic); this.selections = Stream.of(selections).map( - sel -> sel - .shift(EnumFacing.WEST, origin.getX()) - .shift(EnumFacing.DOWN, origin.getY()) - .shift(EnumFacing.NORTH, origin.getZ())) + sel -> sel + .shift(EnumFacing.WEST, origin.getX()) + .shift(EnumFacing.DOWN, origin.getY()) + .shift(EnumFacing.NORTH, origin.getZ())) .toArray(ISelection[]::new); } @@ -44,7 +44,7 @@ public SelectionSchematic(ISchematic schematic, Vec3i origin, ISelection[] selec protected boolean partOfMask(int x, int y, int z, IBlockState currentState) { for (ISelection selection : selections) { if (x >= selection.min().x && y >= selection.min().y && z >= selection.min().z - && x <= selection.max().x && y <= selection.max().y && z <= selection.max().z) { + && x <= selection.max().x && y <= selection.max().y && z <= selection.max().z) { return true; } } diff --git a/src/main/java/baritone/utils/schematic/format/defaults/LitematicaSchematic.java b/src/main/java/baritone/utils/schematic/format/defaults/LitematicaSchematic.java index c2857bc2d..7ff737ebc 100644 --- a/src/main/java/baritone/utils/schematic/format/defaults/LitematicaSchematic.java +++ b/src/main/java/baritone/utils/schematic/format/defaults/LitematicaSchematic.java @@ -136,7 +136,7 @@ private static > IBlockState setPropertyValue(IBlockStat * @return amount of bits used to encode a block. */ private static int getBitsPerBlock(int amountOfBlockTypes) { - return (int) Math.max(2,Math.ceil(Math.log(amountOfBlockTypes) / Math.log(2))); + return (int) Math.max(2, Math.ceil(Math.log(amountOfBlockTypes) / Math.log(2))); } /**