brady was right and I was wrong

This commit is contained in:
Leijurv 2018-09-09 10:27:47 -07:00
parent ef4de2b159
commit 4a13b54e50
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 27 additions and 26 deletions

View File

@ -60,20 +60,20 @@ public final class GameEventHandler implements IGameEventListener, Helper {
@Override @Override
public final void onTick(TickEvent event) { public final void onTick(TickEvent event) {
for (IGameEventListener l : listeners) { listeners.forEach(l -> {
if (canDispatch(l)) { if (canDispatch(l)) {
l.onTick(event); l.onTick(event);
} }
} });
} }
@Override @Override
public final void onPlayerUpdate(PlayerUpdateEvent event) { public final void onPlayerUpdate(PlayerUpdateEvent event) {
for (IGameEventListener l : listeners) { listeners.forEach(l -> {
if (canDispatch(l)) { if (canDispatch(l)) {
l.onPlayerUpdate(event); l.onPlayerUpdate(event);
} }
} });
} }
@Override @Override
@ -93,20 +93,20 @@ public final class GameEventHandler implements IGameEventListener, Helper {
} }
} }
for (IGameEventListener l : listeners) { listeners.forEach(l -> {
if (canDispatch(l)) { if (canDispatch(l)) {
l.onProcessKeyBinds(); l.onProcessKeyBinds();
} }
} });
} }
@Override @Override
public final void onSendChatMessage(ChatEvent event) { public final void onSendChatMessage(ChatEvent event) {
for (IGameEventListener l : listeners) { listeners.forEach(l -> {
if (canDispatch(l)) { if (canDispatch(l)) {
l.onSendChatMessage(event); l.onSendChatMessage(event);
} }
} });
} }
@Override @Override
@ -132,20 +132,20 @@ public final class GameEventHandler implements IGameEventListener, Helper {
} }
for (IGameEventListener l : listeners) { listeners.forEach(l -> {
if (canDispatch(l)) { if (canDispatch(l)) {
l.onChunkEvent(event); l.onChunkEvent(event);
} }
} });
} }
@Override @Override
public final void onRenderPass(RenderEvent event) { public final void onRenderPass(RenderEvent event) {
for (IGameEventListener l : listeners) { listeners.forEach(l -> {
if (canDispatch(l)) { if (canDispatch(l)) {
l.onRenderPass(event); l.onRenderPass(event);
} }
} });
} }
@Override @Override
@ -165,65 +165,65 @@ public final class GameEventHandler implements IGameEventListener, Helper {
break; break;
} }
for (IGameEventListener l : listeners) { listeners.forEach(l -> {
if (canDispatch(l)) { if (canDispatch(l)) {
l.onWorldEvent(event); l.onWorldEvent(event);
} }
} });
} }
@Override @Override
public final void onSendPacket(PacketEvent event) { public final void onSendPacket(PacketEvent event) {
for (IGameEventListener l : listeners) { listeners.forEach(l -> {
if (canDispatch(l)) { if (canDispatch(l)) {
l.onSendPacket(event); l.onSendPacket(event);
} }
} });
} }
@Override @Override
public final void onReceivePacket(PacketEvent event) { public final void onReceivePacket(PacketEvent event) {
for (IGameEventListener l : listeners) { listeners.forEach(l -> {
if (canDispatch(l)) { if (canDispatch(l)) {
l.onReceivePacket(event); l.onReceivePacket(event);
} }
} });
} }
@Override @Override
public void onPlayerRelativeMove(RelativeMoveEvent event) { public void onPlayerRelativeMove(RelativeMoveEvent event) {
for (IGameEventListener l : listeners) { listeners.forEach(l -> {
if (canDispatch(l)) { if (canDispatch(l)) {
l.onPlayerRelativeMove(event); l.onPlayerRelativeMove(event);
} }
} });
} }
@Override @Override
public void onBlockInteract(BlockInteractEvent event) { public void onBlockInteract(BlockInteractEvent event) {
for (IGameEventListener l : listeners) { listeners.forEach(l -> {
if (canDispatch(l)) { if (canDispatch(l)) {
l.onBlockInteract(event); l.onBlockInteract(event);
} }
} });
} }
@Override @Override
public void onPlayerDeath() { public void onPlayerDeath() {
for (IGameEventListener l : listeners) { listeners.forEach(l -> {
if (canDispatch(l)) { if (canDispatch(l)) {
l.onPlayerDeath(); l.onPlayerDeath();
} }
} });
} }
@Override @Override
public void onPathEvent(PathEvent event) { public void onPathEvent(PathEvent event) {
for (IGameEventListener l : listeners) { listeners.forEach(l -> {
if (canDispatch(l)) { if (canDispatch(l)) {
l.onPathEvent(event); l.onPathEvent(event);
} }
} });
} }
public final void registerEventListener(IGameEventListener listener) { public final void registerEventListener(IGameEventListener listener) {

View File

@ -419,6 +419,7 @@ public interface MovementHelper extends ActionCosts, Helper {
//this doesn't guarantee descend is possible, it just guarantees fall is impossible //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 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 // we're clear for a fall 2