customized TickEvent Type based on player context status

This commit is contained in:
Leijurv 2018-11-13 22:17:18 -08:00
parent 57b60c734b
commit e93fd596ff
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -86,12 +86,12 @@ public class MixinMinecraft {
) )
private void runTick(CallbackInfo ci) { private void runTick(CallbackInfo ci) {
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) { for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
((Baritone) ibaritone).getGameEventHandler().onTick(new TickEvent(
EventState.PRE, TickEvent.Type type = ibaritone.getPlayerContext().player() != null && ibaritone.getPlayerContext().world() != null
(player != null && world != null) ? TickEvent.Type.IN
? TickEvent.Type.IN : TickEvent.Type.OUT;
: TickEvent.Type.OUT
)); ((Baritone) ibaritone).getGameEventHandler().onTick(new TickEvent(EventState.PRE, type));
} }
} }