2323
2424import com .viaversion .viafabricplus .ViaFabricPlusImpl ;
2525import com .viaversion .viafabricplus .protocoltranslator .ProtocolTranslator ;
26+ import com .viaversion .viaversion .api .connection .UserConnection ;
2627import com .viaversion .viaversion .api .protocol .packet .PacketWrapper ;
2728import com .viaversion .viaversion .api .type .Types ;
2829import net .minecraft .client .gui .screens .inventory .InventoryScreen ;
@@ -43,13 +44,10 @@ public class MixinInventoryScreen {
4344 @ Inject (method = "<init>" , at = @ At ("RETURN" ))
4445 private void sendBedrockPacket (CallbackInfo ci ) {
4546 if (ProtocolTranslator .getTargetVersion ().equalTo (BedrockProtocolVersion .bedrockLatest )) {
46- EntityTracker entityTracker = ProtocolTranslator .getPlayNetworkUserConnection ().get (EntityTracker .class );
47- if (entityTracker == null ) {
48- ViaFabricPlusImpl .INSTANCE .getLogger ().error ("Could not get bedrock entity tracker" );
49- return ;
50- }
47+ final UserConnection connection = ProtocolTranslator .getPlayNetworkUserConnection ();
48+ final EntityTracker entityTracker = connection .get (EntityTracker .class );
5149
52- final PacketWrapper interact = PacketWrapper .create (ServerboundBedrockPackets .INTERACT , ProtocolTranslator . getPlayNetworkUserConnection () );
50+ final PacketWrapper interact = PacketWrapper .create (ServerboundBedrockPackets .INTERACT , connection );
5351 interact .write (Types .UNSIGNED_BYTE , (short ) InteractPacket_Action .OpenInventory .getValue ()); // action
5452 interact .write (BedrockTypes .UNSIGNED_VAR_LONG , entityTracker .getClientPlayer ().runtimeId ()); // target entity runtime id
5553 interact .write (BedrockTypes .OPTIONAL_POSITION_3F , null ); // position
0 commit comments