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 TypeMethodDescriptionstatic voidensureType(@NotNull org.bukkit.entity.EntityType actual, @NotNull org.bukkit.entity.EntityType required) voidsetAlignment(org.bukkit.entity.TextDisplay.TextAlignment alignment) Sets the text alignment.voidsetBackgroundColor(@Nullable org.bukkit.Color color) Sets the background color behind the text.voidsetBillboard(org.bukkit.entity.Display.Billboard billboard) Sets the billboard mode, controlling which axes the display pivots on to face the viewer.voidsetBlock(@NotNull org.bukkit.block.data.BlockData block) Sets the block shown by this display.voidsetBrightness(org.bukkit.entity.Display.Brightness brightness) Sets the brightness override (block light + sky light).voidsetDefaultBackground(boolean defaultBackground) Sets whether the text uses the default background color (overridingsetBackgroundColor(Color)).voidsetDisplayHeight(float height) Sets the height of the display's culling bounding box.voidsetDisplayWidth(float width) Sets the width of the display's culling bounding box.voidsetGlowColorOverride(@Nullable org.bukkit.Color color) Sets the glow color override used when the entity is glowing (seeFakeEntity.setGlowing(boolean)).voidsetInterpolationDelay(int ticks) Sets the delay (in ticks) before a transformation interpolation begins.voidsetInterpolationDuration(int ticks) Sets the duration (in ticks) over whichsetTransformation(Transformation)changes are interpolated.voidsetItem(@Nullable org.bukkit.inventory.ItemStack item) Sets the item shown by this display.voidsetItemDisplayTransform(org.bukkit.entity.ItemDisplay.ItemDisplayTransform transform) Sets the transform context (e.g.voidsetLineWidth(int width) Sets the maximum line width before text wraps.voidsetSeeThrough(boolean seeThrough) Sets whether the text is visible through blocks.voidsetShadowed(boolean shadowed) Sets whether the text has a drop shadow.voidsetShadowRadius(float radius) Sets the radius of the shadow rendered beneath the display.voidsetShadowStrength(float strength) Sets the strength (opacity falloff) of the shadow rendered beneath the display.voidsetTeleportDuration(int ticks) Sets the duration (in ticks) over which position changes (move/teleport packets) are interpolated client-side.voidsetText(@NotNull net.kyori.adventure.text.Component text) Sets the text shown by this display.voidsetTextOpacity(byte opacity) Sets the opacity of the text (-1for fully opaque, otherwise0-255).voidsetTransformation(@NotNull org.bukkit.util.Transformation transformation) Sets the affine transformation applied to this display: translation, scale, and the left/right rotation quaternions.voidsetViewRange(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 anIllegalStateExceptionunlessactualmatchesrequired. 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.Transformationis composed of JOML types (Vector3f,Quaternionf), so a JOMLMatrix4fcan 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 whichsetTransformation(Transformation)changes are interpolated. Use0to 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. Use0to 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). Usenullto 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 of1.0is 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. Use0for 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. Use0to disable culling.- Parameters:
width- The culling box width.
-
setDisplayHeight
void setDisplayHeight(float height) Sets the height of the display's culling bounding box. Use0to 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 (seeFakeEntity.setGlowing(boolean)). Usenullto 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 forEntityType.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 forEntityType.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 forEntityType.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 forEntityType.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 forEntityType.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. Usenullfor the default background. Only valid forEntityType.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 (-1for fully opaque, otherwise0-255). Only valid forEntityType.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 forEntityType.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 forEntityType.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 forEntityType.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 (overridingsetBackgroundColor(Color)). Only valid forEntityType.TEXT_DISPLAY.- Parameters:
defaultBackground- true to use the default background.- Throws:
IllegalStateException- If this is not a text display.
-