User Tools

Site Tools


Sidebar

Setup

Basics

Advanced

Items

Blocks and Block Entities

Fluids

Entities

World Generation

Recipe Types

Miscellaneous

Events

Mixins

Dynamic Data Generation

Tutorials for Minecraft 1.15

Tutorials for Minecraft 1.14

Documentation

tutorial:custom_portals

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

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.

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'

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!

Extras

The portal API supports custom portal blocks, allowing you to create your own textures. Currently it doesn't support horizontal portals, but it may in the future.

The API also supports the use of events, allowing the portal to not be ignited by the player, but through a event being invoked in your code. See here for more infomation.

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