Skip to content

Commit

Permalink
portal
Browse files Browse the repository at this point in the history
  • Loading branch information
Faithcaio committed May 31, 2024
1 parent c7adbb8 commit 907335d
Showing 1 changed file with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public interface PortalEntityEvent extends Event {
@AbsoluteSortPosition(1)
Entity entity();

/**
* Gets the {@link PortalLogic}.
*
* @return The portal logic
*/
PortalLogic portal();

/**
Expand Down Expand Up @@ -79,22 +84,20 @@ interface Enter extends PortalEntityEvent, Cancellable {
}

/**
* Called before calculating and generating the portal exit.
* Called before calculating and finding or generating the portal exit.
* Canceling resets the portal transition time
* Setting custom portal logic can change the teleport behaviour.
* TODO {@link org.spongepowered.api.block.BlockTypes#NETHER_PORTAL} should be a portal instance
* TODO sponge provided Portal instances for vanilla
* TODO portal builder? for custom plugin code
*/
// This is before the portal logic ran, as such no blocks should be generated yet
interface Pre extends PortalEntityEvent, Cancellable {
// TODO for vanilla we could allow changing the Portal
// TODO expose vanilla portals + sponge variants without block generation?

/**
* Sets the {@link PortalLogic} to use.
*
* @param portal The portal logic
*/
void setPortal(PortalLogic portal);
}

// DimensionTransition was obtained, portal blocks are generated

/**
* Called after a {@link PortalLogic} calculated and found or generated the portal exit.
* Note that {@link ChangeEntityWorldEvent} still fire after this.
Expand All @@ -103,7 +106,18 @@ interface Teleport extends PortalEntityEvent, ChangeEntityWorldEvent.Reposition,

// TODO cancel -> rollback block generation? @gabizou?

/**
* Gets the exit speed.
*
* @return The exit speed
*/
Vector3d exitSpeed();

/**
* Sets the exit speed.
*
* @param speed The exit speed
*/
void setExitSpeed(Vector3d speed);

}
Expand Down

0 comments on commit 907335d

Please sign in to comment.