summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-30 23:48:03 +0200
committermadmaxoft <github@xoft.cz>2013-08-30 23:48:03 +0200
commit42ea85786a44b519eb79f08a350020ed693d2e0e (patch)
tree86b06faa5bbd6f65c4c04a25504c979e467b2905
parentAnvilStats: Implemented a cImageComposingCallback class. (diff)
downloadcuberite-42ea85786a44b519eb79f08a350020ed693d2e0e.tar
cuberite-42ea85786a44b519eb79f08a350020ed693d2e0e.tar.gz
cuberite-42ea85786a44b519eb79f08a350020ed693d2e0e.tar.bz2
cuberite-42ea85786a44b519eb79f08a350020ed693d2e0e.tar.lz
cuberite-42ea85786a44b519eb79f08a350020ed693d2e0e.tar.xz
cuberite-42ea85786a44b519eb79f08a350020ed693d2e0e.tar.zst
cuberite-42ea85786a44b519eb79f08a350020ed693d2e0e.zip
-rw-r--r--source/BlockID.h1
-rw-r--r--source/Entities/ProjectileEntity.cpp8
2 files changed, 8 insertions, 1 deletions
diff --git a/source/BlockID.h b/source/BlockID.h
index de8335e85..b7e9f3779 100644
--- a/source/BlockID.h
+++ b/source/BlockID.h
@@ -659,6 +659,7 @@ enum eDamageType
dtFireContact, // Standing inside a fire block
dtInVoid, // Falling into the Void (Y < 0)
dtPotionOfHarming,
+ dtEnderPearl, // Thrown an ender pearl, teleported by it
dtAdmin, // Damage applied by an admin command
// Some common synonyms:
diff --git a/source/Entities/ProjectileEntity.cpp b/source/Entities/ProjectileEntity.cpp
index 91b2c97a8..8f9f3b480 100644
--- a/source/Entities/ProjectileEntity.cpp
+++ b/source/Entities/ProjectileEntity.cpp
@@ -316,7 +316,13 @@ cThrownEnderPearlEntity::cThrownEnderPearlEntity(cEntity * a_Creator, double a_X
void cThrownEnderPearlEntity::OnHitSolidBlock(int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace)
{
- // TODO: Teleport the creator here, make them take 5 damage
+ // Teleport the creator here, make them take 5 damage:
+ if (m_Creator != NULL)
+ {
+ // TODO: The coords might need some tweaking based on the block face
+ m_Creator->TeleportToCoords(a_BlockX + 0.5, a_BlockY + 1.7, a_BlockZ + 0.5);
+ m_Creator->TakeDamage(dtEnderPearl, this, 5, 0);
+ }
Destroy();
}