Architectury API (Fabric/Forge/NeoForge)

Architectury API (Fabric/Forge/NeoForge)

158M Downloads

Server crash when registering S2C packet on fabric 1.20.6

st0x0ef opened this issue ยท 4 comments

commented

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);
}

`

commented

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

commented

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

commented

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

commented

I'll try that, thanks !