User Tools

Site Tools


tutorial:custom_portals

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorial:custom_portals [2022/08/16 20:54] – external edit 127.0.0.1tutorial:custom_portals [2025/10/16 17:15] (current) – Specify how to make a portal which is lit with fire donillia
Line 1: Line 1:
-FIXME //This page hasn't been updated in a while, and may not work in the future updates. // 
- 
 ====== Creating a custom portal to access your dimension ====== ====== Creating a custom portal to access your dimension ======
  
Line 26: Line 24:
 </code> </code>
  
-**Note:** You need to choose the right version for your mod. The library works currently for 1.16 1.18.+**Note:** You need to choose the right version for your mod. The library works currently for 1.161.18 and 1.19.
  
 ===== Registering your Portal ===== ===== Registering your Portal =====
Line 34: Line 32:
 The portals created using the CustomPortalApi act like vanilla portals, and can be as big as 23×23. The portals created using the CustomPortalApi act like vanilla portals, and can be as big as 23×23.
  
-<code java> +<code java>; 
-//  CustomPortalApiRegistry.addPortal(Block frameBlock, Identifier dimID, int r, int g, int b+ 
-CustomPortalApiRegistry.addPortal(Blocks.GOLD_BLOCKnew Identifier("my_mod_id", "my_dimension_id")234, 183, 8);+CustomPortalBuilder.beginPortal()   
 +        .frameBlock(Blocks.GOLD_BLOCK)   
 +        .lightWithItem(Items.ENDER_EYE)   
 +      //.lightWithFluid(Fluids.WATER) 
 +        .destDimID(new Identifier("my_mod_id", "my_dimension_id"))   
 +        .tintColor(234, 183, 8)   
 +        .registerPortal();
 </code> </code>
 +
 +If you want it to be lit with fire, however, you will need to call ''.customIgnitionSource'' passing in ''PortalIgnitionSource.FIRE''.
 +
  
 Now, this would create the following portal (Custom Portals can work in any dimension!): Now, this would create the following portal (Custom Portals can work in any dimension!):
Line 47: Line 54:
  
 <code java> <code java>
-//  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"), 5152, 49+CustomPortalBuilder.beginPortal()   
 +        .frameBlock(Blocks.NETHERITE_BLOCK)   
 +        .lightWithItem(Items.ENDER_EYE)   
 +      //.lightWithFluid(Fluids.WATER) 
 +        .destDimID(new Identifier("the_end"))   
 +        .tintColor(45,65,101)   
 +        .registerPortal();
 </code> </code>
  
-Now we have a cool netherite portal that can be lit by using lava and a golden portal!+Now we have a cool netherite portal that can be lit by using lava and a golden portal that can be lit by using an eye of ender!
  
 {{https://raw.githubusercontent.com/kyrptonaught/customportalapi/main/images/2020-11-15_17.06.44.png}} {{https://raw.githubusercontent.com/kyrptonaught/customportalapi/main/images/2020-11-15_17.06.44.png}}
tutorial/custom_portals.1660683266.txt.gz · Last modified: 2022/08/16 20:54 by 127.0.0.1