Hats

Hats

24M Downloads

Compatibility with BetterPortals

Johni0702 opened this issue ยท 1 comments

commented

When switching worlds, ghost hats remain in the previous one (under certain unknown conditions).

These can be seen in SP when in third-person mode (but only when passing from the world first loaded into the other one?) and according to Johni0702/BetterPortals#119 for other players as well.

This could probably be solved (haven't tried) by checking for the parent's dimension (with BP, the player entity is transferred into the other world instead of killed and respawned) at:

if(parent == null || !parent.isEntityAlive() || parent.isChild())
{
setDead();
return;
}

While looking through Hats' source for what might be causing that issue I also came across EventHandlerClient#worldTick which looks quite convoluted.
I haven't tried this (Edit: confirmed) but it looks like it'll cause hats to only equip on players in the main world (with BP the ClientTickEvent is called while mc.world is the primary one) and not for those on the remote side of portals.
I'd suggest getting rid of most of that method and instead using the EntityJoinWorldEvent instead.

commented

Welp, geez. Hats' code is ancient and frankly really outdated and hacky at this point. Hats is slated for a good redo/do over so I'm honestly just applying duct tape in the cracks right now. I've tracked the hat parent dimension now 5cbaacd and if that changes, I kill off the hat. That should sort out the issue.

I won't be fixing the issue with hats not appearing on worlds other than your own, right now, though. I'll see if I can sort it out in the redo.

BTW Great work on BP. Love it :)