Download the PHP package kostamax27/debugdraw without Composer
On this page you can find all versions of the php package kostamax27/debugdraw. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package debugdraw
DebugDraw
Draw lines, boxes, spheres, arrows, text and other shapes on the client from a PocketMine-MP plugin.
Usage
draw() returns a DrawnShape<T> where T is the class you passed in, so $box->shape is a BoxShape and
$box->update(new LineShape(...)) fails static analysis. drawAll(), removeAll() and clear() send one packet
for the whole list. The viewer is dropped when the player quits.
Shapes
Namespace kostamax27\debugdraw\shape. Every class is final readonly, validates its arguments in the constructor and
takes an optional trailing ?ShapeStyle $style = null.
| Class | Constructor | |
|---|---|---|
LineShape |
(Vector3 $location, Vector3 $end) |
|
BoxShape |
(Vector3 $location, Vector3 $bound) |
min corner and size |
SphereShape |
(Vector3 $location, int $segments = 20) |
|
CircleShape |
(Vector3 $location, int $segments = 20) |
|
TextShape |
(Vector3 $location, string $text, bool $use_rotation = false, ?Color $background_color = null, float $line_gap_height = 0.0, bool $depth_test = true, bool $show_backface = true, bool $show_text_backface = true) |
|
ArrowShape |
(Vector3 $location, Vector3 $end, ?float $head_length = null, ?float $head_radius = null, ?int $segments = null) |
|
CylinderShape |
(Vector3 $location, Vector2 $radius_x, Vector2 $radius_z, float $height, int $segments = 20) |
|
PyramidShape |
(Vector3 $location, float $width, float $height, ?float $depth = null) |
|
EllipsoidShape |
(Vector3 $location, Vector3 $radii, int $segments_per_axis = 20) |
|
ConeShape |
(Vector3 $location, Vector2 $radii, float $height, int $segments = 20) |
Options shared by all shapes live in ShapeStyle: scale (default 1), rotation, duration (seconds, client
removes the shape itself), max_render_distance, color (default white), dimension_id (DimensionIds::*,
default overworld), attached_entity_id (runtime id). location is the centre of a shape, except for LineShape and ArrowShape where it is the start point and
BoxShape where it is the min corner. The
client hides a shape once the player is further from its location than its render distance; max_render_distance
can only lower that limit, not raise it, so a long line has to be split into segments to stay visible along its
whole length. Each shape has withScale(), withRotation(), withDuration(), withMaxRenderDistance(), withColor(),
withDimension(), attachedTo() and withStyle(), all returning a new instance of the same class.
Broadcasting
Examples
1. Chunk borders (F3 + G)
Chunk borders as drawn by Minecraft: Java Edition (F3 + G, ChunkBorderRenderer). Red lines mark the corners of the
neighbouring chunks, yellow and cyan lines split the current chunk every 2 and 4 blocks, blue lines mark the chunk
corners and every subchunk, and the subchunk the player stands in is boxed. Bedrock has no line width, so the thick
lines are drawn like the thin ones.
See demo
2. Clock
An analog clock showing the server's local time. The face (ring, ticks, digits) is drawn once, the three hands are
updated in place every tick. $facing is the side the clock is looked at from: Facing::UP lays it on the ground
for a viewer above, Facing::SOUTH hangs it on a wall for a viewer standing south of it and looking north. Seen from
the other side it runs backwards, like a real clock would.