implement la's TU22 patch file

This commit is contained in:
piebot 2026-03-13 00:56:59 +03:00
parent f255035afd
commit beec56d3be
22 changed files with 87 additions and 26 deletions

View file

@ -241,7 +241,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float
if (riding)
{
if(uiBitmaskOverrideAnim&(1<<eAnim_SmallModel) == 0)
if ((uiBitmaskOverrideAnim&(1<<eAnim_SmallModel)) == 0)
{
arm0->xRot += -HALF_PI * 0.4f;
arm1->xRot += -HALF_PI * 0.4f;
@ -256,6 +256,8 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float
arm1->xRot += -HALF_PI * 0.4f;
leg0->xRot = -HALF_PI * 0.4f;
leg1->xRot = -HALF_PI * 0.4f;
leg0->yRot = HALF_PI * 0.2f;
leg1->yRot = -HALF_PI * 0.2f;
}
}
else if(idle && !sneaking )

View file

@ -501,7 +501,7 @@ void LivingEntityRenderer::renderNameTag(shared_ptr<LivingEntity> mob, const wst
constexpr float s = 1 / 60.0f * size;
glPushMatrix();
glTranslatef(static_cast<float>(x) + 0, static_cast<float>(y) + mob->bbHeight + 0.5f, static_cast<float>(z));
glTranslatef(static_cast<float>(x), static_cast<float>(y) + mob->bbHeight + 0.5f, static_cast<float>(z));
glNormal3f(0, 1, 0);
glRotatef(-this->entityRenderDispatcher->playerRotY, 0, 1, 0);

View file

@ -3142,14 +3142,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;

View file

@ -470,7 +470,7 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
}
}
void PlayerRenderer::renderNameTags(shared_ptr<LivingEntity> player, double x, double y, double z, wstring msg, float scale, double dist)
void PlayerRenderer::renderNameTags(shared_ptr<LivingEntity> player, double x, double y, double z, const wstring &msg, float scale, double dist)
{
#if 0
if (dist < 10 * 10)
@ -496,7 +496,17 @@ void PlayerRenderer::renderNameTags(shared_ptr<LivingEntity> player, double x, d
}
#endif
LivingEntityRenderer::renderNameTags(player, x, y, z, msg, scale, dist);
shared_ptr<Player> pPlayer = dynamic_pointer_cast<Player>(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<LivingEntity> player, float a)

View file

@ -34,7 +34,7 @@ public:
protected:
virtual void additionalRendering(shared_ptr<LivingEntity> _mob, float a);
void renderNameTags(shared_ptr<LivingEntity> player, double x, double y, double z, wstring msg, float scale, double dist);
void renderNameTags(shared_ptr<LivingEntity> player, double x, double y, double z, const wstring &msg, float scale, double dist);
virtual void scale(shared_ptr<LivingEntity> _player, float a);
public:

View file

@ -221,6 +221,12 @@ void Animal::readAdditionalSaveData(CompoundTag *tag)
setDespawnProtected();
}
void Animal::dropLeash(bool synch, bool createItemDrop)
{
setDespawnProtected();
Mob::dropLeash(synch, createItemDrop);
}
shared_ptr<Entity> Animal::findAttackTarget()
{
if (fleeTime > 0) return nullptr;
@ -301,7 +307,7 @@ int Animal::getAmbientSoundInterval()
bool Animal::removeWhenFarAway()
{
return !isDespawnProtected(); // 4J changed - was false
return !hasCustomName() && !isLeashed() && !isDespawnProtected();
}
int Animal::getExperienceReward(shared_ptr<Player> killedBy)

View file

@ -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<Entity> findAttackTarget();

View file

@ -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"-"), static_cast<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);
}

View file

@ -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

View file

@ -60,13 +60,17 @@ void EatTileGoal::tick()
if (level->getTile(xx, yy, zz) == Tile::tallgrass_Id)
{
level->destroyTile(xx, yy, zz, false);
if (level->getGameRules()->getBoolean(GameRules::RULE_MOBGRIEFING))
level->destroyTile(xx, yy, zz, false);
mob->ate();
}
else if (level->getTile(xx, yy - 1, zz) == Tile::grass_Id)
{
level->levelEvent(LevelEvent::PARTICLES_DESTROY_BLOCK, xx, yy - 1, zz, Tile::grass_Id);
level->setTileAndData(xx, yy - 1, zz, Tile::dirt_Id, 0, Tile::UPDATE_CLIENTS);
if (level->getGameRules()->getBoolean(GameRules::RULE_MOBGRIEFING))
{
level->levelEvent(LevelEvent::PARTICLES_DESTROY_BLOCK, xx, yy - 1, zz, Tile::grass_Id);
level->setTileAndData(xx, yy - 1, zz, Tile::dirt_Id, 0, Tile::UPDATE_CLIENTS);
}
mob->ate();
}
}

View file

@ -1598,8 +1598,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()

View file

@ -14,4 +14,5 @@ HellBiome::HellBiome(int id) : Biome(id)
enemies.push_back(new MobSpawnerData(eTYPE_GHAST, 50, 4, 4));
enemies.push_back(new MobSpawnerData(eTYPE_PIGZOMBIE, 100, 4, 4));
enemies.push_back(new MobSpawnerData(eTYPE_LAVASLIME, 1, 4, 4));
enemies.push_back(new MobSpawnerData(eTYPE_SKELETON, 1, 4, 4));
}

View file

@ -1138,11 +1138,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 ;

View file

@ -577,13 +577,13 @@ public:
static const int record_05_Id = 2260;
static const int record_06_Id = 2261;
static const int record_07_Id = 2262;
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;
static const int record_08_Id = 2263;
static const int record_09_Id = 2264;
static const int record_10_Id = 2265;
static const int record_11_Id = 2266;
static const int record_12_Id = 2267;
// TU9
static const int fireball_Id = 385;

View file

@ -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;

View file

@ -259,9 +259,16 @@ void LivingEntity::baseTick()
}
// If lastHurtByMob is dead, remove it
if (lastHurtByMob != nullptr && !lastHurtByMob->isAlive())
if (lastHurtByMob != NULL)
{
setLastHurtByMob(nullptr);
if (!lastHurtByMob->isAlive())
{
setLastHurtByMob(nullptr);
}
else if (tickCount - lastHurtByMobTimestamp > 100)
{
setLastHurtByMob(nullptr);
}
}
// Update effects

View file

@ -51,6 +51,15 @@ ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension)
delete netherFiles;
}
#endif
vector<FileEntry *> *fortressFiles = m_saveFile->getFilesWithPrefix(L"data/Fortress");
if(fortressFiles!=NULL)
{
for (auto& fortressFile : *fortressFiles)
{
m_saveFile->deleteFile(fortressFile);
}
delete fortressFiles;
}
resetNetherPlayerPositions();
}

View file

@ -47,6 +47,11 @@ bool Pig::useNewAi()
return true;
}
bool Pig::removeWhenFarAway()
{
return Animal::removeWhenFarAway() && !hasSaddle();
}
void Pig::registerAttributes()
{
Animal::registerAttributes();

View file

@ -23,6 +23,7 @@ public:
virtual bool useNewAi();
protected:
virtual bool removeWhenFarAway();
virtual void registerAttributes();
virtual void newServerAiStep();

View file

@ -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()

View file

@ -472,6 +472,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))
{

View file

@ -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<AgableMob> Wolf::getBreedOffspring(shared_ptr<AgableMob> target)