Skip to content

Implement PortalLogic's TeleportBehavior - #4302

Open
whimxiqal wants to merge 2 commits into
SpongePowered:api-12from
whimxiqal:whimxiqal/use-entity-pos-for-nether-portal
Open

Implement PortalLogic's TeleportBehavior#4302
whimxiqal wants to merge 2 commits into
SpongePowered:api-12from
whimxiqal:whimxiqal/use-entity-pos-for-nether-portal

Conversation

@whimxiqal

@whimxiqal whimxiqal commented Aug 16, 2026

Copy link
Copy Markdown

Teleporting through portals in vanilla places the entity in the same relative location of the destination portal as the entry point of the origin portal. This logic was not preserved when using PortalLogic because the nearest-block connection point to the destination portal was used as the entity destination. This way, using a PortalLogic for nether portals now makes teleporting through nether portals much more smooth.

Awaiting API approval: SpongePowered/SpongeAPI#2614

To test, I ran it with a plugin with:

    @Listener
    public void onConstructPlugin(final ConstructPluginEvent event) {
        // Perform any one-time setup
        Sponge.eventManager().registerListener(EventListenerRegistration.builder(InvokePortalEvent.Prepare.class)
                .plugin(container)
                .order(Order.DEFAULT)
                .listener(e -> e.setPortalLogic(PortalLogic.builder().addPortal(
                        PortalLogic.factory().netherPortal().exitCalculator().get(),
                        PortalLogic.factory().netherPortal().finder().get(),
                        PortalLogic.factory().netherPortal().teleporter().get(),
                        PortalLogic.factory().netherPortal().generator().get()
                ).build()))
                .build());
    }

Before, teleporting was jerky and inconsistent, but now it feels like vanilla.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant