From adc88d1fb9af5b2fb4ea98ef20d3b20b5993f8c9 Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Sat, 2 Apr 2022 23:44:29 +0200 Subject: [PATCH 1/4] Fix dynamic mixin dependency to 0.8.3 Newer Mixin versions use a class file format Proguard can't handle. --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 59d8edef6..798b5b354 100755 --- a/build.gradle +++ b/build.gradle @@ -198,7 +198,7 @@ dependencies { } runtime launchCompile('org.ow2.asm:asm-debug-all:5.2') runtime launchCompile('com.github.ImpactDevelopment:SimpleTweaker:1.2') - runtime launchCompile('org.spongepowered:mixin:0.8.+') { + runtime launchCompile('org.spongepowered:mixin:0.8.3') { // Mixin includes a lot of dependencies that are too up-to-date exclude module: 'launchwrapper' exclude module: 'guava' From 4dcf260059d63ed12de94b7f1adeb6f26d1fbae8 Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Thu, 14 Apr 2022 19:08:42 +0200 Subject: [PATCH 2/4] Fix mistakes made while merging upwards --- .github/workflows/gradle_build.yml | 6 ++++++ .../command/defaults/WaypointsCommand.java | 20 +++++++++---------- src/main/java/baritone/utils/GuiClick.java | 4 ++-- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index 34e93bff2..2ad00904b 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -26,6 +26,12 @@ jobs: - name: Build with Gradle run: ./gradlew build + - name: Build (fabric) with Gradle + run: ./gradlew build -Pbaritone.fabric_build + + - name: Build (forge) with Gradle + run: ./gradlew build -Pbaritone.forge_build + - name: Archive Artifacts uses: actions/upload-artifact@v2 with: diff --git a/src/main/java/baritone/command/defaults/WaypointsCommand.java b/src/main/java/baritone/command/defaults/WaypointsCommand.java index 035ddd02e..671caf574 100644 --- a/src/main/java/baritone/command/defaults/WaypointsCommand.java +++ b/src/main/java/baritone/command/defaults/WaypointsCommand.java @@ -156,8 +156,8 @@ public class WaypointsCommand extends Command { ForWaypoints.waypoints(this.baritone).removeWaypoint(waypoint); } deletedWaypoints.computeIfAbsent(baritone.getWorldProvider().getCurrentWorld(), k -> new ArrayList<>()).addAll(Arrays.asList(waypoints)); - ITextComponent textComponent = new StringTextComponent(String.format("Cleared %d waypoints, click to restore them", waypoints.length)); - textComponent.getStyle().setClickEvent(new ClickEvent( + TextComponent textComponent = new StringTextComponent(String.format("Cleared %d waypoints, click to restore them", waypoints.length)); + textComponent.setStyle(textComponent.getStyle().setClickEvent(new ClickEvent( ClickEvent.Action.RUN_COMMAND, String.format( "%s%s restore @ %s", @@ -165,7 +165,7 @@ public class WaypointsCommand extends Command { label, Stream.of(waypoints).map(wp -> Long.toString(wp.getCreationTimestamp())).collect(Collectors.joining(" ")) ) - )); + ))); logDirect(textComponent); } else if (action == Action.RESTORE) { List waypoints = new ArrayList<>(); @@ -260,7 +260,7 @@ public class WaypointsCommand extends Command { ) ))); TextComponent recreateComponent = new StringTextComponent("Click to show a command to recreate this waypoint"); - recreateComponent.getStyle().setClickEvent(new ClickEvent( + recreateComponent.setStyle(recreateComponent.getStyle().setClickEvent(new ClickEvent( ClickEvent.Action.SUGGEST_COMMAND, String.format( "%s%s save %s %s %s %s %s", @@ -272,16 +272,16 @@ public class WaypointsCommand extends Command { waypoint.getLocation().y, waypoint.getLocation().z ) - )); + ))); TextComponent backComponent = new StringTextComponent("Click to return to the waypoints list"); - backComponent.getStyle().setClickEvent(new ClickEvent( + backComponent.setStyle(backComponent.getStyle().setClickEvent(new ClickEvent( ClickEvent.Action.RUN_COMMAND, String.format( "%s%s list", FORCE_COMMAND_PREFIX, label ) - )); + ))); logDirect(deleteComponent); logDirect(goalComponent); logDirect(recreateComponent); @@ -289,8 +289,8 @@ public class WaypointsCommand extends Command { } else if (action == Action.DELETE) { ForWaypoints.waypoints(this.baritone).removeWaypoint(waypoint); deletedWaypoints.computeIfAbsent(baritone.getWorldProvider().getCurrentWorld(), k -> new ArrayList<>()).add(waypoint); - ITextComponent textComponent = new StringTextComponent("That waypoint has successfully been deleted, click to restore it"); - textComponent.getStyle().setClickEvent(new ClickEvent( + TextComponent textComponent = new StringTextComponent("That waypoint has successfully been deleted, click to restore it"); + textComponent.setStyle(textComponent.getStyle().setClickEvent(new ClickEvent( ClickEvent.Action.RUN_COMMAND, String.format( "%s%s restore @ %s", @@ -298,7 +298,7 @@ public class WaypointsCommand extends Command { label, waypoint.getCreationTimestamp() ) - )); + ))); logDirect(textComponent); } else if (action == Action.GOAL) { Goal goal = new GoalBlock(waypoint.getLocation()); diff --git a/src/main/java/baritone/utils/GuiClick.java b/src/main/java/baritone/utils/GuiClick.java index 07b4093e7..56953ceef 100644 --- a/src/main/java/baritone/utils/GuiClick.java +++ b/src/main/java/baritone/utils/GuiClick.java @@ -88,12 +88,12 @@ public class GuiClick extends Screen implements Helper { BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().removeAllSelections(); BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().addSelection(BetterBlockPos.from(clickStart), BetterBlockPos.from(currentMouseOver)); TextComponent component = new StringTextComponent("Selection made! For usage: " + Baritone.settings().prefix.value + "help sel"); - component.getStyle() + component.setStyle(component.getStyle() .setFormatting(TextFormatting.WHITE) .setClickEvent(new ClickEvent( ClickEvent.Action.RUN_COMMAND, FORCE_COMMAND_PREFIX + "help sel" - )); + ))); Helper.HELPER.logDirect(component); clickStart = null; } else { From bf7c840ea381ebdcb0e67817d4654552a9e18486 Mon Sep 17 00:00:00 2001 From: wagyourtail Date: Fri, 22 Apr 2022 19:00:43 -0700 Subject: [PATCH 3/4] backport 3308 --- .../baritone/pathing/movement/MovementHelper.java | 4 +++- src/main/java/baritone/process/BuilderProcess.java | 13 ++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 4d4f1887b..7f84ab0e0 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -96,7 +96,7 @@ public interface MovementHelper extends ActionCosts, Helper { if (block instanceof AirBlock) { // early return for most common case return true; } - if (block instanceof AbstractFireBlock || block == Blocks.TRIPWIRE || block == Blocks.COBWEB || block == Blocks.END_PORTAL || block == Blocks.COCOA || block instanceof AbstractSkullBlock || block == Blocks.BUBBLE_COLUMN || block instanceof ShulkerBoxBlock || block instanceof SlabBlock || block instanceof TrapDoorBlock || block == Blocks.HONEY_BLOCK || block == Blocks.END_ROD) { + if (block instanceof BaseFireBlock || block == Blocks.TRIPWIRE || block == Blocks.COBWEB || block == Blocks.END_PORTAL || block == Blocks.COCOA || block instanceof AbstractSkullBlock || block == Blocks.BUBBLE_COLUMN || block instanceof ShulkerBoxBlock || block instanceof SlabBlock || block instanceof TrapDoorBlock || block == Blocks.HONEY_BLOCK || block == Blocks.END_ROD || block == Blocks.SWEET_BERRY_BUSH) { return false; } if (Baritone.settings().blocksToAvoid.value.contains(block)) { @@ -283,6 +283,8 @@ public interface MovementHelper extends ActionCosts, Helper { return !state.getFluidState().isEmpty() || block == Blocks.MAGMA_BLOCK || block == Blocks.CACTUS + || block == Blocks.SWEET_BERRY_BUSH + || block instanceof BaseFireBlock || block instanceof AbstractFireBlock || block == Blocks.END_PORTAL || block == Blocks.COBWEB diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 186412cea..f473b4cf8 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -847,7 +847,18 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil continue; } // - result.add(((BlockItem) stack.getItem()).getBlock().getStateForPlacement(new BlockItemUseContext(new ItemUseContext(ctx.world(), ctx.player(), Hand.MAIN_HAND, stack, new BlockRayTraceResult(new Vector3d(ctx.player().getPositionVec().x, ctx.player().getPositionVec().y, ctx.player().getPositionVec().z), Direction.UP, ctx.playerFeet(), false)) {}))); + BlockState itemState = ((BlockItem) stack.getItem()) + .getBlock() + .getStateForPlacement( + new BlockItemUseOnContext( + new ItemUseContext(ctx.world(), ctx.player(), InteractionHand.MAIN_HAND, stack, new BlockRayTraceResult(new Vector3d(ctx.player().position().x, ctx.player().position().y, ctx.player().position().z), Direction.UP, ctx.playerFeet(), false)) {} + ) + ); + if (itemState != null) { + result.add(itemState); + } else { + result.add(Blocks.AIR.defaultBlockState()); + } // } return result; From 25e8e1b5fe8c1cc03da9194ed37569aade533253 Mon Sep 17 00:00:00 2001 From: wagyourtail Date: Fri, 22 Apr 2022 19:23:39 -0700 Subject: [PATCH 4/4] fix --- src/main/java/baritone/pathing/movement/MovementHelper.java | 3 +-- src/main/java/baritone/process/BuilderProcess.java | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 7f84ab0e0..e67bd5638 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -96,7 +96,7 @@ public interface MovementHelper extends ActionCosts, Helper { if (block instanceof AirBlock) { // early return for most common case return true; } - if (block instanceof BaseFireBlock || block == Blocks.TRIPWIRE || block == Blocks.COBWEB || block == Blocks.END_PORTAL || block == Blocks.COCOA || block instanceof AbstractSkullBlock || block == Blocks.BUBBLE_COLUMN || block instanceof ShulkerBoxBlock || block instanceof SlabBlock || block instanceof TrapDoorBlock || block == Blocks.HONEY_BLOCK || block == Blocks.END_ROD || block == Blocks.SWEET_BERRY_BUSH) { + if (block instanceof AbstractFireBlock || block == Blocks.TRIPWIRE || block == Blocks.COBWEB || block == Blocks.END_PORTAL || block == Blocks.COCOA || block instanceof AbstractSkullBlock || block == Blocks.BUBBLE_COLUMN || block instanceof ShulkerBoxBlock || block instanceof SlabBlock || block instanceof TrapDoorBlock || block == Blocks.HONEY_BLOCK || block == Blocks.END_ROD || block == Blocks.SWEET_BERRY_BUSH) { return false; } if (Baritone.settings().blocksToAvoid.value.contains(block)) { @@ -284,7 +284,6 @@ public interface MovementHelper extends ActionCosts, Helper { || block == Blocks.MAGMA_BLOCK || block == Blocks.CACTUS || block == Blocks.SWEET_BERRY_BUSH - || block instanceof BaseFireBlock || block instanceof AbstractFireBlock || block == Blocks.END_PORTAL || block == Blocks.COBWEB diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index f473b4cf8..828cb0874 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -850,14 +850,14 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil BlockState itemState = ((BlockItem) stack.getItem()) .getBlock() .getStateForPlacement( - new BlockItemUseOnContext( - new ItemUseContext(ctx.world(), ctx.player(), InteractionHand.MAIN_HAND, stack, new BlockRayTraceResult(new Vector3d(ctx.player().position().x, ctx.player().position().y, ctx.player().position().z), Direction.UP, ctx.playerFeet(), false)) {} + new BlockItemUseContext( + new ItemUseContext(ctx.world(), ctx.player(), Hand.MAIN_HAND, stack, new BlockRayTraceResult(new Vector3d(ctx.player().getPositionVec().x, ctx.player().getPositionVec().y, ctx.player().getPositionVec().z), Direction.UP, ctx.playerFeet(), false)) {} ) ); if (itemState != null) { result.add(itemState); } else { - result.add(Blocks.AIR.defaultBlockState()); + result.add(Blocks.AIR.getDefaultState()); } // }