BetterPortals compatibility
Johni0702 opened this issue ยท 5 comments
BetterPortals works by spawning fake players, tunneling their packets to the client and swapping out world, player, etc. as needed.
When one builds a portal and lights it, BP spawns one such fake player causing metamorph to send its initialization packets on the tunneled connection in response to the EntityJoinWorldEvent.
The handler for the AcquiredMorphsPacket will then correctly initialize the capability of the client-side fake player (because BP has swapped out the world and player) with no morphs but subsequently incorrectly update the GUI to also have no morphs (even though the real player might have some):
I'm not sure how to best fix this.
One could special-case the fake players on either the server- or the client-side but that doesn't feel right and there's also no nice way to determine whether a player is the a fake player or whether the current world isn't the main client world.
The BP-agnostic solution would be dropping the static overlay
field and instead integrating it into the capability. I'd be willing to shoot you a PR for it but since that's quite the non-trivial change, I'd first like to hear your opinion on it.
There's also another minor issue which should be easy to solve if I'm not missing something: When walking through a portal, the player is re-morphed.
AFAICT this can be fixed by comparing the new and the current morph (assuming AbstractMorph
can be compared) before changing it and doing nothing if they're the same. Unless the re-morph effect is intentional under certain circumstances (I'm not familiar with the mod).
If there is only one "active" clone of the player at any given time, then BetterPortals is either not cloning the player capabilities correctly or needs to do something to prevent incorrect packets.
If BetterPortals has a good reason for two client-side players, then yea, might be worth some more discussion first.
There is a fork of this mod called Changeling that might be able work on adding compatiblity.
Hello @Johni0702! I'm really really appreciate that you took the time to look into this issue.
However, my free time is very limited at the moment, so I don't have any motivation to work on Metamorph, including fixing bugs. If you are still up to it, feel free to PR fixes.
Yeah, I like the capability based solution, but to be honest, I haven't touched the survival acquired morphs code in years, so I don't remember how it works. ๐
Minor issue with re-morphing is better to be left alone, because it might break my working code with my Blockbuster mod, however AbstractMorphs
can be compared with equals(Object morph)
method.
Thanks again, and have a good day! ๐