diff --git a/fabric/src/client/java/fr/rakambda/fallingtree/fabric/client/network/FabricClientPacketHandler.java b/fabric/src/client/java/fr/rakambda/fallingtree/fabric/client/network/FabricClientPacketHandler.java index 54251ecc..7ad3b560 100644 --- a/fabric/src/client/java/fr/rakambda/fallingtree/fabric/client/network/FabricClientPacketHandler.java +++ b/fabric/src/client/java/fr/rakambda/fallingtree/fabric/client/network/FabricClientPacketHandler.java @@ -4,7 +4,6 @@ import fr.rakambda.fallingtree.common.network.ClientPacketHandler; import fr.rakambda.fallingtree.fabric.network.FallingTreeConfigPacket; import net.fabricmc.fabric.api.client.networking.v1.ClientConfigurationNetworking; -import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; public class FabricClientPacketHandler implements ClientPacketHandler{ private final FallingTreeCommon mod; @@ -15,9 +14,7 @@ public FabricClientPacketHandler(FallingTreeCommon mod){ @Override public void registerClient(){ - PayloadTypeRegistry.configurationS2C().register(FallingTreeConfigPacket.TYPE, FallingTreeConfigPacket.CODEC); - ClientConfigurationNetworking.registerGlobalReceiver(FallingTreeConfigPacket.TYPE, (packet, sender) -> { - mod.getPacketUtils().onClientConfigurationPacket(packet.getPacket()); - }); + ClientConfigurationNetworking.registerGlobalReceiver(FallingTreeConfigPacket.TYPE, + (packet, sender) -> mod.getPacketUtils().onClientConfigurationPacket(packet.getPacket())); } } diff --git a/fabric/src/main/java/fr/rakambda/fallingtree/fabric/network/FabricServerPacketHandler.java b/fabric/src/main/java/fr/rakambda/fallingtree/fabric/network/FabricServerPacketHandler.java index 4d522928..ae4e4718 100644 --- a/fabric/src/main/java/fr/rakambda/fallingtree/fabric/network/FabricServerPacketHandler.java +++ b/fabric/src/main/java/fr/rakambda/fallingtree/fabric/network/FabricServerPacketHandler.java @@ -4,6 +4,7 @@ import fr.rakambda.fallingtree.common.network.ConfigurationPacket; import fr.rakambda.fallingtree.common.network.ServerPacketHandler; import lombok.RequiredArgsConstructor; +import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; import net.fabricmc.fabric.api.networking.v1.ServerConfigurationConnectionEvents; import net.fabricmc.fabric.api.networking.v1.ServerConfigurationNetworking; @@ -13,6 +14,7 @@ public class FabricServerPacketHandler implements ServerPacketHandler{ @Override public void registerServer(){ + PayloadTypeRegistry.configurationS2C().register(FallingTreeConfigPacket.TYPE, FallingTreeConfigPacket.CODEC); ServerConfigurationConnectionEvents.CONFIGURE.register(((handler, server) -> { var packet = ConfigurationPacket.get(mod.getConfiguration()); ServerConfigurationNetworking.send(handler, new FallingTreeConfigPacket(packet));