add defaults to switches

This commit is contained in:
Leijurv 2018-09-16 19:50:07 -07:00
parent f25f264fd3
commit 3011b85aee
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
5 changed files with 34 additions and 35 deletions

View File

@ -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;
} }
} }

View File

@ -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,8 +94,7 @@ 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();
@ -118,8 +117,6 @@ public final class MemoryBehavior extends Behavior implements Helper {
if (p instanceof SPacketCloseWindow) { if (p instanceof SPacketCloseWindow) {
updateInventory(); updateInventory();
} }
break;
}
} }
} }

View File

@ -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;
} }
} }
} }

View File

@ -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:
break;
case POST:
cache.closeWorld(); cache.closeWorld();
if (event.getWorld() != null) { if (event.getWorld() != null) {
cache.initWorld(event.getWorld()); cache.initWorld(event.getWorld());
} }
break;
} }
listeners.forEach(l -> { listeners.forEach(l -> {

View File

@ -130,9 +130,10 @@ 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");
} }
}
@Override @Override