kyrptonaught / customportalapi

Developer Api for creating custom portals to any dimension
MIT License
64 stars 22 forks source link

allow portals to be lit with blocks (or in my case blue fire) #78

Open warior456 opened 1 year ago

kyrptonaught commented 1 year ago

This is doable with CustomIgnitionSource.

Create a static instance of PortalIgnitionSource:

public final static PortalIgnitionSource BLUE_FIRE = PortalIgnitionSource.CustomSource(new Identifier("test","bluefire"));`

When registering your portal specify this as the ignition source:

CustomPortalBuilder.beginPortal()  
        .frameBlock(Blocks.DIAMOND_BLOCK)  
        .customIgnitionSource(BLUE_FIRE)  
        .destDimID(new Identifier("the_end"))  
        .tintColor(45,65,101)  
        .registerPortal();

Then you need to trigger the ignition when the block is placed. Add this to your Blue Fire block:

@Override
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) {
    PortalPlacer.attemptPortalLight(world, pos, BLUE_FIRE);
 }
warior456 commented 1 year ago

This doesn't work