Add docstrings to createSchematic, extractSchematicFrom and Ray
This commit is contained in:
parent
aece427f6f
commit
de03b743fb
@ -17,6 +17,22 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
def extractSchematicFrom(sourceDim, box, *a, **kw):
|
def extractSchematicFrom(sourceDim, box, *a, **kw):
|
||||||
|
"""
|
||||||
|
Extract a schematic from the given dimension within the given selection box. The
|
||||||
|
minimum corner of the given box becomes the schematic's (0,0,0) coordinate.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
sourceDim : WorldEditorDimension
|
||||||
|
box : SelectionBox
|
||||||
|
a :
|
||||||
|
kw :
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
WorldEditor
|
||||||
|
|
||||||
|
"""
|
||||||
return exhaust(extractSchematicFromIter(sourceDim, box, *a, **kw))
|
return exhaust(extractSchematicFromIter(sourceDim, box, *a, **kw))
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,6 +141,30 @@ class Vector(namedtuple("_Vector", ("x", "y", "z"))):
|
|||||||
|
|
||||||
|
|
||||||
class Ray(object):
|
class Ray(object):
|
||||||
|
"""
|
||||||
|
A ray in 3D space, starting at an origin point and extending in a direction given
|
||||||
|
by a vector
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
point: Vector
|
||||||
|
The ray's origin point
|
||||||
|
vector: Vector
|
||||||
|
The ray's direction vector
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
|
||||||
|
point: Vector
|
||||||
|
vector: Vector
|
||||||
|
|
||||||
|
Methods
|
||||||
|
----------
|
||||||
|
|
||||||
|
atHeight(h: int) : Vector
|
||||||
|
Return the intersection of this vector with the plane at y=h. If the ray
|
||||||
|
does not intersect the plane, returns the ray's origin.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, point, vector):
|
def __init__(self, point, vector):
|
||||||
self.point = Vector(*point)
|
self.point = Vector(*point)
|
||||||
|
@ -28,6 +28,18 @@ log = getLogger(__name__)
|
|||||||
blocktypeClassesByName = {"Alpha": PCBlockTypeSet}
|
blocktypeClassesByName = {"Alpha": PCBlockTypeSet}
|
||||||
|
|
||||||
def createSchematic(shape, blocktypes='Alpha'):
|
def createSchematic(shape, blocktypes='Alpha'):
|
||||||
|
"""
|
||||||
|
Create a new .schematic of the given shape and blocktypes and return a WorldEditor.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
shape : tuple of int
|
||||||
|
blocktypes : BlockTypeSet or str
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
WorldEditor
|
||||||
|
"""
|
||||||
from mceditlib.worldeditor import WorldEditor
|
from mceditlib.worldeditor import WorldEditor
|
||||||
|
|
||||||
adapter = SchematicFileAdapter(shape=shape, blocktypes=blocktypes)
|
adapter = SchematicFileAdapter(shape=shape, blocktypes=blocktypes)
|
||||||
@ -69,15 +81,20 @@ class SchematicFileAdapter(FakeChunkedLevelAdapter):
|
|||||||
the file is y,z,x. This is the same order used in Minecraft 1.4's
|
the file is y,z,x. This is the same order used in Minecraft 1.4's
|
||||||
chunk sections.
|
chunk sections.
|
||||||
|
|
||||||
:type shape: tuple
|
Parameters
|
||||||
:param shape: The shape of the schematic as (x, y, z)
|
----------
|
||||||
:type filename: basestring
|
shape: tuple of int
|
||||||
:param filename: Path to a file to load a saved schematic from.
|
The shape of the schematic as (x, y, z)
|
||||||
:type blocktypes: basestring or BlockTypeSet
|
filename: basestring
|
||||||
:param blocktypes: The name of a builtin blocktypes set (one of
|
Path to a file to load a saved schematic from.
|
||||||
|
blocktypes: basestring or BlockTypeSet
|
||||||
|
The name of a builtin blocktypes set (one of
|
||||||
"Classic", "Alpha", "Pocket") to indicate allowable blocks. The default
|
"Classic", "Alpha", "Pocket") to indicate allowable blocks. The default
|
||||||
is Alpha. An instance of BlockTypeSet may be passed instead.
|
is Alpha. An instance of BlockTypeSet may be passed instead.
|
||||||
:rtype: SchematicFileAdapter
|
|
||||||
|
Returns
|
||||||
|
----------
|
||||||
|
SchematicFileAdapter
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.EntityRef = PCEntityRef
|
self.EntityRef = PCEntityRef
|
||||||
|
Reference in New Issue
Block a user