Merge branch 'comms' into bot-system
This commit is contained in:
@@ -121,3 +121,4 @@ task proguard(type: ProguardTask) {
|
||||
task createDist(type: CreateDistTask, dependsOn: proguard)
|
||||
|
||||
build.finalizedBy(createDist)
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ package baritone.api.utils;
|
||||
|
||||
import baritone.api.pathing.calc.IPath;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
public class PathCalculationResult {
|
||||
@@ -31,11 +32,9 @@ public class PathCalculationResult {
|
||||
}
|
||||
|
||||
public PathCalculationResult(Type type, IPath path) {
|
||||
Objects.requireNonNull(type);
|
||||
this.path = path;
|
||||
this.type = type;
|
||||
if (type == null) {
|
||||
throw new IllegalArgumentException("come on");
|
||||
}
|
||||
}
|
||||
|
||||
public final Optional<IPath> getPath() {
|
||||
|
||||
@@ -17,10 +17,16 @@
|
||||
|
||||
package cabaletta.comms;
|
||||
|
||||
import cabaletta.comms.downward.MessageChat;
|
||||
import cabaletta.comms.downward.MessageClickSlot;
|
||||
import cabaletta.comms.downward.MessageComputationRequest;
|
||||
import cabaletta.comms.upward.MessageComputationResponse;
|
||||
import cabaletta.comms.upward.MessageEchestConfirmed;
|
||||
import cabaletta.comms.upward.MessageStatus;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,12 +36,12 @@ public enum ConstructingDeserializer implements MessageDeserializer {
|
||||
|
||||
ConstructingDeserializer() {
|
||||
MSGS = new ArrayList<>();
|
||||
// imagine doing something in reflect but it's actually concise and you don't need to catch 42069 different exceptions. huh.
|
||||
for (Method m : IMessageListener.class.getDeclaredMethods()) {
|
||||
if (m.getName().equals("handle")) {
|
||||
MSGS.add((Class<? extends iMessage>) m.getParameterTypes()[0]);
|
||||
}
|
||||
}
|
||||
MSGS.add(MessageStatus.class);
|
||||
MSGS.add(MessageChat.class);
|
||||
MSGS.add(MessageComputationRequest.class);
|
||||
MSGS.add(MessageComputationResponse.class);
|
||||
MSGS.add(MessageEchestConfirmed.class);
|
||||
MSGS.add(MessageClickSlot.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,8 +18,10 @@
|
||||
package cabaletta.comms;
|
||||
|
||||
import cabaletta.comms.downward.MessageChat;
|
||||
import cabaletta.comms.downward.MessageClickSlot;
|
||||
import cabaletta.comms.downward.MessageComputationRequest;
|
||||
import cabaletta.comms.upward.MessageComputationResponse;
|
||||
import cabaletta.comms.upward.MessageEchestConfirmed;
|
||||
import cabaletta.comms.upward.MessageStatus;
|
||||
|
||||
public interface IMessageListener {
|
||||
@@ -39,6 +41,14 @@ public interface IMessageListener {
|
||||
unhandled(message);
|
||||
}
|
||||
|
||||
default void handle(MessageEchestConfirmed message) {
|
||||
unhandled(message);
|
||||
}
|
||||
|
||||
default void handle(MessageClickSlot message) {
|
||||
unhandled(message);
|
||||
}
|
||||
|
||||
default void unhandled(iMessage msg) {
|
||||
// can override this to throw UnsupportedOperationException, if you want to make sure you're handling everything
|
||||
// default is to silently ignore messages without handlers
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is part of Baritone.
|
||||
*
|
||||
* Baritone is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Baritone is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package cabaletta.comms.downward;
|
||||
|
||||
import cabaletta.comms.IMessageListener;
|
||||
import cabaletta.comms.iMessage;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class MessageClickSlot implements iMessage {
|
||||
public final int windowId;
|
||||
public final int slotId;
|
||||
public final int mouseButton;
|
||||
public final int clickType; // index into ClickType.values()
|
||||
|
||||
public MessageClickSlot(DataInputStream in) throws IOException {
|
||||
this.windowId = in.readInt();
|
||||
this.slotId = in.readInt();
|
||||
this.mouseButton = in.readInt();
|
||||
this.clickType = in.readInt();
|
||||
}
|
||||
|
||||
public MessageClickSlot(int windowId, int slotId, int mouseButton, int clickType) {
|
||||
this.windowId = windowId;
|
||||
this.slotId = slotId;
|
||||
this.mouseButton = mouseButton;
|
||||
this.clickType = clickType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream out) throws IOException {
|
||||
out.writeInt(windowId);
|
||||
out.writeInt(slotId);
|
||||
out.writeInt(mouseButton);
|
||||
out.writeInt(clickType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(IMessageListener listener) {
|
||||
listener.handle(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This file is part of Baritone.
|
||||
*
|
||||
* Baritone is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Baritone is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package cabaletta.comms.upward;
|
||||
|
||||
import cabaletta.comms.IMessageListener;
|
||||
import cabaletta.comms.iMessage;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class MessageEchestConfirmed implements iMessage {
|
||||
public final int slot;
|
||||
public final String item;
|
||||
|
||||
public MessageEchestConfirmed(DataInputStream in) throws IOException {
|
||||
this.slot = in.readInt();
|
||||
this.item = in.readUTF();
|
||||
}
|
||||
|
||||
public MessageEchestConfirmed(int slot, String item) {
|
||||
this.slot = slot;
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream out) throws IOException {
|
||||
out.writeInt(slot);
|
||||
out.writeUTF(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(IMessageListener listener) {
|
||||
listener.handle(this);
|
||||
}
|
||||
}
|
||||
@@ -23,9 +23,13 @@ import cabaletta.comms.iMessage;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MessageStatus implements iMessage {
|
||||
|
||||
public final String playerUUID;
|
||||
public final String serverIP;
|
||||
public final double x;
|
||||
public final double y;
|
||||
public final double z;
|
||||
@@ -35,6 +39,7 @@ public class MessageStatus implements iMessage {
|
||||
public final float health;
|
||||
public final float saturation;
|
||||
public final int foodLevel;
|
||||
public final int dimension;
|
||||
public final int pathStartX;
|
||||
public final int pathStartY;
|
||||
public final int pathStartZ;
|
||||
@@ -46,8 +51,15 @@ public class MessageStatus implements iMessage {
|
||||
public final boolean safeToCancel;
|
||||
public final String currentGoal;
|
||||
public final String currentProcess;
|
||||
public final List<String> mainInventory;
|
||||
public final List<String> armor;
|
||||
public final String offHand;
|
||||
public final int windowId;
|
||||
public final boolean eChestOpen;
|
||||
|
||||
public MessageStatus(DataInputStream in) throws IOException {
|
||||
this.playerUUID = in.readUTF();
|
||||
this.serverIP = in.readUTF();
|
||||
this.x = in.readDouble();
|
||||
this.y = in.readDouble();
|
||||
this.z = in.readDouble();
|
||||
@@ -57,6 +69,7 @@ public class MessageStatus implements iMessage {
|
||||
this.health = in.readFloat();
|
||||
this.saturation = in.readFloat();
|
||||
this.foodLevel = in.readInt();
|
||||
this.dimension = in.readInt();
|
||||
this.pathStartX = in.readInt();
|
||||
this.pathStartY = in.readInt();
|
||||
this.pathStartZ = in.readInt();
|
||||
@@ -68,9 +81,16 @@ public class MessageStatus implements iMessage {
|
||||
this.safeToCancel = in.readBoolean();
|
||||
this.currentGoal = in.readUTF();
|
||||
this.currentProcess = in.readUTF();
|
||||
this.mainInventory = readList(36, in);
|
||||
this.armor = readList(4, in);
|
||||
this.offHand = in.readUTF();
|
||||
this.windowId = in.readInt();
|
||||
this.eChestOpen = in.readBoolean();
|
||||
}
|
||||
|
||||
public MessageStatus(double x, double y, double z, float yaw, float pitch, boolean onGround, float health, float saturation, int foodLevel, int pathStartX, int pathStartY, int pathStartZ, boolean hasCurrentSegment, boolean hasNextSegment, boolean calcInProgress, double ticksRemainingInCurrent, boolean calcFailedLastTick, boolean safeToCancel, String currentGoal, String currentProcess) {
|
||||
public MessageStatus(String playerUUID, String serverIP, double x, double y, double z, float yaw, float pitch, boolean onGround, float health, float saturation, int foodLevel, int dimension, int pathStartX, int pathStartY, int pathStartZ, boolean hasCurrentSegment, boolean hasNextSegment, boolean calcInProgress, double ticksRemainingInCurrent, boolean calcFailedLastTick, boolean safeToCancel, String currentGoal, String currentProcess, List<String> mainInventory, List<String> armor, String offHand, int windowId, boolean eChestOpen) {
|
||||
this.playerUUID = playerUUID;
|
||||
this.serverIP = serverIP;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
@@ -80,6 +100,7 @@ public class MessageStatus implements iMessage {
|
||||
this.health = health;
|
||||
this.saturation = saturation;
|
||||
this.foodLevel = foodLevel;
|
||||
this.dimension = dimension;
|
||||
this.pathStartX = pathStartX;
|
||||
this.pathStartY = pathStartY;
|
||||
this.pathStartZ = pathStartZ;
|
||||
@@ -91,10 +112,20 @@ public class MessageStatus implements iMessage {
|
||||
this.safeToCancel = safeToCancel;
|
||||
this.currentGoal = currentGoal;
|
||||
this.currentProcess = currentProcess;
|
||||
this.mainInventory = mainInventory;
|
||||
this.armor = armor;
|
||||
this.offHand = offHand;
|
||||
this.windowId = windowId;
|
||||
this.eChestOpen = eChestOpen;
|
||||
if (mainInventory.size() != 36 || armor.size() != 4) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream out) throws IOException {
|
||||
out.writeUTF(playerUUID);
|
||||
out.writeUTF(serverIP);
|
||||
out.writeDouble(x);
|
||||
out.writeDouble(y);
|
||||
out.writeDouble(z);
|
||||
@@ -104,6 +135,7 @@ public class MessageStatus implements iMessage {
|
||||
out.writeFloat(health);
|
||||
out.writeFloat(saturation);
|
||||
out.writeInt(foodLevel);
|
||||
out.writeInt(dimension);
|
||||
out.writeInt(pathStartX);
|
||||
out.writeInt(pathStartY);
|
||||
out.writeInt(pathStartZ);
|
||||
@@ -115,6 +147,25 @@ public class MessageStatus implements iMessage {
|
||||
out.writeBoolean(safeToCancel);
|
||||
out.writeUTF(currentGoal);
|
||||
out.writeUTF(currentProcess);
|
||||
write(mainInventory, out);
|
||||
write(armor, out);
|
||||
out.writeUTF(offHand);
|
||||
out.writeInt(windowId);
|
||||
out.writeBoolean(eChestOpen);
|
||||
}
|
||||
|
||||
private static List<String> readList(int length, DataInputStream in) throws IOException {
|
||||
ArrayList<String> result = new ArrayList<>();
|
||||
for (int i = 0; i < length; i++) {
|
||||
result.add(in.readUTF());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void write(List<String> list, DataOutputStream out) throws IOException {
|
||||
for (String str : list) {
|
||||
out.writeUTF(str);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -211,4 +211,4 @@ public class Baritone implements IBaritone {
|
||||
public static File getDir() {
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,14 +31,22 @@ import cabaletta.comms.BufferedConnection;
|
||||
import cabaletta.comms.IConnection;
|
||||
import cabaletta.comms.IMessageListener;
|
||||
import cabaletta.comms.downward.MessageChat;
|
||||
import cabaletta.comms.downward.MessageClickSlot;
|
||||
import cabaletta.comms.downward.MessageComputationRequest;
|
||||
import cabaletta.comms.iMessage;
|
||||
import cabaletta.comms.upward.MessageComputationResponse;
|
||||
import cabaletta.comms.upward.MessageStatus;
|
||||
import net.minecraft.inventory.ClickType;
|
||||
import net.minecraft.inventory.ItemStackHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ControllerBehavior extends Behavior implements IMessageListener {
|
||||
|
||||
@@ -60,8 +68,11 @@ public class ControllerBehavior extends Behavior implements IMessageListener {
|
||||
public MessageStatus buildStatus() {
|
||||
// TODO report inventory and echest contents
|
||||
// TODO figure out who should remember echest contents when it isn't open, baritone or tenor?
|
||||
|
||||
BlockPos pathStart = baritone.getPathingBehavior().pathStart();
|
||||
return new MessageStatus(
|
||||
ctx.player().getUniqueID().toString(),
|
||||
ctx.player().connection.getNetworkManager().getRemoteAddress().toString(),
|
||||
ctx.player().posX,
|
||||
ctx.player().posY,
|
||||
ctx.player().posZ,
|
||||
@@ -71,6 +82,7 @@ public class ControllerBehavior extends Behavior implements IMessageListener {
|
||||
ctx.player().getHealth(),
|
||||
ctx.player().getFoodStats().getSaturationLevel(),
|
||||
ctx.player().getFoodStats().getFoodLevel(),
|
||||
ctx.world().provider.getDimensionType().getId(),
|
||||
pathStart.getX(),
|
||||
pathStart.getY(),
|
||||
pathStart.getZ(),
|
||||
@@ -81,7 +93,12 @@ public class ControllerBehavior extends Behavior implements IMessageListener {
|
||||
baritone.getPathingBehavior().calcFailedLastTick(),
|
||||
baritone.getPathingBehavior().isSafeToCancel(),
|
||||
baritone.getPathingBehavior().getGoal() + "",
|
||||
baritone.getPathingControlManager().mostRecentInControl().map(IBaritoneProcess::displayName).orElse("")
|
||||
baritone.getPathingControlManager().mostRecentInControl().map(IBaritoneProcess::displayName).orElse(""),
|
||||
describeAll(ctx.player().inventory.mainInventory),
|
||||
describeAll(ctx.player().inventory.armorInventory),
|
||||
describe(ctx.player().inventory.offHandInventory.get(0)),
|
||||
ctx.player().openContainer.windowId,
|
||||
baritone.getMemoryBehavior().eChestOpen()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -123,6 +140,43 @@ public class ControllerBehavior extends Behavior implements IMessageListener {
|
||||
conn = null;
|
||||
}
|
||||
|
||||
public static List<String> describeAll(List<ItemStack> list) {
|
||||
return list.stream().map(ControllerBehavior::describe).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static String describe(ItemStack stack) {
|
||||
return describe(stack, true);
|
||||
}
|
||||
|
||||
public static String describe(ItemStack stack, boolean name) {
|
||||
if (stack.isEmpty()) {
|
||||
return "empty";
|
||||
}
|
||||
String description = "";
|
||||
if (name) {
|
||||
if (!stack.getDisplayName().contains("$")) { // who knows what's in there
|
||||
description += stack.getDisplayName();
|
||||
}
|
||||
description += "$";
|
||||
}
|
||||
description += stack.getTranslationKey() + ";" + stack.getItemDamage() + ";" + stack.getCount() + ";";
|
||||
NBTTagCompound data = stack.getTagCompound();
|
||||
if (data != null && data.hasKey("BlockEntityTag", 10)) {
|
||||
NBTTagCompound blockdata = data.getCompoundTag("BlockEntityTag");
|
||||
if (blockdata.hasKey("Items", 9)) {
|
||||
NonNullList<ItemStack> nonnulllist = NonNullList.withSize(27, ItemStack.EMPTY);
|
||||
ItemStackHelper.loadAllItems(blockdata, nonnulllist);
|
||||
|
||||
description += ";";
|
||||
for (ItemStack itemstack : nonnulllist) {
|
||||
description += describe(itemstack, false) + ",";
|
||||
}
|
||||
description = description.substring(0, description.length() - 1);
|
||||
}
|
||||
}
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(MessageChat msg) { // big brain
|
||||
ChatEvent event = new ChatEvent(ctx.player(), msg.msg);
|
||||
@@ -156,6 +210,14 @@ public class ControllerBehavior extends Behavior implements IMessageListener {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(MessageClickSlot msg) {
|
||||
if (ctx.player().openContainer.windowId != msg.windowId) {
|
||||
return; // stale
|
||||
}
|
||||
ctx.playerController().windowClick(msg.windowId, msg.slotId, msg.mouseButton, ClickType.values()[msg.clickType], ctx.player());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unhandled(iMessage msg) {
|
||||
Helper.HELPER.logDebug("Unhandled message received by ControllerBehavior " + msg);
|
||||
|
||||
@@ -21,20 +21,24 @@ import baritone.Baritone;
|
||||
import baritone.api.event.events.BlockInteractEvent;
|
||||
import baritone.api.event.events.PacketEvent;
|
||||
import baritone.api.event.events.PlayerUpdateEvent;
|
||||
import baritone.api.event.events.TickEvent;
|
||||
import baritone.api.event.events.type.EventState;
|
||||
import baritone.cache.ContainerMemory;
|
||||
import baritone.cache.Waypoint;
|
||||
import baritone.pathing.movement.CalculationContext;
|
||||
import baritone.utils.BlockStateInterface;
|
||||
import cabaletta.comms.upward.MessageEchestConfirmed;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockBed;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.client.CPacketClickWindow;
|
||||
import net.minecraft.network.play.client.CPacketCloseWindow;
|
||||
import net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock;
|
||||
import net.minecraft.network.play.server.SPacketCloseWindow;
|
||||
import net.minecraft.network.play.server.SPacketOpenWindow;
|
||||
import net.minecraft.network.play.server.SPacketSetSlot;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityLockable;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -60,6 +64,14 @@ public final class MemoryBehavior extends Behavior {
|
||||
super(baritone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void onTick(TickEvent event) {
|
||||
if (event.getType() == TickEvent.Type.OUT) {
|
||||
enderChestWindowId = null;
|
||||
futureInventories.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void onPlayerUpdate(PlayerUpdateEvent event) {
|
||||
if (event.getState() == EventState.PRE) {
|
||||
@@ -101,6 +113,11 @@ public final class MemoryBehavior extends Behavior {
|
||||
updateInventory();
|
||||
getCurrent().save();
|
||||
}
|
||||
|
||||
if (p instanceof CPacketClickWindow) {
|
||||
CPacketClickWindow c = event.cast();
|
||||
System.out.println("CLICK " + c.getWindowId() + " " + c.getSlotId() + " " + c.getUsedButton() + " " + c.getClickType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,9 +153,28 @@ public final class MemoryBehavior extends Behavior {
|
||||
updateInventory();
|
||||
getCurrent().save();
|
||||
}
|
||||
|
||||
// apparently doesn't happen
|
||||
/*if (p instanceof SPacketWindowItems) {
|
||||
SPacketWindowItems meme = (SPacketWindowItems) p;
|
||||
if (meme.getWindowId() == ctx.player().openContainer.windowId && enderChestWindowId != null && meme.getWindowId() == enderChestWindowId) {
|
||||
System.out.println("RECEIVED GUARANTEED ECHEST CONTENTS" + meme.getItemStacks());
|
||||
}
|
||||
}*/
|
||||
|
||||
if (p instanceof SPacketSetSlot) {
|
||||
SPacketSetSlot slot = (SPacketSetSlot) p;
|
||||
if (slot.getSlot() < 27 && enderChestWindowId != null && slot.getWindowId() == enderChestWindowId) {
|
||||
baritone.getControllerBehavior().trySend(new MessageEchestConfirmed(slot.getSlot(), ControllerBehavior.describe(slot.getStack())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean eChestOpen() {
|
||||
return enderChestWindowId != null && ctx.player().openContainer.windowId == enderChestWindowId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockInteract(BlockInteractEvent event) {
|
||||
if (event.getType() == BlockInteractEvent.Type.USE && BlockStateInterface.getBlock(ctx, event.getPos()) instanceof BlockBed) {
|
||||
|
||||
@@ -254,7 +254,6 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
||||
.distinct()
|
||||
|
||||
// remove any that are within loaded chunks that aren't actually what we want
|
||||
|
||||
.filter(pos -> !ctx.bsi.worldContainsLoadedChunk(pos.getX(), pos.getZ()) || mining.contains(ctx.getBlock(pos.getX(), pos.getY(), pos.getZ())) || dropped.contains(pos))
|
||||
|
||||
// remove any that are implausible to mine (encased in bedrock, or touching lava)
|
||||
|
||||
@@ -32,6 +32,15 @@ import net.minecraft.world.GameType;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
import net.minecraft.world.WorldType;
|
||||
|
||||
/**
|
||||
* Responsible for automatically testing Baritone's pathing algorithm by automatically creating a world with a specific
|
||||
* seed, setting a specified goal, and only allowing a certain amount of ticks to pass before the pathing test is
|
||||
* considered a failure. In order to test locally, docker may be used, or through an IDE: Create a run config which runs
|
||||
* in a separate directory from the primary one (./run), and set the enrivonmental variable {@code BARITONE_AUTO_TEST}
|
||||
* to {@code true}.
|
||||
*
|
||||
* @author leijurv, Brady
|
||||
*/
|
||||
public class BaritoneAutoTest implements AbstractGameEventListener, Helper {
|
||||
|
||||
public static final BaritoneAutoTest INSTANCE = new BaritoneAutoTest();
|
||||
|
||||
@@ -154,11 +154,10 @@ public class ToolSet {
|
||||
|
||||
speed /= hardness;
|
||||
if (state.getMaterial().isToolNotRequired() || (!item.isEmpty() && item.canHarvestBlock(state))) {
|
||||
speed /= 30;
|
||||
return speed / 30;
|
||||
} else {
|
||||
speed /= 100;
|
||||
return speed / 100;
|
||||
}
|
||||
return speed;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user