Difference between revisions of "Plugin channels/WorldEditCUI"

From wiki.vg
Jump to navigation Jump to search
(Rough draft of WECUI documentation)
 
(Selection type documentation)
Line 1: Line 1:
[http://www.enginehub.org/worldedit/ WorldEdit] uses [[plugin channel]]s to communicate with the clientside [http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1292886-worldeditcui/ WorldEditCUI] mod to display selections.
+
[http://www.enginehub.org/worldedit/ WorldEdit] uses [[plugin channel]]s to communicate with the clientside [http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1292886-worldeditcui/ WorldEditCUI] mod to display selections. Client-side source code: https://github.com/Mumfrey/WorldEditCUI/
  
 
This is a (very) rough documentation of those channels that I'll improve.
 
This is a (very) rough documentation of those channels that I'll improve.
 +
 +
== Selection types ==
 +
 +
There are several types of selections.  Each type has a format used with current versions of WorldEditCUI and a second format used in older versions (usually a cube with similar edges).
 +
 +
=== Cuboid ===
 +
 +
A basic rectangular selection, with minimum and maximum points.
 +
 +
Minimum protocol version: 0
 +
 +
; Current version and legacy versions
 +
 +
Shape ID is <code>cuboid</code>.
 +
 +
If the selection has a position one (left click), it is sent with as a Point with an id of 0.  If the selection has a position two (right click), it is sent with as a Point with an id of 1.
 +
 +
=== Ellipsoid ===
 +
 +
Ellipsoid selections form 3-dimensional ellipses and spheres.  They have a center, and then x, y, and z radii (measured from the center).
 +
 +
Minimum protocol version: 1
 +
 +
; Current version
 +
 +
Shape ID is <code>ellipsoid</code>.
 +
 +
An ellipsoid point with id 0 is sent for the center, and an ellipsoid point with id 1 is sent to set the radii (these are distances, not coordinates).
 +
 +
; Legacy versions
 +
 +
Ellipsoid regions are sent as cuboids with their minimum and maximum positions in legacy versions.
 +
 +
=== Cylinder ===
 +
 +
A vertical cylinder selection.
 +
 +
Minimum protocol version: 1
 +
 +
; Current version
 +
 +
Shape ID is <code>cylinder</code>.
 +
 +
A cylinder packet is sent with the center and radius, and then a min/max packet is sent to set the bottom and top of the selection.
 +
 +
; Legacy versions
 +
 +
Sent as a cuboid with the minumum and maximum positions.
 +
 +
=== 2D Polygon ===
 +
 +
A 2-dimensional, flat polygon.
 +
 +
Minimum protocol version: 0
 +
 +
; Current and legacy versions
 +
 +
Shape ID: <code>polygon2d</code>
 +
 +
For all of the points in the selection, a Point 2D packet is sent with the point's x and z coordinates.  Then, a min/max packet is sent to set the bottom and top of the selection.
 +
 +
=== 3D Polyhedron ===
 +
 +
A 3-dimensional polygonal selection.
 +
 +
Minimum protocol version: 3
 +
 +
; Current version
 +
 +
Shape ID is <code>polyhedron</code>.
 +
 +
For each point in the polyhedrion, a Point packet is sent with the x, y, and z coordinates.  Then, for each triangle in the selection, a Polygon packet is sent with vertecies set to the index of each point that makes up the triangle.
 +
 +
; Legacy versions
 +
 +
Sent as a cuboid with the minumum and maximum positions.
  
 
== Structure ==
 
== Structure ==

Revision as of 20:53, 2 March 2016

WorldEdit uses plugin channels to communicate with the clientside WorldEditCUI mod to display selections. Client-side source code: https://github.com/Mumfrey/WorldEditCUI/

This is a (very) rough documentation of those channels that I'll improve.

Selection types

There are several types of selections. Each type has a format used with current versions of WorldEditCUI and a second format used in older versions (usually a cube with similar edges).

Cuboid

A basic rectangular selection, with minimum and maximum points.

Minimum protocol version: 0

Current version and legacy versions

Shape ID is cuboid.

If the selection has a position one (left click), it is sent with as a Point with an id of 0. If the selection has a position two (right click), it is sent with as a Point with an id of 1.

Ellipsoid

Ellipsoid selections form 3-dimensional ellipses and spheres. They have a center, and then x, y, and z radii (measured from the center).

Minimum protocol version: 1

Current version

Shape ID is ellipsoid.

An ellipsoid point with id 0 is sent for the center, and an ellipsoid point with id 1 is sent to set the radii (these are distances, not coordinates).

Legacy versions

Ellipsoid regions are sent as cuboids with their minimum and maximum positions in legacy versions.

Cylinder

A vertical cylinder selection.

Minimum protocol version: 1

Current version

Shape ID is cylinder.

A cylinder packet is sent with the center and radius, and then a min/max packet is sent to set the bottom and top of the selection.

Legacy versions

Sent as a cuboid with the minumum and maximum positions.

2D Polygon

A 2-dimensional, flat polygon.

Minimum protocol version: 0

Current and legacy versions

Shape ID: polygon2d

For all of the points in the selection, a Point 2D packet is sent with the point's x and z coordinates. Then, a min/max packet is sent to set the bottom and top of the selection.

3D Polyhedron

A 3-dimensional polygonal selection.

Minimum protocol version: 3

Current version

Shape ID is polyhedron.

For each point in the polyhedrion, a Point packet is sent with the x, y, and z coordinates. Then, for each triangle in the selection, a Polygon packet is sent with vertecies set to the index of each point that makes up the triangle.

Legacy versions

Sent as a cuboid with the minumum and maximum positions.

Structure

All communication is performed over the WECUI plugin channel, and is made up of a single UTF8 string with each value separated by |. The client, aside from REGISTERing the channel, must also send an initialization packet. All other data is sent from the server (on the same channel).

Version

Parsed in LocalSession.java

The v packet is sent from the client to the server to tell it that WorldEditCUI is installed. It has one parameter, the version of WorldEditCUI's protocol (an integer). This value is used to decide which types of selections can be sent - if a type of selection is not supported it will be sent as a different structure that is known to be supported.

v|(version)

Shape

The s packet does something with shapes. It has one field, the shape of the selection (?).

s|(shape)

Point

The p packet sets the location of one of the points in the current selection. It has 5 fields: the id, the block x, y, and z, and the total area.

p|(id)|(x)|(y)|(z)|(area)

Point 2D

The p2 packet sets the location of one of the points in the current selection, two-dimensionally. It has 4 fields: the id, the block x and z, and the total area.

p2|(id)|(x)|(z)|(area)

Cylinder

The cyl packet sets info about a cylindrical selection (?). It has 5 fields: the x, y, and z of the center and then the radius x and z.

cyl|(x)|(y)|(z)|(radX)|(radZ)

Ellipsoid Point

The e packet does... I don't know. It has 4 fields: the id, and x, y, and z coordinates.

e|(id)|(x)|(y)|(z)

Min/Max

The mm packet does something else. It has two fields, the minimum and the maximum. What these are the minimum and maximum of, I know not.

mm|(min)|(max)

Polygon

The poly packet sets verticies of a polygonal selection. It has an array of 3 (although it may be possible to add more) values, which seem to be indexes in the points list?

poly|(vertex1)|(vertex2)|(vertex3)