From aed8dae175f298cfd588ee226494c9cf6912800c Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 21 Nov 2018 17:03:24 -0800 Subject: [PATCH] hehe --- .../java/baritone/api/event/events/ChunkEvent.java | 11 ++++++++++- .../launch/mixins/MixinNetHandlerPlayClient.java | 5 +++-- src/main/java/baritone/event/GameEventHandler.java | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/api/java/baritone/api/event/events/ChunkEvent.java b/src/api/java/baritone/api/event/events/ChunkEvent.java index 1541b1f1..a74bed17 100644 --- a/src/api/java/baritone/api/event/events/ChunkEvent.java +++ b/src/api/java/baritone/api/event/events/ChunkEvent.java @@ -94,7 +94,16 @@ public final class ChunkEvent { /** * When the chunk is being populated with blocks, tile entities, etc. + *

+ * And it's a full chunk */ - POPULATE + POPULATE_FULL, + + /** + * When the chunk is being populated with blocks, tile entities, etc. + *

+ * And it's a partial chunk + */ + POPULATE_PARTIAL } } diff --git a/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java b/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java index 9fc1bd6f..a716cb87 100644 --- a/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java +++ b/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java @@ -44,12 +44,13 @@ public class MixinNetHandlerPlayClient { ) ) private void preRead(SPacketChunkData packetIn, CallbackInfo ci) { + packetIn.isFullChunk(); for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) { if (ibaritone.getPlayerContext().player().connection == (NetHandlerPlayClient) (Object) this) { ibaritone.getGameEventHandler().onChunkEvent( new ChunkEvent( EventState.PRE, - ChunkEvent.Type.POPULATE, + packetIn.isFullChunk() ? ChunkEvent.Type.POPULATE_FULL : ChunkEvent.Type.POPULATE_PARTIAL, packetIn.getChunkX(), packetIn.getChunkZ() ) @@ -68,7 +69,7 @@ public class MixinNetHandlerPlayClient { ibaritone.getGameEventHandler().onChunkEvent( new ChunkEvent( EventState.POST, - ChunkEvent.Type.POPULATE, + packetIn.isFullChunk() ? ChunkEvent.Type.POPULATE_FULL : ChunkEvent.Type.POPULATE_PARTIAL, packetIn.getChunkX(), packetIn.getChunkZ() ) diff --git a/src/main/java/baritone/event/GameEventHandler.java b/src/main/java/baritone/event/GameEventHandler.java index 7ac04643..9f16283e 100644 --- a/src/main/java/baritone/event/GameEventHandler.java +++ b/src/main/java/baritone/event/GameEventHandler.java @@ -70,7 +70,7 @@ public final class GameEventHandler implements IEventBus, Helper { ChunkEvent.Type type = event.getType(); boolean isPostPopulate = state == EventState.POST - && type == ChunkEvent.Type.POPULATE; + && (type == ChunkEvent.Type.POPULATE_FULL || type == ChunkEvent.Type.POPULATE_PARTIAL); World world = baritone.getPlayerContext().world();