packetevents icon indicating copy to clipboard operation
packetevents copied to clipboard

Fabric module refactor

Open booky10 opened this issue 1 year ago • 0 comments

Breaking changes

  • The PacketEvents instance now needs to be created using either PacketEventsServerMod#constructApi(String) or PacketEventsClientMod#constructApi(String)
  • Nearly all packetevents fabric internals have been changed

Changes

  • Splits sources into client and common sources to prevent accidentally using client code
  • Sets up a PacketEvents api instance on both the client and server
  • Simplifies network pipeline injection and encoder/decoder handling
  • Uses proper SLF4J logger instead of System.out
  • Uses fabric access wideners for accessing player connection internals instead of reflection
  • Fixes https://github.com/retrooper/packetevents/issues/1025

Todo

  • [x] Look at other platforms and search for stuff which could be missing
    • [x] Associate platform player instance with connection channel
  • [x] Testing on client and dedicated server
  • [ ] ~~Find a way to create packetevents instances for singleplayer worlds (internal server; maybe using events other mods could listen to?)~~
    • Not possible without loading packetevents on an additional, separate classpath or removing usage of the static instance (which is used everywhere...)

booky10 avatar Oct 20 '24 04:10 booky10