ModAPI icon indicating copy to clipboard operation
ModAPI copied to clipboard

Handler unloading

Open inglettronald opened this issue 10 months ago • 4 comments

Description

Allows the user to close/unload ClientBoundPacketHandler implementations.

Why?

Dynamic handler loading seems like a novel idea.

inglettronald avatar Apr 13 '24 01:04 inglettronald

I don't necessarily disagree with adding an option to remove handlers, but why would we need a close method? If you have the reference to the handler instance you should be able to handle anything else as a result of removing the handler yourself.

ConnorLinfoot avatar Apr 13 '24 02:04 ConnorLinfoot

The user could certainly call there own close method after removing a handler. However, it looks like all of the mods can access each-other handlers currently, and this close method followed that expectation.

inglettronald avatar Apr 13 '24 02:04 inglettronald

The handlers registered aren't currently accessible, the only way to add a handler is to provide the handler itself. Other mods don't have access to the handler added.

ConnorLinfoot avatar Apr 13 '24 02:04 ConnorLinfoot

Other mods should be able to access it through mixin, reflection, or access wideners. However, at that point you could probably write your own injection into unregisterHandler anyway to write a close method, so I don't really care if this close method gets kept or not.

inglettronald avatar Apr 13 '24 02:04 inglettronald

I think with the current goals and implementation of the Mod API, methods to unregister handlers are unnecessary

ConnorLinfoot avatar Jun 16 '24 18:06 ConnorLinfoot