summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSTRWarrior <niels.breuker@hotmail.nl>2014-03-30 17:21:13 +0200
committerSTRWarrior <niels.breuker@hotmail.nl>2014-03-30 17:21:13 +0200
commit36e1e57d038eda0c183f616f2b45d2ae4733e27c (patch)
treefb5096339c5437e7fc435b7d730c29e36d5f010c /src
parentAdded a BlockHitPos parameter to OnProjectileHitBlock (diff)
downloadcuberite-36e1e57d038eda0c183f616f2b45d2ae4733e27c.tar
cuberite-36e1e57d038eda0c183f616f2b45d2ae4733e27c.tar.gz
cuberite-36e1e57d038eda0c183f616f2b45d2ae4733e27c.tar.bz2
cuberite-36e1e57d038eda0c183f616f2b45d2ae4733e27c.tar.lz
cuberite-36e1e57d038eda0c183f616f2b45d2ae4733e27c.tar.xz
cuberite-36e1e57d038eda0c183f616f2b45d2ae4733e27c.tar.zst
cuberite-36e1e57d038eda0c183f616f2b45d2ae4733e27c.zip
Diffstat (limited to 'src')
-rw-r--r--src/Bindings/Plugin.h2
-rw-r--r--src/Bindings/PluginLua.cpp2
-rw-r--r--src/Bindings/PluginLua.h2
-rw-r--r--src/Bindings/PluginManager.cpp2
-rw-r--r--src/Bindings/PluginManager.h2
-rw-r--r--src/Entities/ProjectileEntity.cpp3
6 files changed, 7 insertions, 6 deletions
diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h
index 9c2b59609..a6f91382c 100644
--- a/src/Bindings/Plugin.h
+++ b/src/Bindings/Plugin.h
@@ -90,7 +90,7 @@ public:
virtual bool OnPluginsLoaded (void) = 0;
virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) = 0;
virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) = 0;
- virtual bool OnProjectileHitBlock (cProjectileEntity & a_Projectile, eBlockFace a_Face, Vector3d * a_BlockHitPos) = 0;
+ virtual bool OnProjectileHitBlock (cProjectileEntity & a_Projectile, eBlockFace a_Face, const Vector3i * a_BlockHitPos) = 0;
virtual bool OnProjectileHitEntity (cProjectileEntity & a_Projectile, cEntity & a_HitEntity) = 0;
virtual bool OnSpawnedEntity (cWorld & a_World, cEntity & a_Entity) = 0;
virtual bool OnSpawnedMonster (cWorld & a_World, cMonster & a_Monster) = 0;
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index a89cfc82c..97f78351b 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -1108,7 +1108,7 @@ bool cPluginLua::OnPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a
-bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile, eBlockFace a_Face, Vector3d * a_BlockHitPos)
+bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile, eBlockFace a_Face, const Vector3i * a_BlockHitPos)
{
cCSLock Lock(m_CriticalSection);
bool res = false;
diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h
index 2e757f9dd..627aa3cc8 100644
--- a/src/Bindings/PluginLua.h
+++ b/src/Bindings/PluginLua.h
@@ -113,7 +113,7 @@ public:
virtual bool OnPluginsLoaded (void) override;
virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
- virtual bool OnProjectileHitBlock (cProjectileEntity & a_Projectile, eBlockFace a_Face, Vector3d * a_BlockHitPos) override;
+ virtual bool OnProjectileHitBlock (cProjectileEntity & a_Projectile, eBlockFace a_Face, const Vector3i * a_BlockHitPos) override;
virtual bool OnProjectileHitEntity (cProjectileEntity & a_Projectile, cEntity & a_HitEntity) override;
virtual bool OnSpawnedEntity (cWorld & a_World, cEntity & a_Entity) override;
virtual bool OnSpawnedMonster (cWorld & a_World, cMonster & a_Monster) override;
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp
index 0aa52e97e..a5c904a77 100644
--- a/src/Bindings/PluginManager.cpp
+++ b/src/Bindings/PluginManager.cpp
@@ -1154,7 +1154,7 @@ bool cPluginManager::CallHookPreCrafting(const cPlayer * a_Player, const cCrafti
-bool cPluginManager::CallHookProjectileHitBlock(cProjectileEntity & a_Projectile, eBlockFace a_Face, Vector3d * a_BlockHitPos)
+bool cPluginManager::CallHookProjectileHitBlock(cProjectileEntity & a_Projectile, eBlockFace a_Face, const Vector3i * a_BlockHitPos)
{
HookMap::iterator Plugins = m_Hooks.find(HOOK_PROJECTILE_HIT_BLOCK);
if (Plugins == m_Hooks.end())
diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h
index 5fdbaac1c..35755459a 100644
--- a/src/Bindings/PluginManager.h
+++ b/src/Bindings/PluginManager.h
@@ -206,7 +206,7 @@ public: // tolua_export
bool CallHookPluginsLoaded (void);
bool CallHookPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
bool CallHookPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
- bool CallHookProjectileHitBlock (cProjectileEntity & a_Projectile, eBlockFace a_Face, Vector3d * a_BlockHitPos);
+ bool CallHookProjectileHitBlock (cProjectileEntity & a_Projectile, eBlockFace a_Face, const Vector3i * a_BlockHitPos);
bool CallHookProjectileHitEntity (cProjectileEntity & a_Projectile, cEntity & a_HitEntity);
bool CallHookSpawnedEntity (cWorld & a_World, cEntity & a_Entity);
bool CallHookSpawnedMonster (cWorld & a_World, cMonster & a_Monster);
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp
index 72ebf5775..7a869a957 100644
--- a/src/Entities/ProjectileEntity.cpp
+++ b/src/Entities/ProjectileEntity.cpp
@@ -68,7 +68,8 @@ protected:
if (bb.CalcLineIntersection(Line1, Line2, LineCoeff, Face))
{
Vector3d Intersection = Line1 + m_Projectile->GetSpeed() * LineCoeff;
- if (cPluginManager::Get()->CallHookProjectileHitBlock(*m_Projectile, Face, &Intersection))
+ const Vector3i BlockHitPos = Vector3i(Intersection);
+ if (cPluginManager::Get()->CallHookProjectileHitBlock(*m_Projectile, Face, &BlockHitPos))
{
return false;
}