diff --git a/Minecraft.Client/HumanoidModel.cpp b/Minecraft.Client/HumanoidModel.cpp index f5466573..c8a2c6f1 100644 --- a/Minecraft.Client/HumanoidModel.cpp +++ b/Minecraft.Client/HumanoidModel.cpp @@ -241,7 +241,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float if (riding) { - if(uiBitmaskOverrideAnim&(1<xRot += -HALF_PI * 0.4f; arm1->xRot += -HALF_PI * 0.4f; diff --git a/Minecraft.Client/LivingEntityRenderer.cpp b/Minecraft.Client/LivingEntityRenderer.cpp index 819b7121..9e8682c7 100644 --- a/Minecraft.Client/LivingEntityRenderer.cpp +++ b/Minecraft.Client/LivingEntityRenderer.cpp @@ -491,7 +491,7 @@ void LivingEntityRenderer::renderNameTag(shared_ptr mob, const wst float s = 1 / 60.0f * size; glPushMatrix(); - glTranslatef((float) x + 0, (float) y + 2.3f, (float) z); + glTranslatef((float) x, (float) y + 2.3f, (float) z); glNormal3f(0, 1, 0); glRotatef(-this->entityRenderDispatcher->playerRotY, 0, 1, 0); diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 40a440c5..07ab47d9 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -2934,14 +2934,15 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { *piUse=IDS_TOOLTIPS_UNLEASH; } - else if (heldItemId == Item::lead_Id) + // 4J: fix improper tooltips for TU20 + /*else if (heldItemId == Item::lead_Id) { if (!pig->isLeashed()) *piUse=IDS_TOOLTIPS_LEASH; } else if (heldItemId == Item::nameTag_Id) { *piUse = IDS_TOOLTIPS_NAME; - } + }*/ else if (pig->hasSaddle()) // does the pig have a saddle? { *piUse=IDS_TOOLTIPS_MOUNT; diff --git a/Minecraft.Client/PlayerRenderer.cpp b/Minecraft.Client/PlayerRenderer.cpp index 7fbadf00..6e6b6626 100644 --- a/Minecraft.Client/PlayerRenderer.cpp +++ b/Minecraft.Client/PlayerRenderer.cpp @@ -445,7 +445,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) } } -void PlayerRenderer::renderNameTags(shared_ptr player, double x, double y, double z, wstring msg, float scale, double dist) +void PlayerRenderer::renderNameTags(shared_ptr player, double x, double y, double z, const wstring &msg, float scale, double dist) { #if 0 if (dist < 10 * 10) @@ -471,7 +471,17 @@ void PlayerRenderer::renderNameTags(shared_ptr player, double x, d } #endif - LivingEntityRenderer::renderNameTags(player, x, y, z, msg, scale, dist); + shared_ptr pPlayer = dynamic_pointer_cast(player); + int color = getNametagColour(pPlayer->getPlayerIndex()); + + if (player->isSleeping()) + { + renderNameTag(player, msg, x, y - 1.5f, z, 64, color); + } + else + { + renderNameTag(player, msg, x, y, z, 64, color); + } } void PlayerRenderer::scale(shared_ptr player, float a) diff --git a/Minecraft.Client/PlayerRenderer.h b/Minecraft.Client/PlayerRenderer.h index 6e65e0f7..cf920159 100644 --- a/Minecraft.Client/PlayerRenderer.h +++ b/Minecraft.Client/PlayerRenderer.h @@ -37,7 +37,7 @@ public: protected: virtual void additionalRendering(shared_ptr _mob, float a); - void renderNameTags(shared_ptr player, double x, double y, double z, wstring msg, float scale, double dist); + void renderNameTags(shared_ptr player, double x, double y, double z, const wstring &msg, float scale, double dist); virtual void scale(shared_ptr _player, float a); public: diff --git a/Minecraft.World/Animal.cpp b/Minecraft.World/Animal.cpp index 3b979d2c..7e65dc56 100644 --- a/Minecraft.World/Animal.cpp +++ b/Minecraft.World/Animal.cpp @@ -221,6 +221,12 @@ void Animal::readAdditionalSaveData(CompoundTag *tag) setDespawnProtected(); } +void Animal::dropLeash(bool synch, bool createItemDrop) +{ + setDespawnProtected(); + Mob::dropLeash(synch, createItemDrop); +} + shared_ptr Animal::findAttackTarget() { if (fleeTime > 0) return nullptr; @@ -294,7 +300,7 @@ int Animal::getAmbientSoundInterval() bool Animal::removeWhenFarAway() { - return !isDespawnProtected(); // 4J changed - was false + return !hasCustomName() && !isLeashed() && !isDespawnProtected(); } int Animal::getExperienceReward(shared_ptr killedBy) diff --git a/Minecraft.World/Animal.h b/Minecraft.World/Animal.h index 33bdde11..002a82fa 100644 --- a/Minecraft.World/Animal.h +++ b/Minecraft.World/Animal.h @@ -38,6 +38,7 @@ public: virtual bool hurt(DamageSource *source, float dmg); virtual void addAdditonalSaveData(CompoundTag *tag); virtual void readAdditionalSaveData(CompoundTag *tag); + virtual void dropLeash(bool synch, bool createItemDrop); protected: virtual shared_ptr findAttackTarget(); diff --git a/Minecraft.World/AttributeModifier.cpp b/Minecraft.World/AttributeModifier.cpp index 87245491..154f2513 100644 --- a/Minecraft.World/AttributeModifier.cpp +++ b/Minecraft.World/AttributeModifier.cpp @@ -123,7 +123,14 @@ HtmlString AttributeModifier::getHoverText(eATTRIBUTE_ID attribute) } wchar_t formatted[256]; - swprintf(formatted, 256, L"%ls%d%ls %ls", (amount > 0 ? L"+" : L"-"), (int) displayAmount, (percentage ? L"%" : L""), app.GetString(Attribute::getName(attribute))); + if (percentage) + { + swprintf(formatted, 256, L"%ls%d%ls %ls", (amount > 0 ? L"+" : L"-"), (int)displayAmount, L"%", app.GetString(Attribute::getName(attribute))); + } + else + { + swprintf(formatted, 256, L"%ls%.1g %ls", (amount > 0 ? L"+" : L"-"), displayAmount, app.GetString(Attribute::getName(attribute))); + } return HtmlString(formatted, color); } \ No newline at end of file diff --git a/Minecraft.World/Biome.cpp b/Minecraft.World/Biome.cpp index cd31006d..76d0e1bb 100644 --- a/Minecraft.World/Biome.cpp +++ b/Minecraft.World/Biome.cpp @@ -122,6 +122,7 @@ Biome::Biome(int id) : id(id) enemies.push_back(new MobSpawnerData(eTYPE_CREEPER, 10, 4, 4)); enemies.push_back(new MobSpawnerData(eTYPE_SLIME, 10, 4, 4)); enemies.push_back(new MobSpawnerData(eTYPE_ENDERMAN, 1, 1, 4)); + enemies.push_back(new MobSpawnerData(eTYPE_WITCH, 1, 1, 1)); // wolves are added to forests and taigas diff --git a/Minecraft.World/Entity.cpp b/Minecraft.World/Entity.cpp index 596b348c..0c848795 100644 --- a/Minecraft.World/Entity.cpp +++ b/Minecraft.World/Entity.cpp @@ -1617,8 +1617,13 @@ void Entity::rideTick() // jeb: This caused the crosshair to "drift" while riding horses. For now I've just disabled it, // because I can't figure out what it's needed for. Riding boats and minecarts seem unaffected... - // yRot += yra; - // xRot += xra; + // + // 3UR: re-enabled this for TU20 but only for rideable minecarts + if (riding->instanceof(eTYPE_MINECART_RIDEABLE)) + { + yRot += yra; + xRot += xra; + } } void Entity::positionRider() diff --git a/Minecraft.World/Item.cpp b/Minecraft.World/Item.cpp index d51c06d4..d5b0f492 100644 --- a/Minecraft.World/Item.cpp +++ b/Minecraft.World/Item.cpp @@ -1126,11 +1126,11 @@ const int Item::record_04_Id ; const int Item::record_05_Id ; const int Item::record_06_Id ; const int Item::record_07_Id ; +const int Item::record_08_Id ; const int Item::record_09_Id ; const int Item::record_10_Id ; const int Item::record_11_Id ; const int Item::record_12_Id ; -const int Item::record_08_Id ; const int Item::fireball_Id ; const int Item::itemFrame_Id ; const int Item::netherbrick_Id ; diff --git a/Minecraft.World/Item.h b/Minecraft.World/Item.h index c8a0eed5..b89e54fe 100644 --- a/Minecraft.World/Item.h +++ b/Minecraft.World/Item.h @@ -568,14 +568,14 @@ public: static const int record_05_Id = 2260; static const int record_06_Id = 2261; static const int record_07_Id = 2262; + + // 4J-PB - this one isn't playable in the PC game, but is fine in ours + static const int record_08_Id = 2267; static const int record_09_Id = 2263; static const int record_10_Id = 2264; static const int record_11_Id = 2265; static const int record_12_Id = 2266; - // 4J-PB - this one isn't playable in the PC game, but is fine in ours - static const int record_08_Id = 2267; - // TU9 static const int fireball_Id = 385; static const int itemFrame_Id = 389; diff --git a/Minecraft.World/Level.h b/Minecraft.World/Level.h index 2029edaa..61005fe8 100644 --- a/Minecraft.World/Level.h +++ b/Minecraft.World/Level.h @@ -59,7 +59,7 @@ public: public: static const int MAX_XBOX_BOATS = 40; // Max number of boats - static const int MAX_CONSOLE_MINECARTS = 40; + static const int MAX_CONSOLE_MINECARTS = 250; static const int MAX_DISPENSABLE_FIREBALLS = 200; static const int MAX_DISPENSABLE_PROJECTILES = 300; diff --git a/Minecraft.World/LivingEntity.cpp b/Minecraft.World/LivingEntity.cpp index c12e7415..e99dd153 100644 --- a/Minecraft.World/LivingEntity.cpp +++ b/Minecraft.World/LivingEntity.cpp @@ -259,9 +259,16 @@ void LivingEntity::baseTick() } // If lastHurtByMob is dead, remove it - if (lastHurtByMob != NULL && !lastHurtByMob->isAlive()) + if (lastHurtByMob != NULL) { - setLastHurtByMob(nullptr); + if (!lastHurtByMob->isAlive()) + { + setLastHurtByMob(nullptr); + } + else if (tickCount - lastHurtByMobTimestamp > 100) + { + setLastHurtByMob(nullptr); + } } // Update effects diff --git a/Minecraft.World/McRegionLevelStorage.cpp b/Minecraft.World/McRegionLevelStorage.cpp index ca46fcb2..752c10e1 100644 --- a/Minecraft.World/McRegionLevelStorage.cpp +++ b/Minecraft.World/McRegionLevelStorage.cpp @@ -51,6 +51,15 @@ ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension) delete netherFiles; } #endif + vector *fortressFiles = m_saveFile->getFilesWithPrefix(L"data/Fortress"); + if(fortressFiles!=NULL) + { + for (auto& fortressFile : *fortressFiles) + { + m_saveFile->deleteFile(fortressFile); + } + delete fortressFiles; + } resetNetherPlayerPositions(); } diff --git a/Minecraft.World/Pig.cpp b/Minecraft.World/Pig.cpp index 341379b4..7b3ee8ce 100644 --- a/Minecraft.World/Pig.cpp +++ b/Minecraft.World/Pig.cpp @@ -47,6 +47,11 @@ bool Pig::useNewAi() return true; } +bool Pig::removeWhenFarAway() +{ + return Animal::removeWhenFarAway() && !hasSaddle(); +} + void Pig::registerAttributes() { Animal::registerAttributes(); diff --git a/Minecraft.World/Pig.h b/Minecraft.World/Pig.h index 07186f01..571fdeab 100644 --- a/Minecraft.World/Pig.h +++ b/Minecraft.World/Pig.h @@ -23,6 +23,7 @@ public: virtual bool useNewAi(); protected: + virtual bool removeWhenFarAway(); virtual void registerAttributes(); virtual void newServerAiStep(); diff --git a/Minecraft.World/ScatteredFeaturePieces.cpp b/Minecraft.World/ScatteredFeaturePieces.cpp index c9bdd574..4fe40bc3 100644 --- a/Minecraft.World/ScatteredFeaturePieces.cpp +++ b/Minecraft.World/ScatteredFeaturePieces.cpp @@ -12,8 +12,8 @@ void ScatteredFeaturePieces::loadStatic() { StructureFeatureIO::setPieceId(eStructurePiece_DesertPyramidPiece, DesertPyramidPiece::Create, L"TeDP"); - StructureFeatureIO::setPieceId(eStructurePiece_JunglePyramidPiece, DesertPyramidPiece::Create, L"TeJP"); - StructureFeatureIO::setPieceId(eStructurePiece_SwamplandHut, DesertPyramidPiece::Create, L"TeSH"); + StructureFeatureIO::setPieceId(eStructurePiece_JunglePyramidPiece, JunglePyramidPiece::Create, L"TeJP"); + StructureFeatureIO::setPieceId(eStructurePiece_SwamplandHut, SwamplandHut::Create, L"TeSH"); } ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece() diff --git a/Minecraft.World/Villager.cpp b/Minecraft.World/Villager.cpp index 95ae58cc..113e7835 100644 --- a/Minecraft.World/Villager.cpp +++ b/Minecraft.World/Villager.cpp @@ -460,6 +460,7 @@ void Villager::addOffers(int addCount) addItemForPurchase(newOffers, Tile::glass_Id, random, getRecipeChance(.2f)); addItemForPurchase(newOffers, Item::compass_Id, random, getRecipeChance(.2f)); addItemForPurchase(newOffers, Item::clock_Id, random, getRecipeChance(.2f)); + addItemForPurchase(newOffers, Item::nameTag_Id, random, getRecipeChance(.2f)); if (random->nextFloat() < getRecipeChance(0.07f)) { diff --git a/Minecraft.World/Wolf.cpp b/Minecraft.World/Wolf.cpp index c7f2c9f2..1cf5306d 100644 --- a/Minecraft.World/Wolf.cpp +++ b/Minecraft.World/Wolf.cpp @@ -509,7 +509,7 @@ void Wolf::setCollarColor(int color) // 4J-PB added for tooltips int Wolf::GetSynchedHealth() { - return getEntityData()->getInteger(DATA_HEALTH_ID); + return getEntityData()->getFloat(DATA_HEALTH_ID); } shared_ptr Wolf::getBreedOffspring(shared_ptr target)