diff --git a/src/main/java/baritone/bot/GameActionHandler.java b/src/main/java/baritone/bot/GameActionHandler.java new file mode 100755 index 00000000..d0511fd6 --- /dev/null +++ b/src/main/java/baritone/bot/GameActionHandler.java @@ -0,0 +1,15 @@ +package baritone.bot; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; + +/** + * @author Brady + * @since 7/31/2018 10:56 PM + */ +public final class GameActionHandler { + + GameActionHandler() {} + + public final void onPlacedBlock(ItemStack stack, BlockPos pos) {} +} diff --git a/src/main/java/baritone/bot/GameEventHandler.java b/src/main/java/baritone/bot/GameEventHandler.java new file mode 100755 index 00000000..021d148c --- /dev/null +++ b/src/main/java/baritone/bot/GameEventHandler.java @@ -0,0 +1,18 @@ +package baritone.bot; + +import baritone.bot.event.IGameEventListener; +import baritone.Baritone; + +/** + * @author Brady + * @since 7/31/2018 11:04 PM + */ +public final class GameEventHandler implements IGameEventListener { + + GameEventHandler() {} + + @Override + public final void onTick() { + Baritone.onTick(); + } +} diff --git a/src/main/java/baritone/bot/HookStateManager.java b/src/main/java/baritone/bot/HookStateManager.java new file mode 100755 index 00000000..59514548 --- /dev/null +++ b/src/main/java/baritone/bot/HookStateManager.java @@ -0,0 +1,25 @@ +package baritone.bot; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Brady + * @since 7/31/2018 10:29 PM + */ +public final class HookStateManager { + + HookStateManager() {} + + public final boolean shouldCancelDebugRenderRight() { + return false; + } + + public final boolean shouldOverrideDebugInfoLeft() { + return false; + } + + public final List getDebugInfoLeft() { + return new ArrayList<>(); + } +} diff --git a/src/main/java/baritone/bot/InputOverrideHandler.java b/src/main/java/baritone/bot/InputOverrideHandler.java new file mode 100755 index 00000000..cfd6ea64 --- /dev/null +++ b/src/main/java/baritone/bot/InputOverrideHandler.java @@ -0,0 +1,122 @@ +package baritone.bot; + +import baritone.bot.utils.Helper; +import net.minecraft.client.settings.KeyBinding; +import org.lwjgl.input.Keyboard; + +import java.util.HashMap; +import java.util.Map; + +/** + * This serves as a replacement to the old {@code MovementManager}'s + * input overriding capabilities. It is vastly more extensible in the + * inputs that can be overriden. + * + * @author Brady + * @since 7/31/2018 11:20 PM + */ +public final class InputOverrideHandler implements Helper { + + InputOverrideHandler() {} + + /** + * Maps keybinds to whether or not we are forcing their state down + */ + private final Map inputForceStateMap = new HashMap<>(); + + /** + * Maps keycodes to whether or not we are forcing their state down + */ + private final Map keyCodeForceStateMap = new HashMap<>(); + + /** + * Returns whether or not we are forcing down the specified {@link KeyBinding}. + * + * @param key The KeyBinding object + * @return Whether or not it is being forced down + */ + public final boolean isInputForcedDown(KeyBinding key) { + return inputForceStateMap.computeIfAbsent(key, k -> false); + } + + /** + * Sets whether or not the specified {@link Input} is being forced down. + * + * @param input The {@link Input} + * @param forced Whether or not the state is being forced + */ + public final void setInputForceState(Input input, boolean forced) { + inputForceStateMap.put(input.getKeyBinding(), forced); + } + + /** + * A redirection in multiple places of {@link Keyboard#isKeyDown}. + * + * @return Whether or not the specified key is down or overriden. + */ + public boolean isKeyDown(int keyCode) { + return Keyboard.isKeyDown(keyCode) || keyCodeForceStateMap.computeIfAbsent(keyCode, k -> false); + } + + /** + * Sets whether or not the specified key code is being forced down. + * + * @param keyCode The key code + * @param forced Whether or not the state is being forced + */ + public final void setKeyForceState(int keyCode, boolean forced) { + keyCodeForceStateMap.put(keyCode, forced); + } + + /** + * An {@link Enum} representing the possible inputs that we may want to force. + */ + public enum Input { + + /** + * The move forward input + */ + MOVE_FORWARD(mc.gameSettings.keyBindForward), + + /** + * The move back input + */ + MOVE_BACK(mc.gameSettings.keyBindBack), + + /** + * The move left input + */ + MOVE_LEFT(mc.gameSettings.keyBindLeft), + + /** + * The move right input + */ + MOVE_RIGHT(mc.gameSettings.keyBindRight), + + /** + * The attack input + */ + CLICK_LEFT(mc.gameSettings.keyBindAttack), + + /** + * The use item input + */ + CLICK_RIGHT(mc.gameSettings.keyBindUseItem); + + /** + * The actual game {@link KeyBinding} being forced. + */ + private KeyBinding keyBinding; + + Input(KeyBinding keyBinding) { + this.keyBinding = keyBinding; + } + + /** + * @return The actual game {@link KeyBinding} being forced. + */ + public final KeyBinding getKeyBinding() { + return this.keyBinding; + } + } +} diff --git a/src/main/java/baritone/bot/Memory.java b/src/main/java/baritone/bot/Memory.java new file mode 100755 index 00000000..22977255 --- /dev/null +++ b/src/main/java/baritone/bot/Memory.java @@ -0,0 +1,24 @@ +package baritone.bot; + +import net.minecraft.util.math.BlockPos; + +/** + * @author Brady + * @since 7/31/2018 10:50 PM + */ +public final class Memory { + + public final void scanBlock(BlockPos pos) { + checkActive(() -> { + // We might want to always run this method even if Baritone + // isn't active, this is just an example of the implementation + // of checkActive(Runnable). + }); + } + + private void checkActive(Runnable runnable) { + if (Baritone.INSTANCE.isActive()) { + runnable.run(); + } + } +} diff --git a/src/main/java/baritone/bot/Minebot.java b/src/main/java/baritone/bot/Minebot.java new file mode 100755 index 00000000..7dbd65a7 --- /dev/null +++ b/src/main/java/baritone/bot/Minebot.java @@ -0,0 +1,68 @@ +package baritone.bot; + +/** + * @author Brady + * @since 7/31/2018 10:50 PM + */ +public enum Baritone { + + /** + * Singleton instance of this class + */ + INSTANCE; + + /** + * Whether or not {@link Baritone#init()} has been called yet + */ + private boolean initialized; + + private Memory memory; + private HookStateManager hookStateManager; + private GameActionHandler actionHandler; + private GameEventHandler gameEventHandler; + private InputOverrideHandler inputOverrideHandler; + + /** + * Whether or not Baritone is active + */ + private boolean active; + + public void init() { + this.memory = new Memory(); + this.hookStateManager = new HookStateManager(); + this.actionHandler = new GameActionHandler(); + this.gameEventHandler = new GameEventHandler(); + this.inputOverrideHandler = new InputOverrideHandler(); + + this.active = true; + this.initialized = true; + } + + public final boolean isInitialized() { + return this.initialized; + } + + public final Memory getMemory() { + return this.memory; + } + + public final HookStateManager getHookStateManager() { + return this.hookStateManager; + } + + public final GameActionHandler getActionHandler() { + return this.actionHandler; + } + + public final GameEventHandler getGameEventHandler() { + return this.gameEventHandler; + } + + public final InputOverrideHandler getInputOverrideHandler() { + return this.inputOverrideHandler; + } + + public final boolean isActive() { + return this.active; + } +} diff --git a/src/main/java/baritone/bot/event/IGameEventListener.java b/src/main/java/baritone/bot/event/IGameEventListener.java new file mode 100755 index 00000000..9bfd6107 --- /dev/null +++ b/src/main/java/baritone/bot/event/IGameEventListener.java @@ -0,0 +1,15 @@ +package baritone.bot.event; + +import net.minecraft.client.Minecraft; + +/** + * @author Brady + * @since 7/31/2018 11:05 PM + */ +public interface IGameEventListener { + + /** + * Run once per game tick from {@link Minecraft#runTick}. + */ + void onTick(); +} diff --git a/src/main/java/baritone/bot/utils/Helper.java b/src/main/java/baritone/bot/utils/Helper.java new file mode 100755 index 00000000..430c313e --- /dev/null +++ b/src/main/java/baritone/bot/utils/Helper.java @@ -0,0 +1,12 @@ +package baritone.bot.utils; + +import net.minecraft.client.Minecraft; + +/** + * @author Brady + * @since 8/1/2018 12:18 AM + */ +public interface Helper { + + Minecraft mc = Minecraft.getMinecraft(); +} diff --git a/src/main/java/baritone/bot/utils/Utils.java b/src/main/java/baritone/bot/utils/Utils.java new file mode 100755 index 00000000..34b79475 --- /dev/null +++ b/src/main/java/baritone/bot/utils/Utils.java @@ -0,0 +1,15 @@ +package baritone.bot.utils; + +import java.util.function.Supplier; + +/** + * @author Brady + * @since 8/1/2018 12:56 AM + */ +public final class Utils { + + public static void ifConditionThen(Supplier condition, Runnable runnable) { + if (condition.get()) + runnable.run(); + } +} diff --git a/src/main/java/baritone/launch/BaritoneTweaker.java b/src/main/java/baritone/launch/BaritoneTweaker.java new file mode 100755 index 00000000..d979cafb --- /dev/null +++ b/src/main/java/baritone/launch/BaritoneTweaker.java @@ -0,0 +1,54 @@ +package baritone.launch; + +import net.minecraft.launchwrapper.ITweaker; +import net.minecraft.launchwrapper.LaunchClassLoader; +import org.spongepowered.asm.launch.MixinBootstrap; +import org.spongepowered.asm.mixin.MixinEnvironment; +import org.spongepowered.asm.mixin.Mixins; +import org.spongepowered.tools.obfuscation.mcp.ObfuscationServiceMCP; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +/** + * @author Brady + * @since 7/31/2018 9:59 PM + */ +public class BaritoneTweaker implements ITweaker { + + List args; + + @Override + public void acceptOptions(List args, File gameDir, File assetsDir, String profile) { + this.args = new ArrayList<>(args); + if (gameDir != null) addArg("gameDir", gameDir.getAbsolutePath()); + if (assetsDir != null) addArg("assetsDir", assetsDir.getAbsolutePath()); + if (profile != null) addArg("version", profile); + } + + @Override + public void injectIntoClassLoader(LaunchClassLoader classLoader) { + MixinBootstrap.init(); + MixinEnvironment.getDefaultEnvironment().setSide(MixinEnvironment.Side.CLIENT); + MixinEnvironment.getDefaultEnvironment().setObfuscationContext(ObfuscationServiceMCP.NOTCH); + Mixins.addConfiguration("mixins.baritone.json"); + } + + @Override + public final String getLaunchTarget() { + return "net.minecraft.client.main.Main"; + } + + @Override + public final String[] getLaunchArguments() { + return this.args.toArray(new String[0]); + } + + private void addArg(String label, String value) { + if (!args.contains("--" + label) && value != null) { + this.args.add("--" + label); + this.args.add(value); + } + } +} diff --git a/src/main/java/baritone/launch/BaritoneTweakerForge.java b/src/main/java/baritone/launch/BaritoneTweakerForge.java new file mode 100755 index 00000000..e56ef2da --- /dev/null +++ b/src/main/java/baritone/launch/BaritoneTweakerForge.java @@ -0,0 +1,27 @@ +package baritone.launch; + +import net.minecraft.launchwrapper.LaunchClassLoader; +import org.spongepowered.asm.mixin.MixinEnvironment; +import org.spongepowered.tools.obfuscation.mcp.ObfuscationServiceMCP; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +/** + * @author Brady + * @since 7/31/2018 10:09 PM + */ +public class BaritoneTweakerForge extends BaritoneTweaker { + + @Override + public final void acceptOptions(List args, File gameDir, File assetsDir, String profile) { + this.args = new ArrayList<>(); + } + + @Override + public final void injectIntoClassLoader(LaunchClassLoader classLoader) { + super.injectIntoClassLoader(classLoader); + MixinEnvironment.getDefaultEnvironment().setObfuscationContext(ObfuscationServiceMCP.SEARGE); + } +} diff --git a/src/main/java/baritone/launch/BaritoneTweakerOptifine.java b/src/main/java/baritone/launch/BaritoneTweakerOptifine.java new file mode 100755 index 00000000..acea085f --- /dev/null +++ b/src/main/java/baritone/launch/BaritoneTweakerOptifine.java @@ -0,0 +1,17 @@ +package baritone.launch; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +/** + * @author Brady + * @since 7/31/2018 10:10 PM + */ +public class BaritoneTweakerOptifine extends BaritoneTweaker { + + @Override + public final void acceptOptions(List args, File gameDir, File assetsDir, String profile) { + this.args = new ArrayList<>(); + } +} diff --git a/src/main/java/baritone/launch/mixins/MixinGameSettings.java b/src/main/java/baritone/launch/mixins/MixinGameSettings.java new file mode 100755 index 00000000..b8a50d6b --- /dev/null +++ b/src/main/java/baritone/launch/mixins/MixinGameSettings.java @@ -0,0 +1,26 @@ +package baritone.launch.mixins; + +import baritone.bot.Baritone; +import net.minecraft.client.settings.GameSettings; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +/** + * @author Brady + * @since 8/1/2018 12:28 AM + */ +@Mixin(GameSettings.class) +public class MixinGameSettings { + + @Redirect( + method = "isKeyDown", + at = @At( + value = "INVOKE", + target = "org/lwjgl/input/Keyboard.isKeyDown(I)Z" + ) + ) + private static boolean isKeyDown(int keyCode) { + return Baritone.INSTANCE.getInputOverrideHandler().isKeyDown(keyCode); + } +} diff --git a/src/main/java/baritone/launch/mixins/MixinGuiContainer.java b/src/main/java/baritone/launch/mixins/MixinGuiContainer.java new file mode 100755 index 00000000..f7fcbf20 --- /dev/null +++ b/src/main/java/baritone/launch/mixins/MixinGuiContainer.java @@ -0,0 +1,29 @@ +package baritone.launch.mixins; + +import baritone.bot.Baritone; +import net.minecraft.client.gui.inventory.GuiContainer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +/** + * @author Brady + * @since 7/31/2018 10:47 PM + */ +@Mixin(GuiContainer.class) +public class MixinGuiContainer { + + @Redirect( + method = { + "mouseClicked", + "mouseReleased" + }, + at = @At( + value = "INVOKE", + target = "org/lwjgl/input/Keyboard.isKeyDown(I)Z" + ) + ) + private boolean isKeyDown(int keyCode) { + return Baritone.INSTANCE.getInputOverrideHandler().isKeyDown(keyCode); + } +} diff --git a/src/main/java/baritone/launch/mixins/MixinGuiOverlayDebug.java b/src/main/java/baritone/launch/mixins/MixinGuiOverlayDebug.java new file mode 100755 index 00000000..e2aa6b80 --- /dev/null +++ b/src/main/java/baritone/launch/mixins/MixinGuiOverlayDebug.java @@ -0,0 +1,50 @@ +package baritone.launch.mixins; + +import baritone.bot.HookStateManager; +import baritone.bot.Baritone; +import net.minecraft.client.gui.GuiOverlayDebug; +import net.minecraft.client.gui.ScaledResolution; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.List; + +/** + * @author Brady + * @since 7/31/2018 10:28 PM + */ +@Mixin(GuiOverlayDebug.class) +public abstract class MixinGuiOverlayDebug { + + @Shadow protected abstract void renderDebugInfoRight(ScaledResolution scaledResolution); + + @Redirect( + method = "renderDebugInfo", + at = @At( + value = "INVOKE", + target = "net/minecraft/client/gui/GuiOverlayDebug.renderDebugInfoRight(Lnet/minecraft/client/gui/ScaledResolution;)V" + ) + ) + private void onRenderDebugInfoRight(GuiOverlayDebug gui, ScaledResolution scaledResolution) { + if (!Baritone.INSTANCE.getHookStateManager().shouldCancelDebugRenderRight()) { + this.renderDebugInfoRight(scaledResolution); + } + } + + @Inject( + method = "call", + at = @At("HEAD"), + cancellable = true + ) + private void call(CallbackInfoReturnable> cir) { + HookStateManager hooks = Baritone.INSTANCE.getHookStateManager(); + + if (hooks.shouldOverrideDebugInfoLeft()) { + cir.setReturnValue(hooks.getDebugInfoLeft()); + } + } +} diff --git a/src/main/java/baritone/launch/mixins/MixinGuiScreen.java b/src/main/java/baritone/launch/mixins/MixinGuiScreen.java new file mode 100755 index 00000000..c934ae2c --- /dev/null +++ b/src/main/java/baritone/launch/mixins/MixinGuiScreen.java @@ -0,0 +1,30 @@ +package baritone.launch.mixins; + +import baritone.bot.Baritone; +import net.minecraft.client.gui.GuiScreen; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +/** + * @author Brady + * @since 7/31/2018 10:38 PM + */ +@Mixin(GuiScreen.class) +public class MixinGuiScreen { + + @Redirect( + method = { + "isCtrlKeyDown", + "isShiftKeyDown", + "isAltKeyDown" + }, + at = @At( + value = "INVOKE", + target = "org/lwjgl/input/Keyboard.isKeyDown(I)Z" + ) + ) + private static boolean isKeyDown(int keyCode) { + return Baritone.INSTANCE.getInputOverrideHandler().isKeyDown(keyCode); + } +} diff --git a/src/main/java/baritone/launch/mixins/MixinKeyBinding.java b/src/main/java/baritone/launch/mixins/MixinKeyBinding.java new file mode 100755 index 00000000..74dfb6cf --- /dev/null +++ b/src/main/java/baritone/launch/mixins/MixinKeyBinding.java @@ -0,0 +1,55 @@ +package baritone.launch.mixins; + +import baritone.bot.Baritone; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.util.IntHashMap; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/** + * @author Brady + * @since 7/31/2018 11:44 PM + */ +@Mixin(KeyBinding.class) +public abstract class MixinKeyBinding { + + @Redirect( + method = "onTick", + at = @At( + value = "INVOKE", + target = "net/minecraft/util/IntHashMap.lookup(I)Ljava/lang/Object;" + ) + ) + private static Object lookup(IntHashMap HASH, int keyCode) { + KeyBinding keyBinding = HASH.lookup(keyCode); + + // If we're overriding the key state, we don't want to be incrementing the pressTime + if (keyBinding != null && Baritone.INSTANCE.getInputOverrideHandler().isInputForcedDown(keyBinding)) + return null; + + return keyBinding; + } + + @Inject( + method = "isPressed", + at = @At("HEAD"), + cancellable = true + ) + private void isPressed(CallbackInfoReturnable cir) { + if (Baritone.INSTANCE.getInputOverrideHandler().isInputForcedDown((KeyBinding) (Object) this)) + cir.setReturnValue(true); + } + + @Inject( + method = "isKeyDown", + at = @At("HEAD"), + cancellable = true + ) + private void isKeyDown(CallbackInfoReturnable cir) { + if (Baritone.INSTANCE.getInputOverrideHandler().isInputForcedDown((KeyBinding) (Object) this)) + cir.setReturnValue(true); + } +} diff --git a/src/main/java/baritone/launch/mixins/MixinMain.java b/src/main/java/baritone/launch/mixins/MixinMain.java new file mode 100755 index 00000000..10f5d9ad --- /dev/null +++ b/src/main/java/baritone/launch/mixins/MixinMain.java @@ -0,0 +1,23 @@ +package baritone.launch.mixins; + +import net.minecraft.client.main.Main; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +/** + * @author Brady + * @since 7/31/2018 10:18 PM + */ +@Mixin(Main.class) +public class MixinMain { + + @Inject( + method = "main", + at = @At("HEAD") + ) + private static void main(String[] args, CallbackInfo ci) { + System.setProperty("java.net.preferIPv4Stack", "true"); + } +} diff --git a/src/main/java/baritone/launch/mixins/MixinMinecraft.java b/src/main/java/baritone/launch/mixins/MixinMinecraft.java new file mode 100755 index 00000000..354d3f82 --- /dev/null +++ b/src/main/java/baritone/launch/mixins/MixinMinecraft.java @@ -0,0 +1,93 @@ +package baritone.launch.mixins; + +import baritone.bot.Baritone; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.math.BlockPos; +import org.spongepowered.asm.lib.Opcodes; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +/** + * @author Brady + * @since 7/31/2018 10:51 PM + */ +@Mixin(Minecraft.class) +public class MixinMinecraft { + + @Shadow private int leftClickCounter; + + @Inject( + method = "init", + at = @At("RETURN") + ) + private void init(CallbackInfo ci) { + Baritone.INSTANCE.init(); + } + + @Inject( + method = "runTick", + at = @At( + value = "FIELD", + opcode = Opcodes.GETFIELD, + target = "net/minecraft/client/Minecraft.currentScreen:Lnet/minecraft/client/gui/GuiScreen;", + ordinal = 5, + shift = At.Shift.BY, + by = -3 + ) + ) + private void runTick(CallbackInfo ci) { + Baritone.INSTANCE.getGameEventHandler().onTick(); + } + + @Redirect( + method = "runTickKeyboard", + at = @At( + value = "INVOKE", + target = "org/lwjgl/input/Keyboard.isKeyDown(I)Z" + ) + ) + private boolean Keyboard$isKeyDown(int keyCode) { + return Baritone.INSTANCE.getInputOverrideHandler().isKeyDown(keyCode); + } + + @Redirect( + method = { + "setIngameFocus", + "runTick" + }, + at = @At( + value = "FIELD", + opcode = Opcodes.PUTFIELD, + target = "net/minecraft/client/Minecraft.leftClickCounter:I", + ordinal = 0 + ) + ) + private void setLeftClickCounter(Minecraft mc, int value) { + if (!Baritone.INSTANCE.isInitialized() || !Baritone.INSTANCE.getInputOverrideHandler().isInputForcedDown(mc.gameSettings.keyBindAttack)) + this.leftClickCounter = value; + } + + @Inject( + method = "rightClickMouse", + at = @At( + value = "INVOKE_ASSIGN", + target = "net/minecraft/client/entity/EntityPlayerSP.swingArm(Lnet/minecraft/util/EnumHand;)V" + ), + locals = LocalCapture.CAPTURE_FAILHARD + ) + private void postSwingArm(CallbackInfo ci, ItemStack stack, BlockPos pos, int stackCount, EnumActionResult result) { + Minecraft mc = (Minecraft) (Object) this; + Baritone bot = Baritone.INSTANCE; + + bot.getMemory().scanBlock(pos); + bot.getMemory().scanBlock(pos.offset(mc.objectMouseOver.sideHit)); + bot.getActionHandler().onPlacedBlock(stack, pos); + } +} diff --git a/src/main/resources/mixins.baritone.json b/src/main/resources/mixins.baritone.json new file mode 100755 index 00000000..068def0e --- /dev/null +++ b/src/main/resources/mixins.baritone.json @@ -0,0 +1,16 @@ +{ + "required": true, + "package": "baritone.launch.mixins", + "refmap": "mixins.client.refmap.json", + "compatibilityLevel": "JAVA_8", + "verbose": false, + "client": [ + "MixinGameSettings", + "MixinGuiContainer", + "MixinGuiOverlayDebug", + "MixinGuiScreen", + "MixinKeyBinding", + "MixinMain", + "MixinMinecraft" + ] +} \ No newline at end of file