kyrptonaught / customportalapi

Developer Api for creating custom portals to any dimension
MIT License
64 stars 22 forks source link

Issue with Immersive Portals because the player teleportation code does not invoke vanilla teleportation method #14

Closed qouteall closed 3 years ago

qouteall commented 3 years ago

IP has injection to moveToWorld and teleport method to do the chunk tracking update, but custom portal api uses its own teleportation code so that it has an issue with IP (when coming back the chunks won't load). And IP's convert conventional portal functionality(https://qouteall.fun/immptl/wiki/Datapack-Based-Custom-Portal-Generation) is also not triggered. It's recommended to replace this vanilla copy code https://github.com/kyrptonaught/customportalapi/blob/main/src/main/java/net/kyrptonaught/customportalapi/util/CustomTeleporter.java#L58 with ServerPlayerEntity 's teleport method. Doing this cleans up the code and makes it compatible with IP.

kyrptonaught commented 3 years ago

I copied the code(with modification) rather than just calling the teleport method to avoid a few of its functions(end credits and end platform for example).

I could instead look into mixing in and disabling these calls when doing a custom teleportation

qouteall commented 3 years ago

moveToWorld generates obsidian platform but teleport does not. And teleport does triggers dimension travel credit but won't wrongly trigger the end credit. The teleport is being used for /tp command and is safe to use

kyrptonaught commented 3 years ago

Ah I did not know ServerPlayerEntity had a different overload of teleport, I only saw it's implementation in Entity. I will certainly use that, do you need entities other than players to also use the vanilla moveToWorld, or would my own teleportation logic be okay for that?

kyrptonaught commented 3 years ago

I've implemented and uploaded the change to using teleportin beta-25

qouteall commented 3 years ago

The non-player entity teleporting code should be fine