Stargate Rewritten

Stargate Rewritten

241 Downloads

END_PORTAL is not handled properly

EpicKnarvik97 opened this issue ยท 9 comments

commented

When using a Stargate with END_PORTAL as its iris-open material, the default vanilla behavior is experienced. The player is teleported to the spawn in the other world, not to the target Stargate. This happens regardless whether the teleportation is between Stargates in the same world, or Stargates between the end and the overworld.
If the player has leashed a creature, the leash is broken and the creature is left at the entrance.

commented

Okay, I will look into it tomorrow, probably to tired right now

commented

That's true. Seems like going back to the overworld through an end portal does not trigger the same event. (Looking up possible events)

commented

It triggers the respawn event. See my fork for an example way of handling it. I cannot remember if my fork handles leashed creatures properly (for that scenario) though.

commented

The supposed fix does not fix Stargates using END_PORTAL going from the end to the overworld. In this scenario, the player is teleported to the overworld's spawn, and any leashed entities are left in the end.

commented

My fork handles Bungee portals using END_PORTAL in the end properly now. As inter-server portals are just glorified bungee portals, you should be able to use my fork's way to fix end portal teleportation. I guess, to improve my fork's solution, you could check the direction vector of the player for whether the player is actually about to enter the portal to prevent teleportation from triggering just because a player is strolling past the portal.

commented

The fix using the respawn event is kind of hacky. You basically need to store the teleportation when the player enters the Stargate. Then you need to hijack the respawn event, and make the player respawn at the destination portal instead of at the spawn.

commented

Unfortunately that might not be valid in this case, as there are interserver portals, which also needs to function normally

commented

Unfortunately that might not be valid in this case, as there are interserver portals, which also needs to function normally

One potential way to fix it for inter-server portals would be to look for players entering a block adjacent to the iris, thus never allowing the default respawn event to trigger. This might be a non-issue as you'd normally just hijack the respawn event to make the player teleport back to the entrance for inter-server portals.

Just try to fix it in the known way, and if it doesn't work, try something else.

commented

After some discussion, 2 alternative solutions have appeared:

  1. Just increase the range when looking for Stargates using END_PORTAL iris in the end to bypass the problem. This should work fine, though it would need some fine-tuning feel natural. This is probably the fastest go get somewhat working.
  2. Replace the end portal blocks with falling blocks when a player is near (this need to be done asynchronosly to prevent lag griefing), and use falling blocks when a Stargate with an END_PORTAL iris is activated in the end.