Class TeleportItemEvent

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

public class TeleportItemEvent extends net.minecraftforge.eventbus.api.Event
TeleportItemEvent is called when a TeleportItem is used, namely for things like Escape Rope, and the Ultra space and Drowned world teleporters
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Fired after the player has been teleported using an item
    static class 
    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.

    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 boolean
     
    protected net.minecraft.world.item.ItemStack
     
    protected String
     
    protected net.minecraft.world.entity.player.Player
     
    protected net.minecraft.core.BlockPos
     
    protected boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    TeleportItemEvent(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 Summary

    Modifier and Type
    Method
    Description
    Optional<net.minecraft.server.level.ServerLevel>
     
    net.minecraft.world.item.ItemStack
     
     
    net.minecraft.world.entity.player.Player
     
    net.minecraft.core.BlockPos
     
    boolean
     
    boolean
     

    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

    • itemStack

      protected net.minecraft.world.item.ItemStack itemStack
    • player

      protected net.minecraft.world.entity.player.Player player
    • level

      protected String level
    • teleportPosition

      protected net.minecraft.core.BlockPos teleportPosition
    • consumeItemStack

      protected boolean consumeItemStack
    • teleportToSpawnpoint

      protected boolean teleportToSpawnpoint
  • Constructor Details

    • TeleportItemEvent

      public TeleportItemEvent(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

    • getItemStack

      public net.minecraft.world.item.ItemStack getItemStack()
      Returns:
      The itemstack causing the teleport
    • getPlayer

      public net.minecraft.world.entity.player.Player getPlayer()
      Returns:
      The player trying to be teleported
    • getLevel

      public String getLevel()
      Returns:
      The level the player is being teleported to
    • getActualLevel

      public Optional<net.minecraft.server.level.ServerLevel> getActualLevel()
      Returns:
      The actual level the player is being teleported to.
    • getTeleportPosition

      public net.minecraft.core.BlockPos getTeleportPosition()
      Returns:
      The position in the world the player is being teleported to
    • shouldConsumeItemStack

      public boolean shouldConsumeItemStack()
      Returns:
      If the itemstack should be consumed on use
    • shouldTeleportToSpawnpoint

      public boolean shouldTeleportToSpawnpoint()
      Returns:
      If the player should be teleported to their spawnpoint instead - Overrides any position or world arguments.