diff options
author | 12xx12 <44411062+12xx12@users.noreply.github.com> | 2020-10-10 21:31:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-10 21:31:44 +0200 |
commit | c0711407e96353e14bfa41f17db4e45c43f8ebb9 (patch) | |
tree | 06fc3be82f5478aa9c39c1ec5e665a8a05feb6c2 /src/WorldStorage/WSSAnvil.cpp | |
parent | Anvil fixes (#4976) (diff) | |
download | cuberite-c0711407e96353e14bfa41f17db4e45c43f8ebb9.tar cuberite-c0711407e96353e14bfa41f17db4e45c43f8ebb9.tar.gz cuberite-c0711407e96353e14bfa41f17db4e45c43f8ebb9.tar.bz2 cuberite-c0711407e96353e14bfa41f17db4e45c43f8ebb9.tar.lz cuberite-c0711407e96353e14bfa41f17db4e45c43f8ebb9.tar.xz cuberite-c0711407e96353e14bfa41f17db4e45c43f8ebb9.tar.zst cuberite-c0711407e96353e14bfa41f17db4e45c43f8ebb9.zip |
Diffstat (limited to '')
-rwxr-xr-x | src/WorldStorage/WSSAnvil.cpp | 48 |
1 files changed, 45 insertions, 3 deletions
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; } |