Class TeleportItemEvent.Pre
java.lang.Object
net.minecraftforge.eventbus.api.Event
com.pixelmonmod.pixelmon.api.events.TeleportItemEvent
com.pixelmonmod.pixelmon.api.events.TeleportItemEvent.Pre
- Enclosing class:
- TeleportItemEvent
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
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 inherited from class com.pixelmonmod.pixelmon.api.events.TeleportItemEvent
consumeItemStack, itemStack, level, player, teleportPosition, teleportToSpawnpoint
-
Constructor Summary
-
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 net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
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
-