Skip to content

Commit

Permalink
fix: register S2C packet type for TagNodes (#1827)
Browse files Browse the repository at this point in the history
Closes #1744, #1772, #1800
  • Loading branch information
ellellie authored Feb 16, 2025
1 parent 19bc14d commit afd98b0
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@

import com.mojang.serialization.DataResult;
import dev.architectury.event.events.client.ClientLifecycleEvent;
import dev.architectury.impl.NetworkAggregator;
import dev.architectury.networking.NetworkManager;
import dev.architectury.networking.transformers.SplitPacketTransformer;
import dev.architectury.platform.Platform;
import dev.architectury.utils.Env;
import dev.architectury.utils.EnvExecutor;
import io.netty.buffer.Unpooled;
Expand Down Expand Up @@ -122,6 +124,12 @@ private static void writeResourceLocation(FriendlyByteBuf buf, ResourceLocation

public static void init() {
EnvExecutor.runInEnv(Env.CLIENT, () -> Client::init);

// Fix for TagNodes not being loaded on the server
// A bit hacky as it uses Architectury's internal API, but this class needs rewriting to use codecs due to the deprecation of the old serialization system anyway.
if(Platform.getEnvironment() != Env.CLIENT) {
NetworkAggregator.registerS2CType(REQUEST_TAGS_PACKET_S2C, Collections.singletonList(new SplitPacketTransformer()));
}

NetworkManager.registerReceiver(NetworkManager.c2s(), REQUEST_TAGS_PACKET_C2S, Collections.singletonList(new SplitPacketTransformer()), (buf, context) -> {
UUID uuid = buf.readUUID();
Expand Down

0 comments on commit afd98b0

Please sign in to comment.