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
Modifier and TypeClassDescriptionstatic class
Fired after the player has been teleportedstatic class
Fired before the player is teleported Cancelling this event will stop the player from being teleportedNested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
Field Summary
Modifier and TypeFieldDescriptionprotected net.minecraft.world.phys.Vec3
protected final boolean
protected final net.minecraft.server.level.ServerPlayer
protected net.minecraft.core.BlockPos
-
Constructor Summary
ConstructorDescriptionElevatorEvent
(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.Vec3
Gets the currently selected destination for the player.net.minecraft.server.level.ServerPlayer
Gets the player taking the blocknet.minecraft.core.BlockPos
Gets location of the target elevator block.boolean
If the player is going up or downvoid
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
-
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
-