From 4a13b54e50d56e77f0c31de053b0b2e4cd519171 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 9 Sep 2018 10:27:47 -0700 Subject: [PATCH] brady was right and I was wrong --- .../baritone/api/event/GameEventHandler.java | 52 +++++++++---------- .../pathing/movement/MovementHelper.java | 1 + 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/main/java/baritone/api/event/GameEventHandler.java b/src/main/java/baritone/api/event/GameEventHandler.java index 32634213..9e569980 100644 --- a/src/main/java/baritone/api/event/GameEventHandler.java +++ b/src/main/java/baritone/api/event/GameEventHandler.java @@ -60,20 +60,20 @@ public final class GameEventHandler implements IGameEventListener, Helper { @Override public final void onTick(TickEvent event) { - for (IGameEventListener l : listeners) { + listeners.forEach(l -> { if (canDispatch(l)) { l.onTick(event); } - } + }); } @Override public final void onPlayerUpdate(PlayerUpdateEvent event) { - for (IGameEventListener l : listeners) { + listeners.forEach(l -> { if (canDispatch(l)) { l.onPlayerUpdate(event); } - } + }); } @Override @@ -93,20 +93,20 @@ public final class GameEventHandler implements IGameEventListener, Helper { } } - for (IGameEventListener l : listeners) { + listeners.forEach(l -> { if (canDispatch(l)) { l.onProcessKeyBinds(); } - } + }); } @Override public final void onSendChatMessage(ChatEvent event) { - for (IGameEventListener l : listeners) { + listeners.forEach(l -> { if (canDispatch(l)) { l.onSendChatMessage(event); } - } + }); } @Override @@ -132,20 +132,20 @@ public final class GameEventHandler implements IGameEventListener, Helper { } - for (IGameEventListener l : listeners) { + listeners.forEach(l -> { if (canDispatch(l)) { l.onChunkEvent(event); } - } + }); } @Override public final void onRenderPass(RenderEvent event) { - for (IGameEventListener l : listeners) { + listeners.forEach(l -> { if (canDispatch(l)) { l.onRenderPass(event); } - } + }); } @Override @@ -165,65 +165,65 @@ public final class GameEventHandler implements IGameEventListener, Helper { break; } - for (IGameEventListener l : listeners) { + listeners.forEach(l -> { if (canDispatch(l)) { l.onWorldEvent(event); } - } + }); } @Override public final void onSendPacket(PacketEvent event) { - for (IGameEventListener l : listeners) { + listeners.forEach(l -> { if (canDispatch(l)) { l.onSendPacket(event); } - } + }); } @Override public final void onReceivePacket(PacketEvent event) { - for (IGameEventListener l : listeners) { + listeners.forEach(l -> { if (canDispatch(l)) { l.onReceivePacket(event); } - } + }); } @Override public void onPlayerRelativeMove(RelativeMoveEvent event) { - for (IGameEventListener l : listeners) { + listeners.forEach(l -> { if (canDispatch(l)) { l.onPlayerRelativeMove(event); } - } + }); } @Override public void onBlockInteract(BlockInteractEvent event) { - for (IGameEventListener l : listeners) { + listeners.forEach(l -> { if (canDispatch(l)) { l.onBlockInteract(event); } - } + }); } @Override public void onPlayerDeath() { - for (IGameEventListener l : listeners) { + listeners.forEach(l -> { if (canDispatch(l)) { l.onPlayerDeath(); } - } + }); } @Override public void onPathEvent(PathEvent event) { - for (IGameEventListener l : listeners) { + listeners.forEach(l -> { if (canDispatch(l)) { l.onPathEvent(event); } - } + }); } public final void registerEventListener(IGameEventListener listener) { diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 6aa2f5e0..1036b69f 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -419,6 +419,7 @@ public interface MovementHelper extends ActionCosts, Helper { //this doesn't guarantee descend is possible, it just guarantees fall is impossible return new MovementDescend(pos, dest.down()); // standard move out by 1 and descend by 1 + // we can't cost shortcut descend because !canWalkThrough doesn't mean canWalkOn } // we're clear for a fall 2