Immersive Portals

Immersive Portals

6M Downloads

Incompatible with Fabrication

Althexia opened this issue ยท 6 comments

commented

Was having some issues with a Fabrication feature. Fabrication has a /hidearmor feature, but it was getting reset whenever the player entity spawned in the Overworld, either through death or a portal from the Nether or End. After checking all mods, we came to find the issue is Immersive Portals.

commented

All the mixins relevant to this feature are here: https://github.com/unascribed/Fabrication/tree/trunk/src/main/java/com/unascribed/fabrication/mixin/b_utility/hide_armor

If there's any information or testing I can do to speed this along, let me know.

Issue on my end: FalsehoodMC/Fabrication#150

commented

It may be a networking issue.
It directly sends the packet on command invocation https://github.com/unascribed/Fabrication/blob/cd20441452cc54ea86c1e5b472e489bf29c29df3/src/main/java/com/unascribed/fabrication/features/FeatureHideArmor.java so the packet does not get redirected by IP. If the player is in overworld but a nether's packet is not being redirected, then the packet will fail to be handled in the correct world. It's recommended to use vanilla's TrackedData which is easier to use (does not require custom packet) and works with IP

commented

I can't use TrackedData as it'd break vanilla clients, plus it's fragile and error-prone when modifying entities that don't belong to you. Especially in Fabrication's case, as it's client or server optional; if it injected new TrackedData, there'd be an ID desync between the server and client. Either way, if the self-hiding packet is the problem, the result would be harmless and just redundant data. (This is the only custom packet in the file.)

There is no alternative solution to sending the equipment packet, which is the other packet in the file. Am I right in assuming this is caused by the client receiving a packet for an entity ID that isn't in its current "true" world? I never did receive a log...

commented

I found out that the problem is not the packet dimension redirect, because I already redirect the packets in sendToOtherNearbyPlayers.

The real issue is in https://github.com/unascribed/Fabrication/blob/cd20441452cc54ea86c1e5b472e489bf29c29df3/src/main/java/com/unascribed/fabrication/mixin/b_utility/hide_armor/MixinServerPlayerEntity.java#L22
Due to IP's mixins this method is no longer being invoked. Putting the initial hide armor state sync here is inappropriate because it will be invoked every time a chunk is sent to client, but the data only needs to be synced once. You can send the packet when the player spawns

commented

it will be invoked every time a chunk is sent to client

Then it probably should get renamed in Yarn; sendInitialChunkPackets is misleading.

I wound up injecting there as I'm still getting used to Yarn and missed the afterSpawn method. Will move my inject there when I next work on Fabrication.

commented

Great to hear! I'm glad I brought this up to both of you. I look forward to an update.