Skip to content

Commit 1466a22

Browse files
committed
modify baritone come command to go to freecam when its active
1 parent 165bf0c commit 1466a22

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2026 Lambda
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.lambda.mixin.baritone;
19+
20+
import baritone.api.pathing.goals.GoalBlock;
21+
import baritone.command.defaults.ComeCommand;
22+
import com.lambda.Lambda;
23+
import com.lambda.module.modules.render.Freecam;
24+
import org.spongepowered.asm.mixin.Mixin;
25+
import org.spongepowered.asm.mixin.injection.At;
26+
import org.spongepowered.asm.mixin.injection.ModifyArgs;
27+
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
28+
29+
@Mixin(value = ComeCommand.class, remap = false)
30+
public class ComeCommandMixin {
31+
@ModifyArgs(method = "execute", at = @At(value = "INVOKE", target = "Lbaritone/api/process/ICustomGoalProcess;setGoalAndPath(Lbaritone/api/pathing/goals/Goal;)V"))
32+
private void modifyTarget(Args args) {
33+
if (Freecam.INSTANCE.isDisabled()) return;
34+
var camera = Lambda.getMc().gameRenderer.getCamera();
35+
var pos = camera.getBlockPos();
36+
args.set(0, new GoalBlock(pos.getX(), pos.getY(), pos.getZ()));
37+
}
38+
}

src/main/resources/lambda.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"MinecraftClientMixin",
99
"baritone.BaritonePlayerContextMixin",
1010
"baritone.LookBehaviourMixin",
11+
"baritone.ComeCommandMixin",
1112
"client.sound.SoundSystemMixin",
1213
"entity.ClientPlayerEntityMixin",
1314
"entity.ClientPlayInteractionManagerMixin",

0 commit comments

Comments
 (0)