From 750cc619fb0c1cbe89f59856ac1b27813bb1f2a1 Mon Sep 17 00:00:00 2001 From: CDAGaming Date: Mon, 17 Aug 2020 18:50:58 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20broken=20mixin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mixins/MixinClientPlayNetHandler.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/launch/java/baritone/launch/mixins/MixinClientPlayNetHandler.java b/src/launch/java/baritone/launch/mixins/MixinClientPlayNetHandler.java index 15766b98e..e29307ce7 100644 --- a/src/launch/java/baritone/launch/mixins/MixinClientPlayNetHandler.java +++ b/src/launch/java/baritone/launch/mixins/MixinClientPlayNetHandler.java @@ -120,19 +120,15 @@ public class MixinClientPlayNetHandler { if (!Baritone.settings().repackOnAnyBlockChange.value) { return; } - if (packetIn.getChangedBlocks().length == 0) { - return; - } - https://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.15 - { - for (SMultiBlockChangePacket.BlockUpdateData update : packetIn.getChangedBlocks()) { - if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(update.getBlockState().getBlock())) { - break https; - } + ChunkPos[] chunkPos = new ChunkPos[1]; + packetIn.func_244310_a((pos, state) -> { + if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(state.getBlock())) { + chunkPos[0] = new ChunkPos(pos); } + }); + if (chunkPos[0] == null) { return; } - ChunkPos pos = new ChunkPos(packetIn.getChangedBlocks()[0].getPos()); for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) { ClientPlayerEntity player = ibaritone.getPlayerContext().player(); if (player != null && player.connection == (ClientPlayNetHandler) (Object) this) { @@ -140,8 +136,8 @@ public class MixinClientPlayNetHandler { new ChunkEvent( EventState.POST, ChunkEvent.Type.POPULATE_FULL, - pos.x, - pos.z + chunkPos[0].x, + chunkPos[0].z ) ); }