summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/WSSAnvil.cpp
diff options
context:
space:
mode:
authorTheJumper <maximilian.springer@web.de>2014-02-23 18:43:47 +0100
committerTheJumper <maximilian.springer@web.de>2014-02-23 18:43:47 +0100
commit72dd48f7e741217077f82d9c8ec7e55618102bd6 (patch)
treeae346f75dc629d57886d398581bcf672334c9e84 /src/WorldStorage/WSSAnvil.cpp
parentFixed Formatting, Added DropChance attributes to Monsters (diff)
downloadcuberite-72dd48f7e741217077f82d9c8ec7e55618102bd6.tar
cuberite-72dd48f7e741217077f82d9c8ec7e55618102bd6.tar.gz
cuberite-72dd48f7e741217077f82d9c8ec7e55618102bd6.tar.bz2
cuberite-72dd48f7e741217077f82d9c8ec7e55618102bd6.tar.lz
cuberite-72dd48f7e741217077f82d9c8ec7e55618102bd6.tar.xz
cuberite-72dd48f7e741217077f82d9c8ec7e55618102bd6.tar.zst
cuberite-72dd48f7e741217077f82d9c8ec7e55618102bd6.zip
Diffstat (limited to '')
-rw-r--r--src/WorldStorage/WSSAnvil.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index a5f4e1b25..10c8d1f51 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -2167,10 +2167,10 @@ bool cWSSAnvil::LoadEntityBaseFromNBT(cEntity & a_Entity, const cParsedNBT & a_N
-bool LoadMonsterBaseFromNBT(cMonster & a_Monster, const cParsedNBT & a_NBT, int a_TagIdx)
+bool cWSSAnvil::LoadMonsterBaseFromNBT(cMonster & a_Monster, const cParsedNBT & a_NBT, int a_TagIdx)
{
float DropChance[5];
- if (!LoadDoublesListFromNBT(DropChance, 5, a_NBT, a_NBT.FindChildByName(a_TagIdx, "DropChance")))
+ if (!LoadFloatsListFromNBT(DropChance, 5, a_NBT, a_NBT.FindChildByName(a_TagIdx, "DropChance")))
{
return false;
}
@@ -2228,6 +2228,24 @@ bool cWSSAnvil::LoadDoublesListFromNBT(double * a_Doubles, int a_NumDoubles, con
+bool cWSSAnvil::LoadFloatsListFromNBT(float * a_Floats, int a_NumFloats, const cParsedNBT & a_NBT, int a_TagIdx)
+{
+ if ((a_TagIdx < 0) || (a_NBT.GetType(a_TagIdx) != TAG_List) || (a_NBT.GetChildrenType(a_TagIdx) != TAG_Float))
+ {
+ return false;
+ }
+ int idx = 0;
+ for (int Tag = a_NBT.GetFirstChild(a_TagIdx); (Tag > 0) && (idx < a_NumFloats); Tag = a_NBT.GetNextSibling(Tag), ++idx)
+ {
+ a_Floats[idx] = a_NBT.GetFloat(Tag);
+ } // for Tag - PosTag[]
+ return (idx == a_NumFloats); // Did we read enough doubles?
+}
+
+
+
+
+
bool cWSSAnvil::GetBlockEntityNBTPos(const cParsedNBT & a_NBT, int a_TagIdx, int & a_X, int & a_Y, int & a_Z)
{
int x = a_NBT.FindChildByName(a_TagIdx, "x");