Skip to content

Commit

Permalink
Fix #3255 (#3257)
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 authored Aug 13, 2023
1 parent d9acd82 commit eeb8eb3
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;", remap = false), 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;", remap = false), 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 @@ -45,8 +45,9 @@ public final class NetworkingPlayPacketTest implements ModInitializer {
public static final Identifier TEST_CHANNEL = NetworkingTestmods.id("test_channel");

public static void sendToTestChannel(ServerPlayerEntity player, String stuff) {
ServerPlayNetworking.send(player, new OverlayPacket(Text.literal(stuff)));
NetworkingTestmods.LOGGER.info("Sent custom payload packet in {}", TEST_CHANNEL);
ServerPlayNetworking.getSender(player).sendPacket(new OverlayPacket(Text.literal(stuff)), future -> {
NetworkingTestmods.LOGGER.info("Sent custom payload packet in {}", TEST_CHANNEL);
});
}

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

0 comments on commit eeb8eb3

Please sign in to comment.