summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/WSSAnvil.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-09 22:44:32 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-09 22:44:32 +0100
commit09c5542123bcde7d9c40c35679f3ff499eb50125 (patch)
treef357cf6e6a6cb8ce10ab26f7379d07683a84ac54 /src/WorldStorage/WSSAnvil.cpp
parentMerge pull request #731 from mc-server/ballisticmissiles (diff)
parentChange tnt documentation to ticks (diff)
downloadcuberite-09c5542123bcde7d9c40c35679f3ff499eb50125.tar
cuberite-09c5542123bcde7d9c40c35679f3ff499eb50125.tar.gz
cuberite-09c5542123bcde7d9c40c35679f3ff499eb50125.tar.bz2
cuberite-09c5542123bcde7d9c40c35679f3ff499eb50125.tar.lz
cuberite-09c5542123bcde7d9c40c35679f3ff499eb50125.tar.xz
cuberite-09c5542123bcde7d9c40c35679f3ff499eb50125.tar.zst
cuberite-09c5542123bcde7d9c40c35679f3ff499eb50125.zip
Diffstat (limited to 'src/WorldStorage/WSSAnvil.cpp')
-rw-r--r--src/WorldStorage/WSSAnvil.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index 07cf87ab3..eb159f28d 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/ProjectileEntity.h"
+#include "../Entities/TNTEntity.h"
@@ -1237,6 +1238,10 @@ void cWSSAnvil::LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a
{
LoadPigZombieFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
}
+ else if (strncmp(a_IDTag, "PrimedTnt", a_IDTagLength) == 0)
+ {
+ LoadTNTFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
+ }
// TODO: other entities
}
@@ -2173,6 +2178,28 @@ void cWSSAnvil::LoadPigZombieFromNBT(cEntityList & a_Entities, const cParsedNBT
+void cWSSAnvil::LoadTNTFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
+{
+ std::auto_ptr<cTNTEntity> TNT(new cTNTEntity(0.0, 0.0, 0.0, 0));
+ if (!LoadEntityBaseFromNBT(*TNT.get(), a_NBT, a_TagIdx))
+ {
+ return;
+ }
+
+ // Load Fuse Ticks:
+ int FuseTicks = a_NBT.FindChildByName(a_TagIdx, "Fuse");
+ if (FuseTicks > 0)
+ {
+ TNT->SetFuseTicks((int) a_NBT.GetByte(FuseTicks));
+ }
+
+ a_Entities.push_back(TNT.release());
+}
+
+
+
+
+
bool cWSSAnvil::LoadEntityBaseFromNBT(cEntity & a_Entity, const cParsedNBT & a_NBT, int a_TagIdx)
{
double Pos[3];