Class TeleportItemEvent

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

public class TeleportItemEvent extends net.neoforged.bus.api.Event
TeleportItemEvent is called when a TeleportItem is used, namely for things like Escape Rope, and the Ultra space and Drowned world teleporters
  • 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.