forked from RepoMirrors/baritone
Merge branch 'master' into builder
This commit is contained in:
commit
e18dc7c7e7
|
@ -41,7 +41,7 @@ public class MixinChunkRenderContainer {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
private BlockPos getPosition(RenderChunk renderChunkIn) {
|
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.enableAlpha();
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GL14.glBlendColor(0, 0, 0, Baritone.settings().cachedChunksOpacity.get());
|
GL14.glBlendColor(0, 0, 0, Baritone.settings().cachedChunksOpacity.get());
|
||||||
|
|
|
@ -20,6 +20,7 @@ package baritone.launch.mixins;
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
import baritone.api.BaritoneAPI;
|
import baritone.api.BaritoneAPI;
|
||||||
import baritone.api.utils.IPlayerContext;
|
import baritone.api.utils.IPlayerContext;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.chunk.ChunkRenderWorker;
|
import net.minecraft.client.renderer.chunk.ChunkRenderWorker;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -42,7 +43,7 @@ public abstract class MixinChunkRenderWorker {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
private boolean isChunkExisting(ChunkRenderWorker worker, BlockPos pos, World world) {
|
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();
|
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||||
IPlayerContext ctx = baritone.getPlayerContext();
|
IPlayerContext ctx = baritone.getPlayerContext();
|
||||||
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ import baritone.Baritone;
|
||||||
import baritone.api.BaritoneAPI;
|
import baritone.api.BaritoneAPI;
|
||||||
import baritone.api.utils.IPlayerContext;
|
import baritone.api.utils.IPlayerContext;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.chunk.RenderChunk;
|
import net.minecraft.client.renderer.chunk.RenderChunk;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.ChunkCache;
|
import net.minecraft.world.ChunkCache;
|
||||||
|
@ -46,7 +47,7 @@ public class MixinRenderChunk {
|
||||||
if (!chunkCache.isEmpty()) {
|
if (!chunkCache.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Baritone.settings().renderCachedChunks.get()) {
|
if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||||
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||||
IPlayerContext ctx = baritone.getPlayerContext();
|
IPlayerContext ctx = baritone.getPlayerContext();
|
||||||
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
||||||
|
@ -75,7 +76,7 @@ public class MixinRenderChunk {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
private IBlockState getBlockState(ChunkCache chunkCache, BlockPos pos) {
|
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();
|
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||||
IPlayerContext ctx = baritone.getPlayerContext();
|
IPlayerContext ctx = baritone.getPlayerContext();
|
||||||
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package baritone.launch.mixins;
|
package baritone.launch.mixins;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.RenderList;
|
import net.minecraft.client.renderer.RenderList;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
@ -37,7 +38,7 @@ public class MixinRenderList {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
private void popMatrix() {
|
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)
|
// 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);
|
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package baritone.launch.mixins;
|
package baritone.launch.mixins;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.VboRenderList;
|
import net.minecraft.client.renderer.VboRenderList;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
@ -37,7 +38,7 @@ public class MixinVboRenderList {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
private void popMatrix() {
|
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)
|
// 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);
|
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
// 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
|
// 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;
|
this.target = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,7 +168,13 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
|
||||||
}
|
}
|
||||||
|
|
||||||
private Goal createGoal(BlockPos pos) {
|
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() {
|
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;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -432,7 +432,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
|
||||||
logDirect("Started mining blocks of type " + Arrays.toString(blockTypes));
|
logDirect("Started mining blocks of type " + Arrays.toString(blockTypes));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (msg.startsWith("thisway")) {
|
if (msg.startsWith("thisway") || msg.startsWith("forward")) {
|
||||||
try {
|
try {
|
||||||
Goal goal = GoalXZ.fromDirection(ctx.playerFeetAsVec(), ctx.player().rotationYaw, Double.parseDouble(msg.substring(7).trim()));
|
Goal goal = GoalXZ.fromDirection(ctx.playerFeetAsVec(), ctx.player().rotationYaw, Double.parseDouble(msg.substring(7).trim()));
|
||||||
customGoalProcess.setGoal(goal);
|
customGoalProcess.setGoal(goal);
|
||||||
|
|
|
@ -61,16 +61,23 @@ public final class InputOverrideHandler extends Behavior implements IInputOverri
|
||||||
@Override
|
@Override
|
||||||
public final Boolean isInputForcedDown(KeyBinding key) {
|
public final Boolean isInputForcedDown(KeyBinding key) {
|
||||||
Input input = Input.getInputForBind(key);
|
Input input = Input.getInputForBind(key);
|
||||||
if (input == null || !inControl()) {
|
if (input == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (input == Input.CLICK_LEFT) {
|
if (input == Input.CLICK_LEFT && inControl()) {
|
||||||
|
// only override left click off when pathing
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (input == Input.CLICK_RIGHT) {
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue