A Minecraft library for rendering geometric shapes using TextDisplay entities. Supports both direct Bukkit entity manipulation and packet-based rendering via EntityLib.
- Multiple Shape Types: Triangle, Line, Polyline, Parallelogram
- Two Rendering Modes:
- Bukkit Mode: Direct entity manipulation, visible to all players
- Packet Mode: EntityLib-based, only visible to specified viewers
- Customizable: Color, brightness, transparency, double-sided rendering
- Line Roll Angle: Rotate lines around their length axis for visibility from any angle
<repository>
<id>twme-repo-snapshots</id>
<name>TWME Repository</name>
<url>https://repo.twme.dev/snapshots</url>
</repository><dependency>
<groupId>dev.twme</groupId>
<artifactId>TextDisplayShape</artifactId>
<version>1.0.6</version>
</dependency>Note: When providing a
Locationas the origin, please avoid including the pitch and yaw (set them to 0). Passing a location with rotation data (e.g.,player.getLocation()) may cause unexpected behavior in shape orientation.
// Triangle
Shape triangle = TextDisplayShapes.bukkit()
.triangle(spawnLocation, p1, p2, p3)
.color(Color.fromARGB(150, 50, 100, 100))
.doubleSided(true)
.build();
triangle.spawn();
// Line
Shape line = TextDisplayShapes.bukkit()
.line(spawnLocation, p1, p2, 0.1f)
.rollDegrees(90f) // Rotate for visibility from different angles
.doubleSided(true)
.build();
line.spawn();
// Polyline (connected line segments)
List<Vector3f> points = Arrays.asList(
new Vector3f(0, 0, 0),
new Vector3f(5, 0, 0),
new Vector3f(5, 5, 0),
new Vector3f(0, 5, 0)
);
Shape polyline = TextDisplayShapes.bukkit()
.polyline(spawnLocation, points, 0.1f)
.closed(true) // Connect last point to first
.build();
polyline.spawn();
// Parallelogram
Shape parallelogram = TextDisplayShapes.bukkit()
.parallelogram(spawnLocation, p1, p2, p3)
.build();
parallelogram.spawn();
// Remove shape
triangle.remove();Requires EntityLib and PacketEvents.
// Initialize EntityLib first
SpigotEntityLibPlatform platform = new SpigotEntityLibPlatform(plugin);
APIConfig settings = new APIConfig(PacketEvents.getAPI())
.tickTickables()
.trackPlatformEntities();
EntityLib.init(platform, settings);
// Create shape
Shape line = TextDisplayShapes.packet()
.line(spawnLocation, p1, p2, 0.1f)
.color(Color.RED)
.build();
// Add viewers (only these players will see the shape)
line.addViewer(player);
line.spawn();
// Remove viewer
line.removeViewer(player);
// Remove shape
line.remove();| Method | Description |
|---|---|
spawn() |
Spawn the shape into the world |
remove() |
Remove the shape from the world |
isSpawned() |
Check if the shape is spawned |
addViewer(Player) |
Add a viewer (packet mode only) |
removeViewer(Player) |
Remove a viewer (packet mode only) |
getViewers() |
Get all viewers |
getEntityUUIDs() |
Get UUIDs of all entities in this shape |
getEntities() |
Get all entity instances |
| Method | Description |
|---|---|
.color(Color) |
Set background color (ARGB) |
.doubleSided(boolean) |
Enable double-sided rendering |
.brightness(int block, int sky) |
Set brightness (0-15) |
.seeThrough(boolean) |
Make visible through blocks |
.roll(float) |
Line roll angle in radians |
.rollDegrees(float) |
Line roll angle in degrees |
.closed(boolean) |
Close polyline (connect last to first) |
You can find the JavaDoc here.
- Spigot/Paper 1.21+
- PacketEvents (for packet mode)
- EntityLib (for packet mode)
Apache License Version 2.0