PortalGeometry

Create your own portal structures

Why would I make a PortalGeometry

If you want portals with weird patterns or weird orientation, etc then you need to override the Dimensions PortalGeometry

For example HorizontalPortalsAddon uses its own PortalGeometry

How do I make a custom PortalGeometry

First, you need to create a new class and extend it PortalGeometry

Apart from the constructor, the class requires a few other fields to be overridden in order to function properly:

//Return a new instance of your class
public PortalGeometry createGeometry(Vector min, Vector max)

//Return a new instance of your class
//(this method is used to actually find the portal structure)
public PortalGeometry getPortal(CustomPortal customPortal, Location loc)

//Use this method to check if the player is inside the portal
public boolean isInside(Location location, boolean outside, boolean corner)

//Use this to build an exit portal (not that the newLocation is the bottom corner of the portal)
public void buildPortal(Location newLocation, World destinationWorld, CustomPortal customPortal)

Example:

Last updated