Class ElevatorEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
com.pixelmonmod.pixelmon.api.events.ElevatorEvent
Direct Known Subclasses:
ElevatorEvent.Post, ElevatorEvent.Pre

public class ElevatorEvent extends net.minecraftforge.eventbus.api.Event
Event fired when a Pixelmon elevator block is used in either direction
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Fired after the player has been teleported
    static class 
    Fired before the player is teleported Cancelling this event will stop the player from being teleported

    Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event

    net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected net.minecraft.world.phys.Vec3
     
    protected final boolean
     
    protected final net.minecraft.server.level.ServerPlayer
     
    protected net.minecraft.core.BlockPos
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ElevatorEvent(net.minecraft.server.level.ServerPlayer player, boolean goingUp, net.minecraft.core.BlockPos targetElevator, net.minecraft.world.phys.Vec3 destination)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.phys.Vec3
    Gets the currently selected destination for the player.
    net.minecraft.server.level.ServerPlayer
    Gets the player taking the block
    net.minecraft.core.BlockPos
    Gets location of the target elevator block.
    boolean
    If the player is going up or down
    void
    setDestination(net.minecraft.world.phys.Vec3 destination)
    Sets the destination block position.

    Methods inherited from class net.minecraftforge.eventbus.api.Event

    getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • player

      protected final net.minecraft.server.level.ServerPlayer player
    • goingUp

      protected final boolean goingUp
    • targetElevator

      protected net.minecraft.core.BlockPos targetElevator
    • destination

      protected net.minecraft.world.phys.Vec3 destination
  • Constructor Details

    • ElevatorEvent

      public ElevatorEvent(net.minecraft.server.level.ServerPlayer player, boolean goingUp, net.minecraft.core.BlockPos targetElevator, net.minecraft.world.phys.Vec3 destination)
  • Method Details

    • getDestination

      @Nullable public net.minecraft.world.phys.Vec3 getDestination()
      Gets the currently selected destination for the player. This defaults to above the elevator block in the direction of the origin
      Returns:
      The teleport destination or null if no elevator was found in the given direction and search range.
    • getTargetElevatorPos

      @Nullable public net.minecraft.core.BlockPos getTargetElevatorPos()
      Gets location of the target elevator block. Only for informational purposes. getDestination() and setDestination(Vec3) should be used to determine where the player will be teleported.
      Returns:
      The block position of the target elevator or null if none was found in the given direction and search range.
    • setDestination

      public void setDestination(@Nullable net.minecraft.world.phys.Vec3 destination)
      Sets the destination block position. This does not need to be an elevator block Setting it to null will cancel the teleport
      Parameters:
      destination - The new destination
    • getPlayer

      public net.minecraft.server.level.ServerPlayer getPlayer()
      Gets the player taking the block
      Returns:
      The player takign the elevator
    • isGoingUp

      public boolean isGoingUp()
      If the player is going up or down
      Returns:
      True if going up