Class PortalManager
java.lang.Object
tech.anonymoushacker1279.openportals.portal.PortalManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPortal(net.minecraft.world.level.block.Block frameBlock, PortalLink link) Add a portal frame and link to the manager.net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> getDimensionKey(net.minecraft.resources.Identifier dimensionId) Get the dimension key for a given dimension identifier.@Nullable PortalLinkgetPortalLinkFromBase(net.minecraft.world.level.block.Block baseBlock) Get the portal link associated with a base block.@Nullable PortalLinkingStorageGet the portal linking storage.booleanisRegisteredFrameBlock(net.minecraft.world.level.block.state.BlockState blockState) Check if a block state is a registered portal frame block.voidpopulateDimensions(Set<net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level>> registryKeys) Populate the dimension map.voidsetStorage(PortalLinkingStorage storage) Set the portal linking storage.
-
Constructor Details
-
PortalManager
public PortalManager()
-
-
Method Details
-
addPortal
Add a portal frame and link to the manager.- Parameters:
frameBlock- the portal frame blocklink- the portal link
-
populateDimensions
public void populateDimensions(Set<net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level>> registryKeys) Populate the dimension map. Set on server start viaNeoEventSubscriber.onServerStart(ServerStartedEvent).- Parameters:
registryKeys- the set of dimension registry keys
-
isRegisteredFrameBlock
public boolean isRegisteredFrameBlock(net.minecraft.world.level.block.state.BlockState blockState) Check if a block state is a registered portal frame block.- Parameters:
blockState- the block state to check- Returns:
- true if registered, false otherwise
-
getPortalLinkFromBase
@Nullable public @Nullable PortalLink getPortalLinkFromBase(net.minecraft.world.level.block.Block baseBlock) Get the portal link associated with a base block.- Parameters:
baseBlock- the base block- Returns:
- the portal link, or null if not found
-
getDimensionKey
public net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> getDimensionKey(net.minecraft.resources.Identifier dimensionId) Get the dimension key for a given dimension identifier.- Parameters:
dimensionId- the dimension identifier- Returns:
- the dimension key, or null if not found
-
getStorage
Get the portal linking storage. This should only be null if the server has not started yet.- Returns:
- the portal linking storage, or null if not set
-
setStorage
Set the portal linking storage. Set on server start viaNeoEventSubscriber.onServerStart(ServerStartedEvent).- Parameters:
storage- the portal linking storage
-