fix: hanging entities in dlc worlds
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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() {};
|
||||
|
||||
Reference in New Issue
Block a user