Skip to content

Commit

Permalink
issue with forge double packet registration due to weird mods
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticdrew committed Jun 29, 2024
1 parent aa1f09e commit 54a1f0d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ <h1>Common Networking ${version} for Minecraft ${mcversion}</h1>

<p>New in ${version}</p>
<ul>
<li>Fixed: Packets not getting registered on the server in singleplayer.</li>
<li>Fixed: issue with forge double packet registration due to weird mods.</li>
</ul>
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,16 @@ protected <T> void registerPacket(PacketContainer<T> container)
.serverAcceptedVersions((a) -> true)
.networkProtocolVersion(() -> "1")
.simpleChannel();
channel.registerMessage(0, container.messageType(), container.encoder(), container.decoder(), buildHandler(container.handler()));
Constants.LOG.debug("Registering packet {} : {} on the: {}", container.packetIdentifier(), container.messageType(), this.side);
CHANNELS.put(container.messageType(), channel);
try
{
channel.registerMessage(0, container.messageType(), container.encoder(), container.decoder(), buildHandler(container.handler()));
Constants.LOG.debug("Registering packet {} : {} on the: {}", container.packetIdentifier(), container.messageType(), this.side);
CHANNELS.put(container.messageType(), channel);
}
catch (IllegalArgumentException iae)
{
Constants.LOG.error("Packet \"{}\" likely already registered {} on :{}", container.packetIdentifier(), container.messageType(), this.side, iae);
}
}
}

Expand Down

0 comments on commit 54a1f0d

Please sign in to comment.