summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
Diffstat (limited to 'src/WorldStorage')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp6
-rwxr-xr-xsrc/WorldStorage/WSSAnvil.cpp48
2 files changed, 51 insertions, 3 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index 70f07557f..f78f7029f 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -547,7 +547,13 @@ public:
mWriter.BeginCompound("");
AddBasicTileEntity(a_MobSpawner, "MobSpawner");
mWriter.AddString("EntityId", cMonster::MobTypeToVanillaName(a_MobSpawner->GetEntity()));
+ mWriter.AddShort("SpawnCount", a_MobSpawner->GetSpawnCount());
+ mWriter.AddShort("SpawnRange", a_MobSpawner->GetSpawnRange());
mWriter.AddShort("Delay", a_MobSpawner->GetSpawnDelay());
+ mWriter.AddShort("MinSpawnDelay", a_MobSpawner->GetMinSpawnDelay());
+ mWriter.AddShort("MaxSpawnDelay", a_MobSpawner->GetMaxSpawnDelay());
+ mWriter.AddShort("MaxNearbyEntities", a_MobSpawner->GetMaxNearbyEntities());
+ mWriter.AddShort("RequiredPlayerRange", a_MobSpawner->GetRequiredPlayerRange());
mWriter.EndCompound();
}
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index f822f9375..03e60bb26 100755
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -1349,13 +1349,55 @@ OwnedBlockEntity cWSSAnvil::LoadMobSpawnerFromNBT(const cParsedNBT & a_NBT, int
}
}
+ // Load spawn count:
+ int CurrentLine = a_NBT.FindChildByName(a_TagIdx, "SpawnCount");
+ if ((CurrentLine >= 0) && (a_NBT.GetType(CurrentLine) == TAG_Short))
+ {
+ MobSpawner->SetSpawnCount(a_NBT.GetShort(CurrentLine));
+ }
+
+ // Load spawn range:
+ CurrentLine = a_NBT.FindChildByName(a_TagIdx, "SpawnRange");
+ if ((CurrentLine >= 0) && (a_NBT.GetType(CurrentLine) == TAG_Short))
+ {
+ MobSpawner->SetSpawnRange(a_NBT.GetShort(CurrentLine));
+ }
+
// Load delay:
- int Delay = a_NBT.FindChildByName(a_TagIdx, "Delay");
- if ((Delay >= 0) && (a_NBT.GetType(Delay) == TAG_Short))
+ CurrentLine = a_NBT.FindChildByName(a_TagIdx, "Delay");
+ if ((CurrentLine >= 0) && (a_NBT.GetType(CurrentLine) == TAG_Short))
{
- MobSpawner->SetSpawnDelay(a_NBT.GetShort(Delay));
+ MobSpawner->SetSpawnDelay(a_NBT.GetShort(CurrentLine));
}
+ // Load delay range:
+ CurrentLine = a_NBT.FindChildByName(a_TagIdx, "MinSpawnDelay");
+ if ((CurrentLine >= 0) && (a_NBT.GetType(CurrentLine) == TAG_Short))
+ {
+ MobSpawner->SetMinSpawnDelay(a_NBT.GetShort(CurrentLine));
+ }
+
+ CurrentLine = a_NBT.FindChildByName(a_TagIdx, "MaxSpawnDelay");
+ if ((CurrentLine >= 0) && (a_NBT.GetType(CurrentLine) == TAG_Short))
+ {
+ MobSpawner->SetMaxSpawnDelay(a_NBT.GetShort(CurrentLine));
+ }
+
+ // Load MaxNearbyEntities:
+ CurrentLine = a_NBT.FindChildByName(a_TagIdx, "MaxNearbyEntities");
+ if ((CurrentLine >= 0) && (a_NBT.GetType(CurrentLine) == TAG_Short))
+ {
+ MobSpawner->SetMaxNearbyEntities(a_NBT.GetShort(CurrentLine));
+ }
+
+ // Load RequiredPlayerRange:
+ CurrentLine = a_NBT.FindChildByName(a_TagIdx, "RequiredPlayerRange");
+ if ((CurrentLine >= 0) && (a_NBT.GetType(CurrentLine) == TAG_Short))
+ {
+ MobSpawner->SetRequiredPlayerRange(a_NBT.GetShort(CurrentLine));
+ }
+
+
return MobSpawner;
}