-
-
Notifications
You must be signed in to change notification settings - Fork 0
API usage
CustomPortalChecker
is a utility interface used within the mod itself, but that can prove useful for other mods too.
It's essentially an interface applied via mixins to the Vanilla PortalShape
class, adding a single instance method, ResourceKey<Level> dimension()
, that can be used to query the dimension the referenced portal structure is linked to (Nether portals included).
To access this method via a PortalShape
instance, you can safely cast it to CustomPortalChecker
.
CustomPortalChecker
also provides several static utility methods that can be accessed directly through the interface itself:
-
ResourceKey<Level> getPortalDimension(Level, BlockPos)
:
Returns the Custom Dimension related to the Custom Portal found at the given position in the givenLevel
.
Can be used to avoid explicit instantiations ofPortalShape
s. -
boolean isPortalForDimension(Level, BlockPos, ResourceKey<Level>)
:
Checks whether the Portal at the given position in the givenLevel
is for the specified dimension.
In this overload, the dimension is referenced by its explicitResourceKey
.
Can be used to check whether a Portal is for the Nether. -
boolean isPortalForDimension(Level, BlockPos, String)
:
Checks whether the Portal at the given position in the givenLevel
is for the specified dimension.
In this overload, the dimension is referenced by its name, and the namespace is assumed to beserver_sided_portals
.
Cannot be used to check whether a Portal is for the Nether. -
boolean isCustomPortal(Level, BlockPos)
:
Checks whether there is a Custom Portal in the givenLevel
at the given position. -
List<ResourceKey<Level>> getCustomDimensions(ServerLevel)
:
Returns the list of Custom Dimensions. -
boolean isCustomDimension(Level)
:
Returns whether the givenLevel
is a Custom one. -
boolean isCustomDimension(ResourceKey<Level> dimension)
:
Returns whether the specified dimension is a Custom one. -
TagKey<Block> getCustomPortalFrameBlockTag(ResourceKey<Level>)
:
Returns the Block Tag for the Custom Portal frame related to the specified dimension. -
Block getCustomPortalFrameBlock(Level level)
:
Returns a random Block for the Custom Portal frame related to the given dimension.
If you have any suggestions or questions about this wiki, please open an issue following the Documentation enhancement template.