diff --git a/.github/workflows/dev_build.yml b/.github/workflows/dev_build.yml index 666553a2..f1edd855 100644 --- a/.github/workflows/dev_build.yml +++ b/.github/workflows/dev_build.yml @@ -16,8 +16,8 @@ jobs: uses: marvinpinto/action-automatic-releases@latest with: repo_token: '${{ secrets.GITHUB_TOKEN }}' - automatic_release_tag: "latest-dev-build-0.5.3-1835-1.19.4" + automatic_release_tag: "latest-dev-build-0.5.4-1.20" prerelease: true - title: "Dev build 0.5.3 #1835 | 1.19.4 Build" + title: "Dev build 0.5.4 | 1.20 Build" files: | ./build/libs/*.jar diff --git a/src/main/java/olejka/meteorplus/mixin/meteorclient/FreecamMixin.java b/src/main/java/olejka/meteorplus/mixin/meteorclient/FreecamMixin.java new file mode 100644 index 00000000..aa45e02e --- /dev/null +++ b/src/main/java/olejka/meteorplus/mixin/meteorclient/FreecamMixin.java @@ -0,0 +1,54 @@ +package olejka.meteorplus.mixin.meteorclient; + +import baritone.api.BaritoneAPI; +import baritone.api.pathing.goals.GoalBlock; +import meteordevelopment.meteorclient.events.meteor.MouseButtonEvent; +import meteordevelopment.meteorclient.settings.BoolSetting; +import meteordevelopment.meteorclient.settings.Setting; +import meteordevelopment.meteorclient.settings.SettingGroup; +import meteordevelopment.meteorclient.systems.modules.render.Freecam; +import meteordevelopment.meteorclient.utils.misc.input.KeyAction; +import meteordevelopment.orbit.EventHandler; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import org.lwjgl.glfw.GLFW; +import org.spongepowered.asm.mixin.Mixin; + +import static baritone.api.utils.Helper.mc; + +@Mixin(Freecam.class) +public class FreecamMixin { + private final Freecam freecam = (Freecam)(Object) this; + + private final SettingGroup freecamMeteorPlusSetting = freecam.settings.createGroup("Meteor Plus"); + + private final Setting baritoneControl = freecamMeteorPlusSetting.add(new BoolSetting.Builder() + .name("Baritone control") + .description("Left-click to set the destination on the selected block. Right click to cancel.") + .build() + ); + + @EventHandler + private void onMouseButtonEvent(MouseButtonEvent event) { + if (!baritoneControl.get()) return; + if (event.action != KeyAction.Press) return; + if (mc.currentScreen != null) return; + + if (event.button == GLFW.GLFW_MOUSE_BUTTON_LEFT) { + if (!(mc.crosshairTarget instanceof BlockHitResult)) return; + + BlockPos blockPos = ((BlockHitResult) mc.crosshairTarget).getBlockPos(); + + if (mc.world.getBlockState(blockPos).isAir()) return; + + GoalBlock goal = new GoalBlock(blockPos.up()); + BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(goal); + event.cancel(); + } + + if (event.button == GLFW.GLFW_MOUSE_BUTTON_RIGHT) { + BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(null); + event.cancel(); + } + } +} diff --git a/src/main/resources/meteor-plus.mixins.json b/src/main/resources/meteor-plus.mixins.json index 41aa4d1b..decad6e1 100644 --- a/src/main/resources/meteor-plus.mixins.json +++ b/src/main/resources/meteor-plus.mixins.json @@ -9,6 +9,7 @@ }, "mixins": [ "ClientPlayerInteractionManagerMixin", - "InGameHudMixin" + "InGameHudMixin", + "meteorclient.FreecamMixin" ] }