aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/LevelChunk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.World/LevelChunk.cpp')
-rw-r--r--Minecraft.World/LevelChunk.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/Minecraft.World/LevelChunk.cpp b/Minecraft.World/LevelChunk.cpp
index 29308e29..584e3df1 100644
--- a/Minecraft.World/LevelChunk.cpp
+++ b/Minecraft.World/LevelChunk.cpp
@@ -1222,6 +1222,30 @@ void LevelChunk::addEntity(shared_ptr<Entity> e)
#endif
}
+void LevelChunk::addRidingEntities(shared_ptr<Entity> rider, CompoundTag *riderTag)
+{
+#ifdef _LARGE_WORLDS #This shouldnt be called when we dont have large worlds enabled
+ CompoundTag *mountTag = riderTag;
+ shared_ptr<Entity> ridingEntity = rider;
+
+ while (mountTag != NULL && mountTag->contains(Entity::RIDING_TAG))
+ {
+ CompoundTag *nextMountTag = mountTag->getCompound(Entity::RIDING_TAG);
+ shared_ptr<Entity> mount = EntityIO::loadStatic(nextMountTag, level);
+ if (mount == NULL)
+ {
+ break;
+ }
+
+ mount->onLoadedFromSave();
+ addEntity(mount);
+ ridingEntity->ride(mount);
+
+ ridingEntity = mount;
+ mountTag = nextMountTag;
+ }
+#endif
+};
void LevelChunk::removeEntity(shared_ptr<Entity> e)
{
@@ -1431,6 +1455,7 @@ void LevelChunk::load()
{
ent->onLoadedFromSave();
addEntity(ent);
+ addRidingEntities(ent, teTag);
}
}
}