summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MCServer/Plugins/APIDump/APIDesc.lua2
-rw-r--r--src/Blocks/BlockChest.h6
-rw-r--r--src/Item.h2
-rw-r--r--src/Mobs/Monster.cpp12
-rw-r--r--src/Mobs/Monster.h1
-rw-r--r--src/World.cpp2
-rw-r--r--src/World.h2
7 files changed, 22 insertions, 5 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index cbdb7797b..948f55a22 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -1103,6 +1103,7 @@ These ItemGrids are available in the API and can be manipulated by the plugins,
GetMaxStackSize = { Params = "", Return = "number", Notes = "Returns the maximum stack size for this item." },
IsDamageable = { Params = "", Return = "bool", Notes = "Returns true if this item does account for its damage" },
IsEmpty = { Params = "", Return = "bool", Notes = "Returns true if this object represents an empty item (zero count or invalid ID)" },
+ IsEnchantable = { Params = "", Return = "bool", Notes = "Returns true if the item is enchantable" },
IsEqual = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is the same as the one stored in the object (type, damage and enchantments)" },
IsFullStack = { Params = "", Return = "bool", Notes = "Returns true if the item is stacked up to its maximum stacking" },
IsSameType = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is of the same ItemType as the one stored in the object. This is true even if the two items have different enchantments" },
@@ -1479,6 +1480,7 @@ a_Player:OpenWindow(Window);
GetMobType = { Params = "", Return = "{{cMonster#MobType|MobType}}", Notes = "Returns the type of this mob ({{cMonster#MobType|mtXXX}} constant)" },
GetSpawnDelay = { Params = "{{cMonster#MobFamily|MobFamily}}", Return = "number", Notes = "(STATIC) Returns the spawn delay - the number of game ticks between spawn attempts - for the specified mob family." },
MobTypeToString = { Params = "{{cMonster#MobType|MobType}}", Return = "string", Notes = "(STATIC) Returns the string representing the given mob type ({{cMonster#MobType|mtXXX}} constant), or empty string if unknown type." },
+ MoveToPosition = { Params = "Position", Return = "", Notes = "Moves mob to the specified position" },
StringToMobType = { Params = "string", Return = "{{cMonster#MobType|MobType}}", Notes = "(STATIC) Returns the mob type ({{cMonster#MobType|mtXXX}} constant) parsed from the string type (\"creeper\"), or mtInvalidType if unrecognized." },
},
Constants =
diff --git a/src/Blocks/BlockChest.h b/src/Blocks/BlockChest.h
index c2ac8ae27..02ecc4346 100644
--- a/src/Blocks/BlockChest.h
+++ b/src/Blocks/BlockChest.h
@@ -110,9 +110,11 @@ public:
return "step.wood";
}
- virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, const cChunk & a_Chunk) override
+ virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{
- return CanBeAt(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
+ int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;
+ int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
+ return CanBeAt(a_ChunkInterface, BlockX, a_RelY, BlockZ);
}
diff --git a/src/Item.h b/src/Item.h
index 727965112..7781db0cb 100644
--- a/src/Item.h
+++ b/src/Item.h
@@ -167,7 +167,7 @@ public:
void FromJson(const Json::Value & a_Value);
/// Returns true if the specified item type is enchantable (as per 1.2.5 protocol requirements)
- static bool IsEnchantable(short a_ItemType);
+ static bool IsEnchantable(short a_ItemType); // tolua_export
// tolua_begin
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 283ef36e6..340761a7e 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -191,6 +191,18 @@ void cMonster::MoveToPosition(const Vector3f & a_Position)
+
+void cMonster::MoveToPosition(const Vector3d & a_Position)
+{
+ FinishPathFinding();
+
+ m_FinalDestination = a_Position;
+ m_bMovingToDestination = true;
+ TickPathFinding();
+}
+
+
+
bool cMonster::IsCoordinateInTraversedList(Vector3i a_Coords)
{
for (std::vector<Vector3i>::const_iterator itr = m_TraversedCoordinates.begin(); itr != m_TraversedCoordinates.end(); ++itr)
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index 1dd302cdc..714feddb9 100644
--- a/src/Mobs/Monster.h
+++ b/src/Mobs/Monster.h
@@ -91,6 +91,7 @@ public:
virtual void KilledBy(cEntity * a_Killer) override;
virtual void MoveToPosition(const Vector3f & a_Position);
+ virtual void MoveToPosition(const Vector3d & a_Position); // tolua_export
virtual bool ReachedDestination(void);
// tolua_begin
diff --git a/src/World.cpp b/src/World.cpp
index f9a6e7776..d6c9b293d 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -2339,7 +2339,7 @@ bool cWorld::FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCa
// TODO: This interface is dangerous!
-cPlayer * cWorld::FindClosestPlayer(const Vector3f & a_Pos, float a_SightLimit, bool a_CheckLineOfSight)
+cPlayer * cWorld::FindClosestPlayer(const Vector3d & a_Pos, float a_SightLimit, bool a_CheckLineOfSight)
{
cTracer LineOfSight(this);
diff --git a/src/World.h b/src/World.h
index afdc09788..8cf860ff5 100644
--- a/src/World.h
+++ b/src/World.h
@@ -248,7 +248,7 @@ public:
bool FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
// TODO: This interface is dangerous - rewrite to DoWithClosestPlayer(pos, sight, action)
- cPlayer * FindClosestPlayer(const Vector3f & a_Pos, float a_SightLimit, bool a_CheckLineOfSight = true);
+ cPlayer * FindClosestPlayer(const Vector3d & a_Pos, float a_SightLimit, bool a_CheckLineOfSight = true);
void SendPlayerList(cPlayer * a_DestPlayer); // Sends playerlist to the player