Class CustomPortalBuilder

java.lang.Object
tech.anonymoushacker1279.openportals.api.CustomPortalBuilder

public class CustomPortalBuilder extends Object
  • Constructor Details

    • CustomPortalBuilder

      @AvailableSince("1.0.0") public CustomPortalBuilder()
      Create a new CustomPortalBuilder instance.
  • Method Details

    • build

      @AvailableSince("1.0.0") public void build()
      Register the portal when completed. This should be called last, only when you are finished configuring the portal.
    • frame

      @AvailableSince("1.0.0") public CustomPortalBuilder frame(net.minecraft.resources.Identifier identifier)
      Specify a frame block as a Identifier.
      Parameters:
      identifier - Identifier of the Block to be used as the portal's frame block
    • frame

      @AvailableSince("1.0.0") public CustomPortalBuilder frame(net.minecraft.world.level.block.Block block)
      Specify a frame block as a Block.
      Parameters:
      block - Block to be used as the portal's frame block
    • destination

      @AvailableSince("1.0.0") public CustomPortalBuilder destination(net.minecraft.resources.Identifier identifier)
      Specify the destination dimension of the portal.
      Parameters:
      identifier - Identifier of the dimension the portal will teleport to
    • tintColor

      @AvailableSince("1.0.0") public CustomPortalBuilder tintColor(int color)
      Specify the color to be used to tint the portal block. Accepts a single int value.
      Parameters:
      color - Color to be used to tint the portal block
    • tintColor

      @AvailableSince("1.0.0") public CustomPortalBuilder tintColor(int r, int g, int b)
      Specify the color in RGB to be used to tint the portal block.
    • lightWithItem

      @AvailableSince("1.0.0") public CustomPortalBuilder lightWithItem(net.minecraft.world.item.Item item)
      Set the ignition source to an item.
      Parameters:
      item - Item to be used to ignite the portal
    • lightWithFluid

      @AvailableSince("1.0.0") public CustomPortalBuilder lightWithFluid(net.minecraft.world.level.material.Fluid fluid)
      Set the ignition source to a fluid.
      Parameters:
      fluid - Fluid to be used to ignite the portal
    • customIgnitionSource

      @AvailableSince("1.0.0") public CustomPortalBuilder customIgnitionSource(net.minecraft.resources.Identifier customSourceLocation)
      Specify a custom ignition source to ignite the portal. You must manually trigger the ignition yourself.
    • customIgnitionSource

      @AvailableSince("1.0.0") public CustomPortalBuilder customIgnitionSource(PortalIgnitionSource ignitionSource)
      Specify a custom ignition source to ignite the portal. You must manually trigger the ignition yourself.
    • withStrictDimensions

      @AvailableSince("1.0.0") public CustomPortalBuilder withStrictDimensions(int width, int height)
      Set specific dimensions for the portal.
      Parameters:
      width - Width of portal
      height - Height of portal
    • customPortalBlock

      @AvailableSince("1.0.0") public CustomPortalBuilder customPortalBlock(CustomPortalBlock portalBlock)
      Specify a custom block to be used as the portal block.
    • returnDimension

      @AvailableSince("1.0.0") public CustomPortalBuilder returnDimension(net.minecraft.resources.Identifier returnDimensionLocation)
      Specify the dimension this portal will return you to.
      Parameters:
      returnDimensionLocation - Identifier of the dimension the portal will return you to
    • flatPortal

      @AvailableSince("1.0.0") public CustomPortalBuilder flatPortal()
      Specify that this is a flat portal (end portal style).
    • customFrameTester

      @AvailableSince("1.0.0") public CustomPortalBuilder customFrameTester(PortalFrameTester frameTester)
      Specify a custom portal frame tester to be used.
      Parameters:
      frameTester - The custom portal frame tester to be used
    • preTeleportEvent

      @AvailableSince("1.0.0") public CustomPortalBuilder preTeleportEvent(Function<net.minecraft.world.entity.Entity, Boolean> event)
      Register an event to be called immediately before the specified entity is teleported. Returning true will allow the teleportation to continue, while returning false will cancel it.
      Parameters:
      event - A function that accepts an entity and returns a boolean
    • postTeleportEvent

      @AvailableSince("1.0.0") public CustomPortalBuilder postTeleportEvent(Consumer<net.minecraft.world.entity.Entity> event)
      Register an event to be called after the specified entity is teleported.
      Parameters:
      event - A consumer that accepts an entity
    • prePortalIgniteEvent

      @AvailableSince("1.0.0") public CustomPortalBuilder prePortalIgniteEvent(BiFunction<net.minecraft.core.BlockPos, PortalIgnitionSource, Boolean> event)
      Register an event to be called immediately before the portal is ignited. Returning false will prevent the portal from igniting.
      Parameters:
      event - A function that accepts a BlockPos and PortalIgnitionSource, returning a boolean
    • postPortalIgniteEvent

      @AvailableSince("1.0.0") public CustomPortalBuilder postPortalIgniteEvent(BiConsumer<net.minecraft.core.BlockPos, PortalIgnitionSource> event)
      Register an event to be called after the portal is ignited.
      Parameters:
      event - A consumer that accepts a BlockPos and PortalIgnitionSource
    • travelSound

      @AvailableSince("1.0.0") public CustomPortalBuilder travelSound(net.minecraft.resources.Identifier travelSoundLocation, Function<net.minecraft.world.entity.Entity, Float> travelSoundVolume, Function<net.minecraft.world.entity.Entity, Float> travelSoundPitch)
      Set the sound to be played when the player travels through the portal. Volume and pitch are accepted as functions to allow for dynamic values.
      Parameters:
      travelSoundLocation - Identifier of the sound to be played
      travelSoundVolume - Volume of the sound
      travelSoundPitch - Pitch of the sound
    • triggerSound

      @AvailableSince("1.0.0") public CustomPortalBuilder triggerSound(net.minecraft.resources.Identifier triggerSoundLocation, Function<net.minecraft.world.entity.Entity, Float> triggerSoundVolume, Function<net.minecraft.world.entity.Entity, Float> triggerSoundPitch)
      Set the sound to be played when the player travels through the portal. Volume and pitch are accepted as functions to allow for dynamic values.
      Parameters:
      triggerSoundLocation - Identifier of the sound to be played
      triggerSoundVolume - Volume of the sound
      triggerSoundPitch - Pitch of the sound
    • ambientSound

      @AvailableSince("1.0.0") public CustomPortalBuilder ambientSound(net.minecraft.resources.Identifier ambientSoundLocation, Function<net.minecraft.world.level.Level, Float> ambientSoundVolume, Function<net.minecraft.world.level.Level, Float> ambientSoundPitch)
      Set the sound to be played randomly while nearby the portal.
      Parameters:
      ambientSoundLocation - Identifier of the sound to be played
      ambientSoundVolume - Volume of the sound
      ambientSoundPitch - Pitch of the sound
    • portalParticle

      @AvailableSince("1.0.0") public CustomPortalBuilder portalParticle(BiFunction<net.minecraft.world.level.Level, net.minecraft.core.BlockPos, net.minecraft.core.particles.ParticleOptions> particleFunction)
      Set a custom portal particle effect.
      Parameters:
      particleFunction - A function that accepts a Level and BlockPos and returns a ParticleOptions