diff options
author | Mattes D <github@xoft.cz> | 2014-03-25 21:02:23 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-03-25 21:02:23 +0100 |
commit | cac5149974b9cd76abbedc9d08a75b0e4f7b7e03 (patch) | |
tree | 38b2f9d52cb2dc106d4211f61da5953646a4bdeb /src/WorldStorage | |
parent | Merge pull request #828 from mc-server/Wither (diff) | |
parent | Ender crystals (diff) | |
download | cuberite-cac5149974b9cd76abbedc9d08a75b0e4f7b7e03.tar cuberite-cac5149974b9cd76abbedc9d08a75b0e4f7b7e03.tar.gz cuberite-cac5149974b9cd76abbedc9d08a75b0e4f7b7e03.tar.bz2 cuberite-cac5149974b9cd76abbedc9d08a75b0e4f7b7e03.tar.lz cuberite-cac5149974b9cd76abbedc9d08a75b0e4f7b7e03.tar.xz cuberite-cac5149974b9cd76abbedc9d08a75b0e4f7b7e03.tar.zst cuberite-cac5149974b9cd76abbedc9d08a75b0e4f7b7e03.zip |
Diffstat (limited to 'src/WorldStorage')
-rw-r--r-- | src/WorldStorage/NBTChunkSerializer.cpp | 13 | ||||
-rw-r--r-- | src/WorldStorage/NBTChunkSerializer.h | 2 | ||||
-rw-r--r-- | src/WorldStorage/WSSAnvil.cpp | 19 | ||||
-rw-r--r-- | src/WorldStorage/WSSAnvil.h | 1 |
4 files changed, 35 insertions, 0 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp index f9cca1495..415693ae2 100644 --- a/src/WorldStorage/NBTChunkSerializer.cpp +++ b/src/WorldStorage/NBTChunkSerializer.cpp @@ -23,6 +23,7 @@ #include "../BlockEntities/FlowerPotEntity.h" #include "../Entities/Entity.h" +#include "../Entities/EnderCrystal.h" #include "../Entities/FallingBlock.h" #include "../Entities/Boat.h" #include "../Entities/Minecart.h" @@ -336,6 +337,17 @@ void cNBTChunkSerializer::AddBoatEntity(cBoat * a_Boat) +void cNBTChunkSerializer::AddEnderCrystalEntity(cEnderCrystal * a_EnderCrystal) +{ + m_Writer.BeginCompound(""); + AddBasicEntity(a_EnderCrystal, "EnderCrystal"); + m_Writer.EndCompound(); +} + + + + + void cNBTChunkSerializer::AddFallingBlockEntity(cFallingBlock * a_FallingBlock) { m_Writer.BeginCompound(""); @@ -735,6 +747,7 @@ void cNBTChunkSerializer::Entity(cEntity * a_Entity) switch (a_Entity->GetEntityType()) { case cEntity::etBoat: AddBoatEntity ((cBoat *) a_Entity); break; + case cEntity::etEnderCrystal: AddEnderCrystalEntity((cEnderCrystal *) a_Entity); break; case cEntity::etFallingBlock: AddFallingBlockEntity((cFallingBlock *) a_Entity); break; case cEntity::etMinecart: AddMinecartEntity ((cMinecart *) a_Entity); break; case cEntity::etMonster: AddMonsterEntity ((cMonster *) a_Entity); break; diff --git a/src/WorldStorage/NBTChunkSerializer.h b/src/WorldStorage/NBTChunkSerializer.h index c1134cd00..51d104970 100644 --- a/src/WorldStorage/NBTChunkSerializer.h +++ b/src/WorldStorage/NBTChunkSerializer.h @@ -24,6 +24,7 @@ class cChestEntity; class cCommandBlockEntity; class cDispenserEntity; class cDropperEntity; +class cEnderCrystal; class cFurnaceEntity; class cHopperEntity; class cJukeboxEntity; @@ -106,6 +107,7 @@ protected: // Entities: void AddBasicEntity (cEntity * a_Entity, const AString & a_ClassName); void AddBoatEntity (cBoat * a_Boat); + void AddEnderCrystalEntity(cEnderCrystal * a_EnderCrystal); void AddFallingBlockEntity(cFallingBlock * a_FallingBlock); void AddMinecartEntity (cMinecart * a_Minecart); void AddMonsterEntity (cMonster * a_Monster); diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index 2516ac07a..48934d074 100644 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -32,6 +32,7 @@ #include "../Mobs/IncludeAllMonsters.h" #include "../Entities/Boat.h" +#include "../Entities/EnderCrystal.h" #include "../Entities/FallingBlock.h" #include "../Entities/Minecart.h" #include "../Entities/Pickup.h" @@ -1057,6 +1058,10 @@ void cWSSAnvil::LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a { LoadBoatFromNBT(a_Entities, a_NBT, a_EntityTagIdx); } + else if (strncmp(a_IDTag, "EnderCrystal", a_IDTagLength) == 0) + { + LoadEnderCrystalFromNBT(a_Entities, a_NBT, a_EntityTagIdx); + } else if (strncmp(a_IDTag, "FallingBlock", a_IDTagLength) == 0) { LoadFallingBlockFromNBT(a_Entities, a_NBT, a_EntityTagIdx); @@ -1275,6 +1280,20 @@ void cWSSAnvil::LoadBoatFromNBT(cEntityList & a_Entities, const cParsedNBT & a_N +void cWSSAnvil::LoadEnderCrystalFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + std::auto_ptr<cEnderCrystal> EnderCrystal(new cEnderCrystal(0, 0, 0)); + if (!LoadEntityBaseFromNBT(*EnderCrystal.get(), a_NBT, a_TagIdx)) + { + return; + } + a_Entities.push_back(EnderCrystal.release()); +} + + + + + void cWSSAnvil::LoadFallingBlockFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) { int TypeIdx = a_NBT.FindChildByName(a_TagIdx, "TileID"); diff --git a/src/WorldStorage/WSSAnvil.h b/src/WorldStorage/WSSAnvil.h index 50d0e555e..1773ee882 100644 --- a/src/WorldStorage/WSSAnvil.h +++ b/src/WorldStorage/WSSAnvil.h @@ -148,6 +148,7 @@ protected: void LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_EntityTagIdx, const char * a_IDTag, int a_IDTagLength); void LoadBoatFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); + void LoadEnderCrystalFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadFallingBlockFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadPickupFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadTNTFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); |