diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-03-10 18:17:28 +0100 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-03-10 18:17:28 +0100 |
commit | 0a509ab85e395bf46e29b7b554d736fadfaed0ba (patch) | |
tree | f67665e089d372b89505f1b9a3ee21c8cd9f0d8c /src/WorldStorage/WSSAnvil.cpp | |
parent | Be more parinoid about int sizes (diff) | |
parent | Fixed MSVC2008 compilation. (diff) | |
download | cuberite-0a509ab85e395bf46e29b7b554d736fadfaed0ba.tar cuberite-0a509ab85e395bf46e29b7b554d736fadfaed0ba.tar.gz cuberite-0a509ab85e395bf46e29b7b554d736fadfaed0ba.tar.bz2 cuberite-0a509ab85e395bf46e29b7b554d736fadfaed0ba.tar.lz cuberite-0a509ab85e395bf46e29b7b554d736fadfaed0ba.tar.xz cuberite-0a509ab85e395bf46e29b7b554d736fadfaed0ba.tar.zst cuberite-0a509ab85e395bf46e29b7b554d736fadfaed0ba.zip |
Diffstat (limited to 'src/WorldStorage/WSSAnvil.cpp')
-rw-r--r-- | src/WorldStorage/WSSAnvil.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index 680f2458f..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" @@ -663,6 +664,12 @@ bool cWSSAnvil::LoadItemFromNBT(cItem & a_Item, const cParsedNBT & a_NBT, int a_ { EnchantmentSerializer::ParseFromNBT(a_Item.m_Enchantments, a_NBT, EnchTag); } + + int FireworksTag = a_NBT.FindChildByName(TagTag, ((a_Item.m_ItemType == E_ITEM_FIREWORK_STAR) ? "Fireworks" : "Explosion")); + if (EnchTag > 0) + { + cFireworkItem::ParseFromNBT(a_Item.m_FireworkItem, a_NBT, FireworksTag, (ENUM_ITEM_ID)a_Item.m_ItemType); + } return true; } @@ -1231,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 } @@ -2167,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]; |