Skip to content

Commit

Permalink
some fabric and forge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticdrew committed Jun 10, 2024
1 parent bc1e8f5 commit bf751ca
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions doc/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ <h1>Common Networking ${version} for Minecraft ${mcversion}</h1>

<p>New in ${version}</p>
<ul>
<li>Added Forge back</li>
<li>Bump loader versions</li>
<li>Fixed: Some issues with forge networking throwing exceptions.</li>
<li>Fixed; Some Fabric issues.</li>
</ul>
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected <T> void registerPacket(PacketContainer<T> container)
ClientPlayNetworking.registerGlobalReceiver(container.getType(),
(ClientPlayNetworking.PlayPayloadHandler<CommonPacketWrapper<T>>) (payload, context) -> context.client().execute(() ->
container.handler().accept(
new PacketContext<>(payload.packet(), side))));
new PacketContext<>(payload.packet(), Side.CLIENT))));
}

Constants.LOG.debug("Registering packet {} : {} on the: {}", container.type().id(), container.classType(), Side.SERVER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,19 @@ public <T> void sendToClient(T packet, ServerPlayer player)

private <T> BiConsumer<T, CustomPayloadEvent.Context> buildHandler(Consumer<PacketContext<T>> handler)
{
return (message, ctx) -> ctx.enqueueWork(() -> {
return (message, ctx) -> {
try
{
Side side = ctx.isServerSide() ? Side.SERVER : Side.CLIENT;
ServerPlayer player = ctx.getSender();
handler.accept(new PacketContext<>(player, message, side));
ctx.setPacketHandled(true);
} catch (Throwable t) {
}
catch (Throwable t)
{
Constants.LOG.error("{} error handling packet", message.getClass(), t);
}
});
};
}

public record Message<T>(EventNetworkChannel channel, BiConsumer<T, FriendlyByteBuf> encoder)
Expand Down
2 changes: 1 addition & 1 deletion neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ plugins {
id 'java-library'
id 'eclipse'
id 'idea'
// id 'java'
id 'java'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '[7.0.105,)'
id 'net.darkhax.curseforgegradle' version '1.+'
Expand Down

0 comments on commit bf751ca

Please sign in to comment.