Class ElevatorEvent
java.lang.Object
net.neoforged.bus.api.Event
com.pixelmonmod.pixelmon.api.events.ElevatorEvent
- Direct Known Subclasses:
ElevatorEvent.Post,ElevatorEvent.Pre
public class ElevatorEvent
extends net.neoforged.bus.api.Event
Event fired when a Pixelmon elevator block is used in either direction
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFired after the player has been teleportedstatic classFired before the player is teleported Cancelling this event will stop the player from being teleported -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected net.minecraft.world.phys.Vec3protected final booleanprotected final net.minecraft.server.level.ServerPlayerprotected net.minecraft.core.BlockPos -
Constructor Summary
ConstructorsConstructorDescriptionElevatorEvent(net.minecraft.server.level.ServerPlayer player, boolean goingUp, net.minecraft.core.BlockPos targetElevator, net.minecraft.world.phys.Vec3 destination) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.phys.Vec3Gets the currently selected destination for the player.net.minecraft.server.level.ServerPlayerGets the player taking the blocknet.minecraft.core.BlockPosGets location of the target elevator block.booleanIf the player is going up or downvoidsetDestination(net.minecraft.world.phys.Vec3 destination) Sets the destination block position.
-
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()andsetDestination(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
-