Fabric API

Fabric API

106M Downloads

Register custom handlers for EntitySpawnS2CPacket

bluebear94 opened this issue · 3 comments

commented

It should be possible to register custom handlers for which entity to spawn from ClientPlayNetworkHandler#onEntitySpawn.

Alternatives:

  • use your custom packet type – possible, but you have to duplicate vanilla logic
  • do the mixins yourself – hard, might conflict with other mods that want to do the same thing
commented

The packet handler for EntitySpawnS2CPacket no longer requires a mixin to support non-living entities.

commented

I don't understand exactly what the intended use case is here. EntitySpawnS2CPacket already accepts a field for both entity and entity type, and for anything more complicated fabric networking api (I believe) has the ability to create custom S2C packets really easily. Not sure how this would be necessary unless I'm missing the point.

commented

I think the consensus here is to create your own entity spawn packet. You can use the read and write methods from the EntitySpawnS2CPacket to reduce duplicate code but the actual spawn process would be handled in your client packet handler.