diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-03-08 10:25:46 +0100 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-03-08 10:25:46 +0100 |
commit | f5e374be41ef3bde93e0faaa76208e3e0e15e9ea (patch) | |
tree | 9b97062eebbc063dca6953cc3057f7686f81c79c /src/WorldStorage/WSSAnvil.cpp | |
parent | Link cItem in the documentation (diff) | |
download | cuberite-f5e374be41ef3bde93e0faaa76208e3e0e15e9ea.tar cuberite-f5e374be41ef3bde93e0faaa76208e3e0e15e9ea.tar.gz cuberite-f5e374be41ef3bde93e0faaa76208e3e0e15e9ea.tar.bz2 cuberite-f5e374be41ef3bde93e0faaa76208e3e0e15e9ea.tar.lz cuberite-f5e374be41ef3bde93e0faaa76208e3e0e15e9ea.tar.xz cuberite-f5e374be41ef3bde93e0faaa76208e3e0e15e9ea.tar.zst cuberite-f5e374be41ef3bde93e0faaa76208e3e0e15e9ea.zip |
Diffstat (limited to '')
-rw-r--r-- | src/WorldStorage/WSSAnvil.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index 680f2458f..fa0c4dbd9 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" @@ -1231,6 +1232,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 } @@ -2167,6 +2172,29 @@ 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) + { + int MojangFuseTicks = (int) a_NBT.GetByte(FuseTicks); + TNT->SetFuseTicks((double) MojangFuseTicks / 10); + } + + a_Entities.push_back(TNT.release()); +} + + + + + bool cWSSAnvil::LoadEntityBaseFromNBT(cEntity & a_Entity, const cParsedNBT & a_NBT, int a_TagIdx) { double Pos[3]; |