From 1f52f706ede198eb541c7105761304fd94d76ce6 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 20 Feb 2019 23:41:29 -0800 Subject: [PATCH 1/4] should fix anticheatcompat off on forge --- src/main/java/baritone/behavior/LookBehavior.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/behavior/LookBehavior.java b/src/main/java/baritone/behavior/LookBehavior.java index 9ee059c6..df0921cf 100644 --- a/src/main/java/baritone/behavior/LookBehavior.java +++ b/src/main/java/baritone/behavior/LookBehavior.java @@ -109,7 +109,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior { // If we have antiCheatCompatibility on, we're going to use the target value later in onPlayerUpdate() // Also the type has to be MOTION_UPDATE because that is called after JUMP - if (!Baritone.settings().antiCheatCompatibility.get() && event.getType() == RotationMoveEvent.Type.MOTION_UPDATE) { + if (!Baritone.settings().antiCheatCompatibility.get() && event.getType() == RotationMoveEvent.Type.MOTION_UPDATE && !this.force) { this.target = null; } } From 29a9e6e1d1d27bf3bfdc715d756ef9a77e362c1b Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 21 Feb 2019 09:45:01 -0800 Subject: [PATCH 2/4] fine, forward alias to thisway --- src/main/java/baritone/utils/ExampleBaritoneControl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index edd426a3..83a8df6c 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -385,7 +385,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper { logDirect("Started mining blocks of type " + Arrays.toString(blockTypes)); return true; } - if (msg.startsWith("thisway")) { + if (msg.startsWith("thisway") || msg.startsWith("forward")) { try { Goal goal = GoalXZ.fromDirection(ctx.playerFeetAsVec(), ctx.player().rotationYaw, Double.parseDouble(msg.substring(7).trim())); customGoalProcess.setGoal(goal); From eb9f755b54e2d267302404fcaa2bc46c1b640b64 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 21 Feb 2019 10:03:03 -0800 Subject: [PATCH 3/4] disable rendercachedchunks in singleplayer, fixes #331 --- .../baritone/launch/mixins/MixinChunkRenderContainer.java | 2 +- .../java/baritone/launch/mixins/MixinChunkRenderWorker.java | 3 ++- src/launch/java/baritone/launch/mixins/MixinRenderChunk.java | 5 +++-- src/launch/java/baritone/launch/mixins/MixinRenderList.java | 3 ++- .../java/baritone/launch/mixins/MixinVboRenderList.java | 3 ++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/launch/java/baritone/launch/mixins/MixinChunkRenderContainer.java b/src/launch/java/baritone/launch/mixins/MixinChunkRenderContainer.java index 511e1c14..0fc81487 100644 --- a/src/launch/java/baritone/launch/mixins/MixinChunkRenderContainer.java +++ b/src/launch/java/baritone/launch/mixins/MixinChunkRenderContainer.java @@ -41,7 +41,7 @@ public class MixinChunkRenderContainer { ) ) private BlockPos getPosition(RenderChunk renderChunkIn) { - if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().world.getChunk(renderChunkIn.getPosition()).isEmpty()) { + if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null && Minecraft.getMinecraft().world.getChunk(renderChunkIn.getPosition()).isEmpty()) { GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GL14.glBlendColor(0, 0, 0, Baritone.settings().cachedChunksOpacity.get()); diff --git a/src/launch/java/baritone/launch/mixins/MixinChunkRenderWorker.java b/src/launch/java/baritone/launch/mixins/MixinChunkRenderWorker.java index a8247a9b..2bd1521c 100644 --- a/src/launch/java/baritone/launch/mixins/MixinChunkRenderWorker.java +++ b/src/launch/java/baritone/launch/mixins/MixinChunkRenderWorker.java @@ -20,6 +20,7 @@ package baritone.launch.mixins; import baritone.Baritone; import baritone.api.BaritoneAPI; import baritone.api.utils.IPlayerContext; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.chunk.ChunkRenderWorker; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -42,7 +43,7 @@ public abstract class MixinChunkRenderWorker { ) ) private boolean isChunkExisting(ChunkRenderWorker worker, BlockPos pos, World world) { - if (Baritone.settings().renderCachedChunks.get()) { + if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) { Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone(); IPlayerContext ctx = baritone.getPlayerContext(); if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) { diff --git a/src/launch/java/baritone/launch/mixins/MixinRenderChunk.java b/src/launch/java/baritone/launch/mixins/MixinRenderChunk.java index 4190ae59..754f523f 100644 --- a/src/launch/java/baritone/launch/mixins/MixinRenderChunk.java +++ b/src/launch/java/baritone/launch/mixins/MixinRenderChunk.java @@ -21,6 +21,7 @@ import baritone.Baritone; import baritone.api.BaritoneAPI; import baritone.api.utils.IPlayerContext; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.chunk.RenderChunk; import net.minecraft.util.math.BlockPos; import net.minecraft.world.ChunkCache; @@ -46,7 +47,7 @@ public class MixinRenderChunk { if (!chunkCache.isEmpty()) { return false; } - if (Baritone.settings().renderCachedChunks.get()) { + if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) { Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone(); IPlayerContext ctx = baritone.getPlayerContext(); if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) { @@ -75,7 +76,7 @@ public class MixinRenderChunk { ) ) private IBlockState getBlockState(ChunkCache chunkCache, BlockPos pos) { - if (Baritone.settings().renderCachedChunks.get()) { + if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) { Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone(); IPlayerContext ctx = baritone.getPlayerContext(); if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) { diff --git a/src/launch/java/baritone/launch/mixins/MixinRenderList.java b/src/launch/java/baritone/launch/mixins/MixinRenderList.java index 3d4d8a91..e2f0ae90 100644 --- a/src/launch/java/baritone/launch/mixins/MixinRenderList.java +++ b/src/launch/java/baritone/launch/mixins/MixinRenderList.java @@ -18,6 +18,7 @@ package baritone.launch.mixins; import baritone.Baritone; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderList; import org.spongepowered.asm.mixin.Mixin; @@ -37,7 +38,7 @@ public class MixinRenderList { ) ) private void popMatrix() { - if (Baritone.settings().renderCachedChunks.get()) { + if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) { // reset the blend func to normal (not dependent on constant alpha) GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); } diff --git a/src/launch/java/baritone/launch/mixins/MixinVboRenderList.java b/src/launch/java/baritone/launch/mixins/MixinVboRenderList.java index 70048c8c..f51d2234 100644 --- a/src/launch/java/baritone/launch/mixins/MixinVboRenderList.java +++ b/src/launch/java/baritone/launch/mixins/MixinVboRenderList.java @@ -18,6 +18,7 @@ package baritone.launch.mixins; import baritone.Baritone; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.VboRenderList; import org.spongepowered.asm.mixin.Mixin; @@ -37,7 +38,7 @@ public class MixinVboRenderList { ) ) private void popMatrix() { - if (Baritone.settings().renderCachedChunks.get()) { + if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) { // reset the blend func to normal (not dependent on constant alpha) GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); } From 16dcd2f44d70368783aa2eac793517d8194d45f5 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 21 Feb 2019 11:25:03 -0800 Subject: [PATCH 4/4] blocks on top of chests, fixes #299 --- .../java/baritone/process/GetToBlockProcess.java | 16 +++++++++++++++- .../baritone/utils/InputOverrideHandler.java | 15 +++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/process/GetToBlockProcess.java b/src/main/java/baritone/process/GetToBlockProcess.java index 7796c029..0eb9f339 100644 --- a/src/main/java/baritone/process/GetToBlockProcess.java +++ b/src/main/java/baritone/process/GetToBlockProcess.java @@ -168,7 +168,13 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl } private Goal createGoal(BlockPos pos) { - return walkIntoInsteadOfAdjacent(gettingTo) ? new GoalTwoBlocks(pos) : new GoalGetToBlock(pos); + if (walkIntoInsteadOfAdjacent(gettingTo)) { + return new GoalTwoBlocks(pos); + } + if (blockOnTopMustBeRemoved(gettingTo) && baritone.bsi.get0(pos.up()).isBlockNormalCube()) { + return new GoalBlock(pos.up()); + } + return new GoalGetToBlock(pos); } private boolean rightClick() { @@ -203,4 +209,12 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl } return block == Blocks.CRAFTING_TABLE || block == Blocks.FURNACE || block == Blocks.ENDER_CHEST || block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST; } + + private boolean blockOnTopMustBeRemoved(Block block) { + if (!rightClickOnArrival(block)) { // only if we plan to actually open it on arrival + return false; + } + // only these chests; you can open a crafting table or furnace even with a block on top + return block == Blocks.ENDER_CHEST || block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST; + } } diff --git a/src/main/java/baritone/utils/InputOverrideHandler.java b/src/main/java/baritone/utils/InputOverrideHandler.java index f32bdaa4..f5ee0530 100755 --- a/src/main/java/baritone/utils/InputOverrideHandler.java +++ b/src/main/java/baritone/utils/InputOverrideHandler.java @@ -61,16 +61,23 @@ public final class InputOverrideHandler extends Behavior implements IInputOverri @Override public final Boolean isInputForcedDown(KeyBinding key) { Input input = Input.getInputForBind(key); - if (input == null || !inControl()) { + if (input == null) { return null; } - if (input == Input.CLICK_LEFT) { + if (input == Input.CLICK_LEFT && inControl()) { + // only override left click off when pathing return false; } if (input == Input.CLICK_RIGHT) { - return isInputForcedDown(Input.CLICK_RIGHT); + if (isInputForcedDown(Input.CLICK_RIGHT)) { + // gettoblock and builder can right click even when not pathing; allow them to do so + return true; + } else if (inControl()) { + // but when we are pathing for real, force right click off + return false; + } } - return null; + return null; // dont force any inputs other than left and right click } /**