Interface FakeDisplayEntity


public interface FakeDisplayEntity
The packet based display entity API (EntityType.BLOCK_DISPLAY, EntityType.ITEM_DISPLAY, or EntityType.TEXT_DISPLAY).

After modifying any of the properties defined here, you must call FakeEntity.updateMeta() to flush the changes to viewers.

The type-specific methods (setBlock, setItem*, setText*) throw an IllegalStateException when called on a display entity of the wrong type.

  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    ensureType(@NotNull org.bukkit.entity.EntityType actual, @NotNull org.bukkit.entity.EntityType required)
    Throws an IllegalStateException unless actual matches required.
    void
    setAlignment(org.bukkit.entity.TextDisplay.TextAlignment alignment)
    Sets the text alignment.
    void
    setBackgroundColor(@Nullable org.bukkit.Color color)
    Sets the background color behind the text.
    void
    setBillboard(org.bukkit.entity.Display.Billboard billboard)
    Sets the billboard mode, controlling which axes the display pivots on to face the viewer.
    void
    setBlock(@NotNull org.bukkit.block.data.BlockData block)
    Sets the block shown by this display.
    void
    setBrightness(org.bukkit.entity.Display.Brightness brightness)
    Sets the brightness override (block light + sky light).
    void
    setDefaultBackground(boolean defaultBackground)
    Sets whether the text uses the default background color (overriding setBackgroundColor(Color)).
    void
    setDisplayHeight(float height)
    Sets the height of the display's culling bounding box.
    void
    setDisplayWidth(float width)
    Sets the width of the display's culling bounding box.
    void
    setGlowColorOverride(@Nullable org.bukkit.Color color)
    Sets the glow color override used when the entity is glowing (see FakeEntity.setGlowing(boolean)).
    void
    Sets the delay (in ticks) before a transformation interpolation begins.
    void
    Sets the duration (in ticks) over which setTransformation(Transformation) changes are interpolated.
    void
    setItem(@Nullable org.bukkit.inventory.ItemStack item)
    Sets the item shown by this display.
    void
    setItemDisplayTransform(org.bukkit.entity.ItemDisplay.ItemDisplayTransform transform)
    Sets the transform context (e.g.
    void
    setLineWidth(int width)
    Sets the maximum line width before text wraps.
    void
    setSeeThrough(boolean seeThrough)
    Sets whether the text is visible through blocks.
    void
    setShadowed(boolean shadowed)
    Sets whether the text has a drop shadow.
    void
    setShadowRadius(float radius)
    Sets the radius of the shadow rendered beneath the display.
    void
    setShadowStrength(float strength)
    Sets the strength (opacity falloff) of the shadow rendered beneath the display.
    void
    Sets the duration (in ticks) over which position changes (move/teleport packets) are interpolated client-side.
    void
    setText(@NotNull net.kyori.adventure.text.Component text)
    Sets the text shown by this display.
    void
    setTextOpacity(byte opacity)
    Sets the opacity of the text (-1 for fully opaque, otherwise 0-255).
    void
    setTransformation(@NotNull org.bukkit.util.Transformation transformation)
    Sets the affine transformation applied to this display: translation, scale, and the left/right rotation quaternions.
    void
    setViewRange(float range)
    Sets the view range multiplier.
  • Method Details

    • ensureType

      static void ensureType(@NotNull @NotNull org.bukkit.entity.EntityType actual, @NotNull @NotNull org.bukkit.entity.EntityType required)
      Throws an IllegalStateException unless actual matches required. Intended for implementations to guard type-specific methods.
      Parameters:
      actual - The entity's actual type.
      required - The type required to call the method.
    • setTransformation

      void setTransformation(@NotNull @NotNull org.bukkit.util.Transformation transformation)
      Sets the affine transformation applied to this display: translation, scale, and the left/right rotation quaternions. This is the "display matrix" used to position, scale, and rotate the rendered block/item/text relative to the entity's location.

      Transformation is composed of JOML types (Vector3f, Quaternionf), so a JOML Matrix4f can be decomposed and passed in directly for arbitrary matrix transformations.

      Parameters:
      transformation - The non-null transformation.
    • setInterpolationDuration

      void setInterpolationDuration(int ticks)
      Sets the duration (in ticks) over which setTransformation(Transformation) changes are interpolated. Use 0 to apply transformations instantly.
      Parameters:
      ticks - The interpolation duration in ticks.
    • setInterpolationDelay

      void setInterpolationDelay(int ticks)
      Sets the delay (in ticks) before a transformation interpolation begins.
      Parameters:
      ticks - The interpolation delay in ticks.
    • setTeleportDuration

      void setTeleportDuration(int ticks)
      Sets the duration (in ticks) over which position changes (move/teleport packets) are interpolated client-side. Use 0 to disable position interpolation.
      Parameters:
      ticks - The teleport duration in ticks.
    • setBillboard

      void setBillboard(@NotNull org.bukkit.entity.Display.Billboard billboard)
      Sets the billboard mode, controlling which axes the display pivots on to face the viewer.
      Parameters:
      billboard - The non-null billboard mode.
    • setBrightness

      void setBrightness(@Nullable org.bukkit.entity.Display.Brightness brightness)
      Sets the brightness override (block light + sky light). Use null to let the display use the brightness of the block it occupies.
      Parameters:
      brightness - The nullable brightness override.
    • setViewRange

      void setViewRange(float range)
      Sets the view range multiplier. A value of 1.0 is the default range; larger values make the display visible from further away.
      Parameters:
      range - The view range multiplier.
    • setShadowRadius

      void setShadowRadius(float radius)
      Sets the radius of the shadow rendered beneath the display. Use 0 for no shadow.
      Parameters:
      radius - The shadow radius.
    • setShadowStrength

      void setShadowStrength(float strength)
      Sets the strength (opacity falloff) of the shadow rendered beneath the display.
      Parameters:
      strength - The shadow strength.
    • setDisplayWidth

      void setDisplayWidth(float width)
      Sets the width of the display's culling bounding box. Use 0 to disable culling.
      Parameters:
      width - The culling box width.
    • setDisplayHeight

      void setDisplayHeight(float height)
      Sets the height of the display's culling bounding box. Use 0 to disable culling.
      Parameters:
      height - The culling box height.
    • setGlowColorOverride

      void setGlowColorOverride(@Nullable @Nullable org.bukkit.Color color)
      Sets the glow color override used when the entity is glowing (see FakeEntity.setGlowing(boolean)). Use null to use the default team-based color.
      Parameters:
      color - The nullable glow color override.
    • setBlock

      void setBlock(@NotNull @NotNull org.bukkit.block.data.BlockData block)
      Sets the block shown by this display. Only valid for EntityType.BLOCK_DISPLAY.
      Parameters:
      block - The non-null block data.
      Throws:
      IllegalStateException - If this is not a block display.
    • setItem

      void setItem(@Nullable @Nullable org.bukkit.inventory.ItemStack item)
      Sets the item shown by this display. Only valid for EntityType.ITEM_DISPLAY.
      Parameters:
      item - The nullable item stack.
      Throws:
      IllegalStateException - If this is not an item display.
    • setItemDisplayTransform

      void setItemDisplayTransform(@NotNull org.bukkit.entity.ItemDisplay.ItemDisplayTransform transform)
      Sets the transform context (e.g. GUI, FIXED, THIRD_PERSON_LEFT_HAND) used to render the item. Only valid for EntityType.ITEM_DISPLAY.
      Parameters:
      transform - The non-null item display transform.
      Throws:
      IllegalStateException - If this is not an item display.
    • setText

      void setText(@NotNull @NotNull net.kyori.adventure.text.Component text)
      Sets the text shown by this display. Only valid for EntityType.TEXT_DISPLAY.
      Parameters:
      text - The non-null text component.
      Throws:
      IllegalStateException - If this is not a text display.
    • setLineWidth

      void setLineWidth(int width)
      Sets the maximum line width before text wraps. Only valid for EntityType.TEXT_DISPLAY.
      Parameters:
      width - The line width.
      Throws:
      IllegalStateException - If this is not a text display.
    • setBackgroundColor

      void setBackgroundColor(@Nullable @Nullable org.bukkit.Color color)
      Sets the background color behind the text. Use null for the default background. Only valid for EntityType.TEXT_DISPLAY.
      Parameters:
      color - The nullable background color.
      Throws:
      IllegalStateException - If this is not a text display.
    • setTextOpacity

      void setTextOpacity(byte opacity)
      Sets the opacity of the text (-1 for fully opaque, otherwise 0-255). Only valid for EntityType.TEXT_DISPLAY.
      Parameters:
      opacity - The text opacity.
      Throws:
      IllegalStateException - If this is not a text display.
    • setAlignment

      void setAlignment(@NotNull org.bukkit.entity.TextDisplay.TextAlignment alignment)
      Sets the text alignment. Only valid for EntityType.TEXT_DISPLAY.
      Parameters:
      alignment - The non-null text alignment.
      Throws:
      IllegalStateException - If this is not a text display.
    • setSeeThrough

      void setSeeThrough(boolean seeThrough)
      Sets whether the text is visible through blocks. Only valid for EntityType.TEXT_DISPLAY.
      Parameters:
      seeThrough - true to render through blocks.
      Throws:
      IllegalStateException - If this is not a text display.
    • setShadowed

      void setShadowed(boolean shadowed)
      Sets whether the text has a drop shadow. Only valid for EntityType.TEXT_DISPLAY.
      Parameters:
      shadowed - true to render a drop shadow.
      Throws:
      IllegalStateException - If this is not a text display.
    • setDefaultBackground

      void setDefaultBackground(boolean defaultBackground)
      Sets whether the text uses the default background color (overriding setBackgroundColor(Color)). Only valid for EntityType.TEXT_DISPLAY.
      Parameters:
      defaultBackground - true to use the default background.
      Throws:
      IllegalStateException - If this is not a text display.