architectury / architectury-api

An intermediary api aimed at easing development of multiplatform mods.
https://discord.architectury.dev/
GNU Lesser General Public License v3.0
327 stars 56 forks source link

Server crash when registering S2C packet on fabric 1.20.6 #518

Open st0x0ef opened 5 months ago

st0x0ef commented 5 months ago

The title said almost everythings

Fabric client work fine Neoforge client and server work fine

I'm using Architectury API v12.1.3

crashlog : Caused by: java.lang.AbstractMethodError: Receiver class dev.architectury.networking.fabric.NetworkManagerImpl$1 does not define or inherit an implementation of the resolved method 'abstract void registerS2C(net.minecraft.network.protocol.common.custom.CustomPacketPayload$Type, net.minecraft.network.codec.StreamCodec, dev.architectury.networking.NetworkManager$NetworkReceiver)' of interface dev.architectury.impl.NetworkAggregator$Adaptor. at dev.architectury.impl.NetworkAggregator.registerS2CReceiver(NetworkAggregator.java:119) ~[architectury-fabric-12.1.3.jar:?] at dev.architectury.impl.NetworkAggregator.registerReceiver(NetworkAggregator.java:76) ~[architectury-fabric-12.1.3.jar:?] at com.st0x0ef.stellaris.common.network.NetworkRegistry.register(NetworkRegistry.java:28) ~[main/:?] at com.st0x0ef.stellaris.Stellaris.init(Stellaris.java:33) ~[main/:?] at com.st0x0ef.stellaris.fabric.StellarisFabric.onInitialize(StellarisFabric.java:23) ~[main/:?] at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:384) ~[fabric-loader-0.15.11.jar:?]

If it can help you, here's the register method in the NetworkRegistry class of my mod ` public static void register() { /* C2S / NetworkAggregator.registerReceiver(NetworkManager.Side.C2S, KEY_HANDLER_ID, Collections.singletonList(new SplitPacketTransformer()), KeyHandler::apply); NetworkAggregator.registerReceiver(NetworkManager.Side.C2S, TELEPORT_ENTITY_ID, Collections.singletonList(new SplitPacketTransformer()), TeleportEntityToPlanet::apply);

    /** S2C */
    NetworkAggregator.registerReceiver(NetworkManager.Side.S2C, SYNC_PLANET_DATAPACK_ID, Collections.singletonList(new SplitPacketTransformer()), SyncPlanetsDatapack::apply);
    NetworkAggregator.registerReceiver(NetworkManager.Side.S2C, SYNC_ROCKET_COMPONENT_ID, Collections.singletonList(new SplitPacketTransformer()), SyncRocketComponent::apply);
    NetworkAggregator.registerReceiver(NetworkManager.Side.S2C, SYNC_FLUID_TANKS_ID, Collections.singletonList(new SplitPacketTransformer()), SyncWidgetsTanks::apply);
}

`

ThexXTURBOXx commented 5 months ago

S2C packets need to be registered differently on clients and servers: On clients, you call registerReceiver and on servers you call registerS2CPayloadType. Also, I would suggest you use NetworkManager#registerReceiver and NetworkManager#registerS2CPayloadType instead of the NetworkAggregator functions

st0x0ef commented 5 months ago

I don't think that this will fix the issue, NetworkManager#registerReceiver calls the NetworkAggregator#registerReceiver method...

ThexXTURBOXx commented 5 months ago

The second part won't fix the issue. The first part of my message will. The second part is just me telling you about the current standard

st0x0ef commented 5 months ago

I'll try that, thanks !