2727import baritone .api .utils .Pair ;
2828import baritone .cache .CachedChunk ;
2929import net .minecraft .client .Minecraft ;
30+ import net .minecraft .client .multiplayer .ClientCommonPacketListenerImpl ;
3031import net .minecraft .client .multiplayer .ClientPacketListener ;
32+ import net .minecraft .client .multiplayer .CommonListenerCookie ;
3133import net .minecraft .client .player .LocalPlayer ;
3234import net .minecraft .core .BlockPos ;
35+ import net .minecraft .network .Connection ;
3336import net .minecraft .network .protocol .game .*;
3437import net .minecraft .world .level .ChunkPos ;
3538import net .minecraft .world .level .block .state .BlockState ;
36- import org .spongepowered .asm .mixin .Final ;
3739import org .spongepowered .asm .mixin .Mixin ;
38- import org .spongepowered .asm .mixin .Shadow ;
3940import org .spongepowered .asm .mixin .injection .At ;
4041import org .spongepowered .asm .mixin .injection .Inject ;
4142import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
4849 * @since 8/3/2018
4950 */
5051@ Mixin (ClientPacketListener .class )
51- public class MixinClientPlayNetHandler {
52+ public abstract class MixinClientPlayNetHandler extends ClientCommonPacketListenerImpl {
5253
5354 // unused lol
5455 /*@Inject(
@@ -74,9 +75,9 @@ private void preRead(SPacketChunkData packetIn, CallbackInfo ci) {
7475 }
7576 }*/
7677
77- @ Shadow
78- @ Final
79- private Minecraft minecraft ;
78+ protected MixinClientPlayNetHandler ( final Minecraft arg , final Connection arg2 , final CommonListenerCookie arg3 ) {
79+ super ( arg , arg2 , arg3 );
80+ }
8081
8182 @ Inject (
8283 method = "sendChat(Ljava/lang/String;)V" ,
@@ -124,7 +125,7 @@ private void preChunkUnload(ClientboundForgetLevelChunkPacket packet, CallbackIn
124125 LocalPlayer player = ibaritone .getPlayerContext ().player ();
125126 if (player != null && player .connection == (ClientPacketListener ) (Object ) this ) {
126127 ibaritone .getGameEventHandler ().onChunkEvent (
127- new ChunkEvent (EventState .PRE , ChunkEvent .Type .UNLOAD , packet .getX () , packet .getZ () )
128+ new ChunkEvent (EventState .PRE , ChunkEvent .Type .UNLOAD , packet .pos (). x , packet .pos (). z )
128129 );
129130 }
130131 }
@@ -139,7 +140,7 @@ private void postChunkUnload(ClientboundForgetLevelChunkPacket packet, CallbackI
139140 LocalPlayer player = ibaritone .getPlayerContext ().player ();
140141 if (player != null && player .connection == (ClientPacketListener ) (Object ) this ) {
141142 ibaritone .getGameEventHandler ().onChunkEvent (
142- new ChunkEvent (EventState .POST , ChunkEvent .Type .UNLOAD , packet .getX () , packet .getZ () )
143+ new ChunkEvent (EventState .POST , ChunkEvent .Type .UNLOAD , packet .pos (). x , packet .pos (). z )
143144 );
144145 }
145146 }
0 commit comments