summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Server/Plugins/APIDump/Classes/BlockArea.lua17
-rw-r--r--src/BlockArea.cpp12
-rw-r--r--src/BlockArea.h8
3 files changed, 33 insertions, 4 deletions
diff --git a/Server/Plugins/APIDump/Classes/BlockArea.lua b/Server/Plugins/APIDump/Classes/BlockArea.lua
index e513a0094..c72cdff31 100644
--- a/Server/Plugins/APIDump/Classes/BlockArea.lua
+++ b/Server/Plugins/APIDump/Classes/BlockArea.lua
@@ -638,17 +638,30 @@ return
Returns =
{
{
- Name = "BLOCKTYPE",
+ Name = "BlockType",
Type = "number",
},
{
- Name = "NIBBLETYPE",
+ Name = "BlockMeta",
Type = "number",
},
},
Notes = "Returns the block type and meta at the specified absolute coords",
},
+ GetBounds =
+ {
+ Params = {},
+ Returns =
+ {
+ {
+ Name = "Bounds",
+ Type = "cCuboid",
+ }
+ },
+ Notes = "Returns the {{cCuboid|cuboid}} that specifies the original coords of the world from which the area was read. Basically constructs a {{cCuboid}} out of GetOrigin() and GetOrigin() + GetCoordRange().",
+ },
+
GetCoordRange =
{
Returns =
diff --git a/src/BlockArea.cpp b/src/BlockArea.cpp
index eb3e82108..ea1bbe533 100644
--- a/src/BlockArea.cpp
+++ b/src/BlockArea.cpp
@@ -1952,6 +1952,18 @@ void cBlockArea::GetRelBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTY
+cCuboid cBlockArea::GetBounds(void) const
+{
+ return cCuboid(
+ m_Origin.x, m_Origin.y, m_Origin.z,
+ m_Origin.x + m_Size.x - 1, m_Origin.y + m_Size.y - 1, m_Origin.z + m_Size.z - 1
+ );
+}
+
+
+
+
+
size_t cBlockArea::CountNonAirBlocks(void) const
{
// Check if blocktypes are valid:
diff --git a/src/BlockArea.h b/src/BlockArea.h
index 583b998c2..42c1fa820 100644
--- a/src/BlockArea.h
+++ b/src/BlockArea.h
@@ -119,10 +119,12 @@ public:
// TODO: Write() is not too good an interface: if it fails, there's no way to repeat only for the parts that didn't write
// A better way may be to return a list of cBlockAreas for each part that didn't succeed writing, so that the caller may try again
- /** Writes the area back into cWorld at the coords specified. Returns true if successful in all chunks, false if only partially / not at all. */
+ /** Writes the area back into cWorld at the coords specified. Returns true if successful in all chunks, false if only partially / not at all.
+ Doesn't wake up the simulators. */
bool Write(cForEachChunkProvider & a_ForEachChunkProvider, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes = baTypes | baMetas | baBlockEntities);
- /** Writes the area back into cWorld at the coords specified. Returns true if successful in all chunks, false if only partially / not at all. */
+ /** Writes the area back into cWorld at the coords specified. Returns true if successful in all chunks, false if only partially / not at all.
+ Doesn't wake up the simulators. */
bool Write(cForEachChunkProvider & a_ForEachChunkProvider, const Vector3i & a_MinCoords, int a_DataTypes = baTypes | baMetas | baBlockEntities);
// tolua_begin
@@ -321,6 +323,8 @@ public:
// tolua_begin
+ cCuboid GetBounds(void) const;
+
int GetSizeX(void) const { return m_Size.x; }
int GetSizeY(void) const { return m_Size.y; }
int GetSizeZ(void) const { return m_Size.z; }