Skip to content

Commit

Permalink
Support plugin messages during configuration phase
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorLinfoot committed May 5, 2024
1 parent 6273ec6 commit deff5bc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/net/hypixel/modapi/fabric/FabricModAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private static void registerClientbound(String identifier) {
CustomPayload.Id<ClientboundHypixelPayload> clientboundId = CustomPayload.id(identifier);
PacketCodec<PacketByteBuf, ClientboundHypixelPayload> codec = ClientboundHypixelPayload.buildCodec(clientboundId);
PayloadTypeRegistry.playS2C().register(clientboundId, codec);
PayloadTypeRegistry.configurationS2C().register(clientboundId, codec);

// Also register the global receiver for handling incoming packets
ClientPlayNetworking.registerGlobalReceiver(clientboundId, (payload, context) -> {
Expand Down Expand Up @@ -87,6 +88,7 @@ private static void registerServerbound(String identifier) {
CustomPayload.Id<ServerboundHypixelPayload> serverboundId = CustomPayload.id(identifier);
PacketCodec<PacketByteBuf, ServerboundHypixelPayload> codec = ServerboundHypixelPayload.buildCodec(serverboundId);
PayloadTypeRegistry.playC2S().register(serverboundId, codec);
PayloadTypeRegistry.configurationC2S().register(serverboundId, codec);
} catch (IllegalArgumentException ignored) {
// Ignored as this is fired when we reload the registrations and the packet is already registered
}
Expand Down

0 comments on commit deff5bc

Please sign in to comment.