Class TeleportItemEvent.Pre
java.lang.Object
net.neoforged.bus.api.Event
com.pixelmonmod.pixelmon.api.events.TeleportItemEvent
com.pixelmonmod.pixelmon.api.events.TeleportItemEvent.Pre
- All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
- Enclosing class:
TeleportItemEvent
public static class TeleportItemEvent.Pre
extends TeleportItemEvent
implements net.neoforged.bus.api.ICancellableEvent
Fired before the teleport occurs, Level, Position and if the item is consumed can be set here to modify where the item teleports the player.
Canceling the event prevents the teleport from occurring, and prevents the item from being consumed.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.pixelmonmod.pixelmon.api.events.TeleportItemEvent
TeleportItemEvent.Post, TeleportItemEvent.Pre
-
Field Summary
Fields inherited from class com.pixelmonmod.pixelmon.api.events.TeleportItemEvent
consumeItemStack, itemStack, level, player, teleportPosition, teleportToSpawnpoint
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
setConsumeItem
(boolean consumeItemStack) void
void
setTeleportPosition
(net.minecraft.core.BlockPos teleportPosition) void
setTeleportToSpawnpoint
(boolean teleportToSpawnpoint) Methods inherited from class com.pixelmonmod.pixelmon.api.events.TeleportItemEvent
getActualLevel, getItemStack, getLevel, getPlayer, getTeleportPosition, shouldConsumeItemStack, shouldTeleportToSpawnpoint
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Constructor Details
-
Pre
public Pre(net.minecraft.world.item.ItemStack item, net.minecraft.world.entity.player.Player player, String level, net.minecraft.core.BlockPos teleportPosition, boolean consumeItemStack, boolean teleportToSpawnpoint)
-
-
Method Details
-
setLevel
- Parameters:
level
- - The level you would like the player to teleport to
-
setTeleportPosition
public void setTeleportPosition(net.minecraft.core.BlockPos teleportPosition) - Parameters:
teleportPosition
- - The Blockpos to teleport the player to
-
setConsumeItem
public void setConsumeItem(boolean consumeItemStack) - Parameters:
consumeItemStack
- - If the item should be consumeed on use
-
setTeleportToSpawnpoint
public void setTeleportToSpawnpoint(boolean teleportToSpawnpoint) - Parameters:
teleportToSpawnpoint
- - If the location should be overriden and the item should teleport a user to their spawnpoint
-