diff --git a/Minecraft.World/HangingEntity.cpp b/Minecraft.World/HangingEntity.cpp index 42e40600..08d61496 100644 --- a/Minecraft.World/HangingEntity.cpp +++ b/Minecraft.World/HangingEntity.cpp @@ -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; } diff --git a/Minecraft.World/HangingEntity.h b/Minecraft.World/HangingEntity.h index bd04493e..992b41ff 100644 --- a/Minecraft.World/HangingEntity.h +++ b/Minecraft.World/HangingEntity.h @@ -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() {};