fix: hanging entities in dlc worlds

This commit is contained in:
Fireblade
2026-07-24 18:59:43 -04:00
parent 09c305e970
commit c0265373a6
2 changed files with 33 additions and 6 deletions
+22 -6
View File
@@ -9,6 +9,12 @@
#include "../Minecraft.Client/Minecraft.h"
#include "Level.h"
const int HangingEntity::kApplicableDLCIds[] =
{
1030,
1034,
};
void HangingEntity::_init(Level *level)
{
checkInterval = 0;
@@ -309,22 +315,32 @@ void HangingEntity::readAdditionalSaveData(CompoundTag *tag)
}
else
{
bool isValidDLC = false;
bool isTutorial = false;
Minecraft *minecraft = Minecraft::GetInstance();
if (minecraft != nullptr && minecraft->isTutorial())
{
isTutorial = true;
}
else
LevelGenerationOptions *levelGen = app.getLevelGenerationOptions();
if (levelGen != nullptr)
{
LevelGenerationOptions *levelGen = app.getLevelGenerationOptions();
if (levelGen != nullptr && levelGen->isTutorial())
{
if (levelGen->isTutorial())
isTutorial = true;
if (levelGen->isFromDLC())
{
if (IsApplicableDLC(levelGen->getRequiredTexturePackId()))
{
isValidDLC = true;
}
}
}
if (isTutorial && !placedByPlayer)
if ((isTutorial || isValidDLC) && !placedByPlayer)
{
placedByTutorial = true;
}
+11
View File
@@ -13,6 +13,17 @@ private:
int checkInterval;
//eINSTANCEOF eType;
static const int kApplicableDLCIds[2];
inline bool IsApplicableDLC(int id)
{
for (int i = 0; i < sizeof(kApplicableDLCIds) / sizeof(kApplicableDLCIds[0]); ++i)
{
if (kApplicableDLCIds[i] == id)
return true;
}
return false;
}
protected:
virtual void defineSynchedData() {};