Skip to content

Commit

Permalink
Fix #3255 (#3257)
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 committed Aug 13, 2023
1 parent 982df14 commit def3f86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private void handleDisconnect(ChannelHandlerContext channelHandlerContext, Callb
}
}

@Inject(method = "sendInternal", at = @At(value = "INVOKE_ASSIGN", target = "Lio/netty/channel/Channel;writeAndFlush(Ljava/lang/Object;)Lio/netty/channel/ChannelFuture;"), locals = LocalCapture.CAPTURE_FAILHARD)
@Inject(method = "sendInternal", at = @At(value = "INVOKE_ASSIGN", target = "Lio/netty/channel/Channel;writeAndFlush(Ljava/lang/Object;)Lio/netty/channel/ChannelFuture;"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true)
private void sendInternal(Packet<?> packet, @Nullable PacketCallbacks listener, NetworkState packetState, NetworkState currentState, CallbackInfo ci, ChannelFuture channelFuture) {
if (listener instanceof GenericFutureListenerHolder holder) {
channelFuture.addListener(holder.getDelegate());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ public final class NetworkingPlayPacketTest implements ModInitializer {
public static void sendToTestChannel(ServerPlayerEntity player, String stuff) {
PacketByteBuf buf = PacketByteBufs.create();
buf.writeText(Text.literal(stuff));
ServerPlayNetworking.send(player, TEST_CHANNEL, buf);
NetworkingTestmods.LOGGER.info("Sent custom payload packet in {}", TEST_CHANNEL);
ServerPlayNetworking.getSender(player).sendPacket(TEST_CHANNEL, buf, future -> {
NetworkingTestmods.LOGGER.info("Sent custom payload packet in {}", TEST_CHANNEL);
});
}

public static void registerCommand(CommandDispatcher<ServerCommandSource> dispatcher) {
Expand Down

0 comments on commit def3f86

Please sign in to comment.