add defaults to switches
This commit is contained in:
parent
f25f264fd3
commit
3011b85aee
@ -19,9 +19,9 @@ package baritone.behavior;
|
|||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
import baritone.Settings;
|
import baritone.Settings;
|
||||||
|
import baritone.api.behavior.Behavior;
|
||||||
import baritone.api.event.events.PlayerUpdateEvent;
|
import baritone.api.event.events.PlayerUpdateEvent;
|
||||||
import baritone.api.event.events.RotationMoveEvent;
|
import baritone.api.event.events.RotationMoveEvent;
|
||||||
import baritone.api.behavior.Behavior;
|
|
||||||
import baritone.utils.Helper;
|
import baritone.utils.Helper;
|
||||||
import baritone.utils.Rotation;
|
import baritone.utils.Rotation;
|
||||||
|
|
||||||
@ -89,6 +89,8 @@ public final class LookBehavior extends Behavior implements Helper {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
|
|
||||||
package baritone.behavior;
|
package baritone.behavior;
|
||||||
|
|
||||||
|
import baritone.api.behavior.Behavior;
|
||||||
import baritone.api.event.events.PacketEvent;
|
import baritone.api.event.events.PacketEvent;
|
||||||
import baritone.api.event.events.PlayerUpdateEvent;
|
import baritone.api.event.events.PlayerUpdateEvent;
|
||||||
import baritone.api.event.events.type.EventState;
|
import baritone.api.event.events.type.EventState;
|
||||||
import baritone.api.behavior.Behavior;
|
|
||||||
import baritone.utils.Helper;
|
import baritone.utils.Helper;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
@ -94,31 +94,28 @@ public final class MemoryBehavior extends Behavior implements Helper {
|
|||||||
public void onReceivePacket(PacketEvent event) {
|
public void onReceivePacket(PacketEvent event) {
|
||||||
Packet p = event.getPacket();
|
Packet p = event.getPacket();
|
||||||
|
|
||||||
switch (event.getState()) {
|
if (event.getState() == EventState.PRE) {
|
||||||
case PRE: {
|
if (p instanceof SPacketOpenWindow) {
|
||||||
if (p instanceof SPacketOpenWindow) {
|
SPacketOpenWindow packet = event.cast();
|
||||||
SPacketOpenWindow packet = event.cast();
|
|
||||||
|
|
||||||
// Remove any entries that were created over a second ago, this should make up for INSANE latency
|
// Remove any entries that were created over a second ago, this should make up for INSANE latency
|
||||||
this.futureInventories.removeIf(i -> System.nanoTime() / 1000000L - i.time > 1000);
|
this.futureInventories.removeIf(i -> System.nanoTime() / 1000000L - i.time > 1000);
|
||||||
|
|
||||||
this.futureInventories.stream()
|
this.futureInventories.stream()
|
||||||
.filter(i -> i.type.equals(packet.getGuiId()) && i.slots == packet.getSlotCount())
|
.filter(i -> i.type.equals(packet.getGuiId()) && i.slots == packet.getSlotCount())
|
||||||
.findFirst().ifPresent(matched -> {
|
.findFirst().ifPresent(matched -> {
|
||||||
// Remove the future inventory
|
// Remove the future inventory
|
||||||
this.futureInventories.remove(matched);
|
this.futureInventories.remove(matched);
|
||||||
|
|
||||||
// Setup the remembered inventory
|
// Setup the remembered inventory
|
||||||
RememberedInventory inventory = this.rememberedInventories.computeIfAbsent(matched.pos, pos -> new RememberedInventory());
|
RememberedInventory inventory = this.rememberedInventories.computeIfAbsent(matched.pos, pos -> new RememberedInventory());
|
||||||
inventory.windowId = packet.getWindowId();
|
inventory.windowId = packet.getWindowId();
|
||||||
inventory.size = packet.getSlotCount();
|
inventory.size = packet.getSlotCount();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p instanceof SPacketCloseWindow) {
|
if (p instanceof SPacketCloseWindow) {
|
||||||
updateInventory();
|
updateInventory();
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,8 @@ import baritone.api.event.events.TickEvent;
|
|||||||
import baritone.pathing.calc.AStarPathFinder;
|
import baritone.pathing.calc.AStarPathFinder;
|
||||||
import baritone.pathing.calc.AbstractNodeCostSearch;
|
import baritone.pathing.calc.AbstractNodeCostSearch;
|
||||||
import baritone.pathing.calc.IPathFinder;
|
import baritone.pathing.calc.IPathFinder;
|
||||||
import baritone.pathing.goals.*;
|
import baritone.pathing.goals.Goal;
|
||||||
|
import baritone.pathing.goals.GoalXZ;
|
||||||
import baritone.pathing.movement.MovementHelper;
|
import baritone.pathing.movement.MovementHelper;
|
||||||
import baritone.pathing.path.IPath;
|
import baritone.pathing.path.IPath;
|
||||||
import baritone.pathing.path.PathExecutor;
|
import baritone.pathing.path.PathExecutor;
|
||||||
@ -163,6 +164,8 @@ public final class PathingBehavior extends Behavior implements Helper {
|
|||||||
case POST:
|
case POST:
|
||||||
mc.gameSettings.autoJump = lastAutoJump;
|
mc.gameSettings.autoJump = lastAutoJump;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,11 +21,11 @@ import baritone.Baritone;
|
|||||||
import baritone.api.event.events.*;
|
import baritone.api.event.events.*;
|
||||||
import baritone.api.event.events.type.EventState;
|
import baritone.api.event.events.type.EventState;
|
||||||
import baritone.api.event.listener.IGameEventListener;
|
import baritone.api.event.listener.IGameEventListener;
|
||||||
|
import baritone.api.utils.interfaces.Toggleable;
|
||||||
import baritone.cache.WorldProvider;
|
import baritone.cache.WorldProvider;
|
||||||
import baritone.utils.BlockStateInterface;
|
import baritone.utils.BlockStateInterface;
|
||||||
import baritone.utils.Helper;
|
import baritone.utils.Helper;
|
||||||
import baritone.utils.InputOverrideHandler;
|
import baritone.utils.InputOverrideHandler;
|
||||||
import baritone.api.utils.interfaces.Toggleable;
|
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
@ -136,15 +136,11 @@ public final class GameEventHandler implements IGameEventListener, Helper {
|
|||||||
|
|
||||||
BlockStateInterface.clearCachedChunk();
|
BlockStateInterface.clearCachedChunk();
|
||||||
|
|
||||||
switch (event.getState()) {
|
if (event.getState() == EventState.POST) {
|
||||||
case PRE:
|
cache.closeWorld();
|
||||||
break;
|
if (event.getWorld() != null) {
|
||||||
case POST:
|
cache.initWorld(event.getWorld());
|
||||||
cache.closeWorld();
|
}
|
||||||
if (event.getWorld() != null) {
|
|
||||||
cache.initWorld(event.getWorld());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
listeners.forEach(l -> {
|
listeners.forEach(l -> {
|
||||||
|
@ -130,8 +130,9 @@ public class MovementParkour extends Movement {
|
|||||||
return WALK_ONE_BLOCK_COST * 3;
|
return WALK_ONE_BLOCK_COST * 3;
|
||||||
case 4:
|
case 4:
|
||||||
return SPRINT_ONE_BLOCK_COST * 4;
|
return SPRINT_ONE_BLOCK_COST * 4;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException("LOL");
|
||||||
}
|
}
|
||||||
throw new IllegalStateException("LOL");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user