Interface IMapDisplay

All Superinterfaces:
IDisplay

public interface IMapDisplay extends IDisplay
A map display which creates packet-level item frame displays with a custom width and height.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.util.BoundingBox
    box()
     
    void
    Clones the map ids from the given display.
    This can be used to "clone" the content of a display to another display.
    default void
    Consumes all frames of this display with a consumer.
    The arguments provided to the specified consumer are immutable.
    void
    Cuts off the clone group ids.

    After cutting off the ids, it's necessary to call mapId(Player, int) for all players to update the map ids.
    void
    despawn(org.bukkit.entity.Player player)
    Removes the map display for the given player.
    void
    Destroys the display and internal related resources.
    org.bukkit.block.BlockFace
     
    default IFrame
    frameAt(int x, int y)
    Returns the frame at the given x and y position.
    Returns the frames of this display in a flattened 2d array.
    boolean
     
    void
    glowing(boolean glowing)
    Use glowing item frames or normal item frames.
    int
     
    double
     
    void
    interactDistance(double interactDistance)
    Sets the distance at which the player can interact with the map display.
    The default distance is at 6 blocks.
    void
    itemRotation(org.bukkit.entity.Player player, @org.jetbrains.annotations.Range(from=0L, to=7L) int rotation)
    Sets the item rotation of the item frame.
    void
    mapId(org.bukkit.entity.Player player, int z)
    Sets the z-layer map id group for the player.
    void
    rotation(org.bukkit.entity.Player player, float yaw, float pitch)
    Sets the entity rotation of the item frame.

    Warning: This breaks the visual click detection of the item frame.
    default void
    spawn(org.bukkit.entity.Player player)
    Spawns the map display for the given player at z-index 0.
    void
    spawn(org.bukkit.entity.Player player, int z)
    Spawns the map display for the given player at the given z-index.
    org.bukkit.block.BlockFace
     
    void
    visualDirection(org.bukkit.entity.Player player, org.bukkit.block.BlockFace visualDirection)
    Sets the visual direction of the item frame, by respawning them

    Warning: This breaks the visual click detection of the item frame.
    void
    visualDirection(org.bukkit.entity.Player player, org.bukkit.block.BlockFace visualDirection, int z)
    Sets the visual direction of the item frame, by respawning them

    Warning: This breaks the visual click detection of the item frame.
    int
     

    Methods inherited from interface de.pianoman911.mapengine.api.clientside.IDisplay

    pipeline, pixelHeight, pixelWidth
  • Method Details

    • destroy

      void destroy()
      Destroys the display and internal related resources. You should call despawn(Player) for all players after calling this method.
      WARNING: This method should be called when the display is no longer needed. It is not guaranteed that a display will work correctly after this method is called.
      Specified by:
      destroy in interface IDisplay
    • width

      int width()
      Returns:
      the display width (in blocks)
    • height

      int height()
      Returns:
      the display height (in blocks)
    • box

      org.bukkit.util.BoundingBox box()
      Returns:
      2d-box of where the map displays are attached
      See Also:
    • direction

      org.bukkit.block.BlockFace direction()
      Returns:
      where the box() is facing at
    • visualDirection

      org.bukkit.block.BlockFace visualDirection()
      Returns:
      the direction at which the maps face
    • interactDistance

      double interactDistance()
      Returns:
      the distance at which the player can interact with the map display
    • interactDistance

      void interactDistance(double interactDistance)
      Sets the distance at which the player can interact with the map display.
      The default distance is at 6 blocks.

      WARNING: Distances above 6 (creative) or 3 (other gamemodes) are only detected by an attacking (left-click) interaction.

      Parameters:
      interactDistance - the distance at which the player can interact with the map display
    • spawn

      default void spawn(org.bukkit.entity.Player player)
      Spawns the map display for the given player at z-index 0.
      Parameters:
      player - the player who should receive the map display
    • spawn

      void spawn(org.bukkit.entity.Player player, int z)
      Spawns the map display for the given player at the given z-index.
      Parameters:
      player - the player who should receive the map display
      z - the z-index of the map content to spawn
    • despawn

      void despawn(org.bukkit.entity.Player player)
      Removes the map display for the given player.
      Parameters:
      player - the player who should not see the map display any longer
    • mapId

      void mapId(org.bukkit.entity.Player player, int z)
      Sets the z-layer map id group for the player.

      Z-Layering is a feature that allows you to send different map content for the same map display.
      When changing the z-index for a specific player, the only thing which changes is the map ids. This results in no additional data being required to be sent to the player and allows for animations to animate smoothly, even with poor internet connection.

      Parameters:
      player - the player to set the z-layer map id group for
      z - the z-layer map id group
    • rotation

      void rotation(org.bukkit.entity.Player player, float yaw, float pitch)
      Sets the entity rotation of the item frame.

      Warning: This breaks the visual click detection of the item frame.
      Parameters:
      player - the player to set the rotation for
    • itemRotation

      void itemRotation(org.bukkit.entity.Player player, @org.jetbrains.annotations.Range(from=0L, to=7L) int rotation)
      Sets the item rotation of the item frame. It's like right-clicking the item frame.

      Warning: This breaks the visual click detection of the item frame.
      Parameters:
      player - the player to set the rotation for
      rotation - the rotation (0-7)
    • visualDirection

      void visualDirection(org.bukkit.entity.Player player, org.bukkit.block.BlockFace visualDirection)
      Sets the visual direction of the item frame, by respawning them

      Warning: This breaks the visual click detection of the item frame.
      Parameters:
      player - the player to set the visual direction for
      visualDirection - the visual direction
    • visualDirection

      void visualDirection(org.bukkit.entity.Player player, org.bukkit.block.BlockFace visualDirection, int z)
      Sets the visual direction of the item frame, by respawning them

      Warning: This breaks the visual click detection of the item frame.
      Parameters:
      player - the player to set the visual direction for
      visualDirection - the visual direction
      z - the z-layer map id group
    • glowing

      boolean glowing()
      Returns:
      whether the item frame is glowing
    • glowing

      void glowing(boolean glowing)
      Use glowing item frames or normal item frames. MapEngine default is to use glowing item frames.
      Parameters:
      glowing - whether the item frame should glow
    • cloneGroupIds

      void cloneGroupIds(IMapDisplay source)
      Clones the map ids from the given display.
      This can be used to "clone" the content of a display to another display. This process will save traffic by only sending the content once.
      The cloning is active until cutOffCloneGroupIds() is called.

      This display must have the same dimensions as the target display. After cloning the ids, it's necessary to call mapId(Player, int) for all players to update the map ids.
      Parameters:
      source - the display to clone the group ids from
    • cutOffCloneGroupIds

      void cutOffCloneGroupIds()
      Cuts off the clone group ids.

      After cutting off the ids, it's necessary to call mapId(Player, int) for all players to update the map ids.
    • frames

      IFrame[] frames()
      Returns the frames of this display in a flattened 2d array. Frames are ordered from left to right, top to bottom.

      x = 0 ∧ y = 0 is positioned at the top left. The index of this is 0.

      Use frameAt(int, int) to easily get a specific frame of this display.

      Returns:
      the frames of this display
      See Also:
    • frameAt

      default IFrame frameAt(int x, int y)
      Returns the frame at the given x and y position.
      Parameters:
      x - the x position
      y - the y position
      Returns:
      the frame at the given position
      Throws:
      ArrayIndexOutOfBoundsException - if the x or y position is out of bounds
    • consumeFrames

      default void consumeFrames(BiConsumer<IFrame,Vec2i> consumer)
      Consumes all frames of this display with a consumer.
      The arguments provided to the specified consumer are immutable.
      Parameters:
      consumer - the consumer to consume the frames