Merge branch 'smartcmd:main' into main

This commit is contained in:
Revela
2026-03-13 07:17:11 -05:00
19 changed files with 409 additions and 86 deletions
+25
View File
@@ -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);
}
}
}
+1
View File
@@ -192,6 +192,7 @@ public:
virtual void setBrightness(LightLayer::variety layer, int x, int y, int z, int brightness);
virtual int getRawBrightness(int x, int y, int z, int skyDampen);
virtual void addEntity(shared_ptr<Entity> e);
virtual void addRidingEntities(shared_ptr<Entity> rider, CompoundTag *riderTag);
virtual void removeEntity(shared_ptr<Entity> e);
virtual void removeEntity(shared_ptr<Entity> e, int yc);
virtual bool isSkyLit(int x, int y, int z);
+5 -1
View File
@@ -1354,6 +1354,10 @@ bool LivingEntity::shouldShowName()
Icon *LivingEntity::getItemInHandIcon(shared_ptr<ItemInstance> item, int layer)
{
if (item->getItem()->hasMultipleSpriteLayers())
{
return item->getItem()->getLayerIcon(item->getAuxValue(), layer);
}
return item->getIcon();
}
@@ -1999,4 +2003,4 @@ bool LivingEntity::isAlliedTo(Team *other)
return getTeam()->isAlliedTo(other);
}
return false;
}
}
+1
View File
@@ -403,6 +403,7 @@ void OldChunkStorage::loadEntities(LevelChunk *lc, Level *level, CompoundTag *ta
if (te != nullptr)
{
lc->addEntity(te);
lc->addRidingEntities(te, teTag);
}
}
}
+5 -1
View File
@@ -194,7 +194,11 @@ void ZonedChunkStorage::loadEntities(Level *level, LevelChunk *lc)
if (type == 0)
{
shared_ptr<Entity> e = EntityIO::loadStatic(tag, level);
if (e != nullptr) lc->addEntity(e);
if (e != nullptr)
{
lc->addEntity(e);
lc->addRidingEntities(e, tag);
}
}
else if (type == 1)
{