summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2020-04-18 11:44:35 +0200
committerGitHub <noreply@github.com>2020-04-18 11:44:35 +0200
commita55f61548ef050f29aab96095b80af4c9f046281 (patch)
tree4c03607df6b5dd97af28f9748493a1bb26fd5d50
parentFixing washing away of redstone mechanisms (#4665) (diff)
downloadcuberite-a55f61548ef050f29aab96095b80af4c9f046281.tar
cuberite-a55f61548ef050f29aab96095b80af4c9f046281.tar.gz
cuberite-a55f61548ef050f29aab96095b80af4c9f046281.tar.bz2
cuberite-a55f61548ef050f29aab96095b80af4c9f046281.tar.lz
cuberite-a55f61548ef050f29aab96095b80af4c9f046281.tar.xz
cuberite-a55f61548ef050f29aab96095b80af4c9f046281.tar.zst
cuberite-a55f61548ef050f29aab96095b80af4c9f046281.zip
-rw-r--r--Server/Plugins/APIDump/APIDesc.lua84
-rw-r--r--Server/Plugins/APIDump/Classes/Geometry.lua55
-rw-r--r--src/Defines.h8
-rw-r--r--src/Vector3.h10
4 files changed, 129 insertions, 28 deletions
diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua
index fe2af77e6..80023274f 100644
--- a/Server/Plugins/APIDump/APIDesc.lua
+++ b/Server/Plugins/APIDump/APIDesc.lua
@@ -13214,46 +13214,74 @@ end
{
AddFaceDirection =
{
- Params =
{
+ Params =
{
- Name = "BlockX",
- Type = "number",
- },
- {
- Name = "BlockY",
- Type = "number",
- },
- {
- Name = "BlockZ",
- Type = "number",
- },
- {
- Name = "BlockFace",
- Type = "eBlockFace",
+ {
+ Name = "BlockX",
+ Type = "number",
+ },
+ {
+ Name = "BlockY",
+ Type = "number",
+ },
+ {
+ Name = "BlockZ",
+ Type = "number",
+ },
+ {
+ Name = "BlockFace",
+ Type = "eBlockFace",
+ },
+ {
+ Name = "IsInverse",
+ Type = "boolean",
+ IsOptional = true,
+ },
},
+ Returns =
{
- Name = "IsInverse",
- Type = "boolean",
- IsOptional = true,
+ {
+ Name = "BlockX",
+ Type = "number",
+ },
+ {
+ Name = "BlockY",
+ Type = "number",
+ },
+ {
+ Name = "BlockZ",
+ Type = "number",
+ },
},
+ Notes = "Returns the coords of a block adjacent to the specified block through the specified {{Globals#BlockFaces|face}}",
},
- Returns =
{
+ Params =
{
- Name = "BlockX",
- Type = "number",
- },
- {
- Name = "BlockY",
- Type = "number",
+ {
+ Name = "BlockPos",
+ Type = "Vector3i",
+ },
+ {
+ Name = "BlockFace",
+ Type = "eBlockFace",
+ },
+ {
+ Name = "IsInverse",
+ Type = "boolean",
+ IsOptional = true,
+ },
},
+ Returns =
{
- Name = "BlockZ",
- Type = "number",
+ {
+ Name = "BlockPos",
+ Type = "Vector3i",
+ },
},
+ Notes = "Returns the coords of a block adjacent to the specified block through the specified {{Globals#BlockFaces|face}}",
},
- Notes = "Returns the coords of a block adjacent to the specified block through the specified {{Globals#BlockFaces|face}}",
},
Base64Decode =
{
diff --git a/Server/Plugins/APIDump/Classes/Geometry.lua b/Server/Plugins/APIDump/Classes/Geometry.lua
index 6a284feda..475cab2f2 100644
--- a/Server/Plugins/APIDump/Classes/Geometry.lua
+++ b/Server/Plugins/APIDump/Classes/Geometry.lua
@@ -542,6 +542,11 @@ return
},
},
},
+
+
+
+
+
cCuboid =
{
Desc = [[
@@ -911,6 +916,11 @@ return
},
},
},
+
+
+
+
+
cLineBlockTracer =
{
Desc = [[
@@ -1118,6 +1128,11 @@ end
},
},
},
+
+
+
+
+
Vector3d =
{
Desc = [[
@@ -1208,6 +1223,16 @@ end
},
Notes = "Returns a copy of the vector, moved by the specified offset on the Z axis",
},
+ Ceil =
+ {
+ Returns =
+ {
+ {
+ Type = "Vector3i",
+ },
+ },
+ Notes = "Returns a new {{Vector3i}} object with coords set to math.ceil of this vector's coords.",
+ },
Clamp =
{
Params =
@@ -1683,6 +1708,11 @@ end
},
},
},
+
+
+
+
+
Vector3f =
{
Desc = [[
@@ -1773,6 +1803,16 @@ end
},
Notes = "Returns a copy of the vector, moved by the specified offset on the Z axis",
},
+ Ceil =
+ {
+ Returns =
+ {
+ {
+ Type = "Vector3i",
+ },
+ },
+ Notes = "Returns a new {{Vector3i}} object with coords set to math.ceil of this vector's coords.",
+ },
Clamp =
{
Params =
@@ -2280,6 +2320,11 @@ end
},
},
},
+
+
+
+
+
Vector3i =
{
Desc = [[
@@ -2370,6 +2415,16 @@ end
},
Notes = "Returns a copy of the vector, moved by the specified offset on the Z axis",
},
+ Ceil =
+ {
+ Returns =
+ {
+ {
+ Type = "Vector3i",
+ },
+ },
+ Notes = "Returns a new {{Vector3i}} object with coords set to math.ceil of this vector's coords. Normally not too useful with integer-only vectors, but still included for API completeness.",
+ },
Clamp =
{
Params =
diff --git a/src/Defines.h b/src/Defines.h
index b7fd570b4..42978e740 100644
--- a/src/Defines.h
+++ b/src/Defines.h
@@ -425,6 +425,14 @@ extern eDamageType StringToDamageType(const AString & a_DamageString);
If a_Inverse is true, the opposite direction is used instead. */
void AddFaceDirection(int & a_BlockX, int & a_BlockY, int & a_BlockZ, eBlockFace a_BlockFace, bool a_bInverse = false);
+/** Returns the coords of a block that is neighboring the specified position through its specified face.
+If a_IsInverse is true, the opposite direction is used instead. */
+inline Vector3i AddFaceDirection(Vector3i a_Pos, eBlockFace a_BlockFace, bool a_bInverse = false)
+{
+ AddFaceDirection(a_Pos.x, a_Pos.y, a_Pos.z, a_BlockFace, a_bInverse);
+ return a_Pos;
+}
+
// tolua_end
diff --git a/src/Vector3.h b/src/Vector3.h
index 1847baf5b..b3d54514b 100644
--- a/src/Vector3.h
+++ b/src/Vector3.h
@@ -178,6 +178,16 @@ public:
);
}
+ /** Returns a new Vector3i with coords set to std::ceil() of this vector's coords. */
+ inline Vector3<int> Ceil() const
+ {
+ return Vector3<int>(
+ CeilC(x),
+ CeilC(y),
+ CeilC(z)
+ );
+ }
+
// tolua_end
inline bool operator != (const Vector3<T> & a_Rhs) const