User Tools

Site Tools


tutorial:custom_portals

This is an old revision of the document!


Creating a custom portal to access your dimension

So, you've made your dimension, registered it, added biomes and filled it with cool creatures and features.

Lets make a portal that can allow survival players to access it!

Getting Started

First of all, add the following repository to your build.gradle file.

maven { 
    url "https://dl.bintray.com/kyrptonaught/customportalapi" 
}

Then add the following dependencies:

modImplementation 'net.kyrptonaught:customportalapi:0.0.1-beta18-1.16'
include 'net.kyrptonaught:customportalapi:0.0.1-beta18-1.16'

Kyrptonaught has created a very useful library that allows you to easily create a custom portal to link your dimension to the overworld and other dimensions. For more infomation, checkout the library's github here.

Note: The library only works currently for 1.16, a 1.17 version will release soon.

Registering your Portal

To register a basic portal, lets say a Gold Block frame and Flint and Steel. You can place a simple method in your ModInitializer1) The portals created using the CustomPortalApi act like vanilla portals, and can be as big as 23×23.

//  CustomPortalApiRegistry.addPortal(Block frameBlock, Identifier dimID, int r, int g, int b)
CustomPortalApiRegistry.addPortal(Blocks.GOLD_BLOCK, new Identifier("my_mod_id", "my_dimension_id"), 234, 183, 8);

Now, this would the following portal (Custom Portals can work in any dimension!):

However, this is limited to the flint and steel. Let say we want to make a portal with a lava bucket as an ignition source. Easy! This can be easily done by using a PortalIgnitionSource

//  CustomPortalApiRegistry.addPortal(Block frameBlock, PortalIgnitionSource ignitionSource, Identifier dimID, int r, int g, int b) 
CustomPortalApiRegistry.addPortal(Blocks.NETHERITE_BLOCK, PortalIgnitionSource.FluidSource(Fluids.LAVA), new Identifier("my_mod_id", "my_dimension_id"), 51, 52, 49) 

Now we have a cool netherite portal that can be lit by using lava and a golden portal!

1)
Not Client or Server
tutorial/custom_portals.1608493644.txt.gz · Last modified: 2020/12/20 19:47 by calum6541