summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/WSSAnvil.cpp
diff options
context:
space:
mode:
authorarchshift <admin@archshift.com>2014-07-12 03:58:11 +0200
committerarchshift <admin@archshift.com>2014-07-12 03:58:11 +0200
commit8cbd43e0434323dcb1ccba6e1b95a3ca16d35d44 (patch)
tree1941b42b2892b873f498193e677df1f0e37dd2b2 /src/WorldStorage/WSSAnvil.cpp
parentMerge remote-tracking branch 'origin/master' into potions (diff)
downloadcuberite-8cbd43e0434323dcb1ccba6e1b95a3ca16d35d44.tar
cuberite-8cbd43e0434323dcb1ccba6e1b95a3ca16d35d44.tar.gz
cuberite-8cbd43e0434323dcb1ccba6e1b95a3ca16d35d44.tar.bz2
cuberite-8cbd43e0434323dcb1ccba6e1b95a3ca16d35d44.tar.lz
cuberite-8cbd43e0434323dcb1ccba6e1b95a3ca16d35d44.tar.xz
cuberite-8cbd43e0434323dcb1ccba6e1b95a3ca16d35d44.tar.zst
cuberite-8cbd43e0434323dcb1ccba6e1b95a3ca16d35d44.zip
Diffstat (limited to '')
-rw-r--r--src/WorldStorage/WSSAnvil.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index f13c4d4d2..3fac01614 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -36,6 +36,7 @@
#include "../Entities/Minecart.h"
#include "../Entities/Pickup.h"
#include "../Entities/ArrowEntity.h"
+#include "../Entities/SplashPotionEntity.h"
#include "../Entities/ThrownEggEntity.h"
#include "../Entities/ThrownEnderPearlEntity.h"
#include "../Entities/ThrownSnowballEntity.h"
@@ -1152,6 +1153,10 @@ void cWSSAnvil::LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a
{
LoadArrowFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
}
+ else if (strncmp(a_IDTag, "SplashPotion", a_IDTagLength) == 0)
+ {
+ LoadSplashPotionFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ }
else if (strncmp(a_IDTag, "Snowball", a_IDTagLength) == 0)
{
LoadSnowballFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
@@ -1658,6 +1663,29 @@ void cWSSAnvil::LoadArrowFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
+void cWSSAnvil::LoadSplashPotionFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
+{
+ std::auto_ptr<cSplashPotionEntity> SplashPotion(new cSplashPotionEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0), cEntityEffect::effNoEffect, cEntityEffect(), 0));
+ if (!LoadProjectileBaseFromNBT(*SplashPotion.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
+
+ int EffectDuration = a_NBT.FindChildByName(a_TagIdx, "EffectDuration");
+ int EffectIntensity = a_NBT.FindChildByName(a_TagIdx, "EffectIntensity");
+ int EffectDistanceModifier = a_NBT.FindChildByName(a_TagIdx, "EffectDistanceModifier");
+
+ SplashPotion->SetEntityEffectType((cEntityEffect::eType) a_NBT.FindChildByName(a_TagIdx, "EffectType"));
+ SplashPotion->SetEntityEffect(cEntityEffect(EffectDuration, EffectIntensity, EffectDistanceModifier));
+ SplashPotion->SetPotionName(a_NBT.FindChildByName(a_TagIdx, "PotionName"));
+
+ // Store the new splash potion in the entities list:
+ a_Entities.push_back(SplashPotion.release());
+}
+
+
+
+
void cWSSAnvil::LoadSnowballFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{