mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-07 22:38:55 +00:00
Merge branch 'smartcmd:main' into main
This commit is contained in:
commit
39ecbf7b7f
8
.gitattributes
vendored
8
.gitattributes
vendored
|
|
@ -1,8 +0,0 @@
|
|||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.ogg filter=lfs diff=lfs merge=lfs -text
|
||||
*.binka filter=lfs diff=lfs merge=lfs -text
|
||||
*.arc filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.ico filter=lfs diff=lfs merge=lfs -text
|
||||
|
|
@ -344,6 +344,7 @@ void GameRuleManager::writeRuleFile(DataOutputStream *dos)
|
|||
// Write schematic files.
|
||||
unordered_map<wstring, ConsoleSchematicFile *> *files;
|
||||
files = getLevelGenerationOptions()->getUnfinishedSchematicFiles();
|
||||
dos->writeInt((int)files->size());
|
||||
for ( auto& it : *files )
|
||||
{
|
||||
const wstring& filename = it.first;
|
||||
|
|
@ -497,17 +498,36 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
|||
}*/
|
||||
|
||||
// subfile
|
||||
// Old saves didn't write a numFiles count before the schematic entries.
|
||||
// Detect this: a real count is small, but a UTF filename prefix reads as a large int.
|
||||
UINT numFiles = contentDis->readInt();
|
||||
for (UINT i = 0; i < numFiles; i++)
|
||||
|
||||
if (lgo->isFromSave() && numFiles > 100)
|
||||
{
|
||||
wstring sFilename = contentDis->readUTF();
|
||||
int length = contentDis->readInt();
|
||||
byteArray ba( length );
|
||||
|
||||
contentDis->read(ba);
|
||||
|
||||
levelGenerator->loadSchematicFile(sFilename, ba.data, ba.length);
|
||||
contentDis->skip(-4);
|
||||
while (true)
|
||||
{
|
||||
int peek = contentDis->readInt();
|
||||
if (peek <= 100) { contentDis->skip(-4); break; }
|
||||
contentDis->skip(-4);
|
||||
|
||||
wstring sFilename = contentDis->readUTF();
|
||||
int length = contentDis->readInt();
|
||||
byteArray ba( length );
|
||||
contentDis->read(ba);
|
||||
levelGenerator->loadSchematicFile(sFilename, ba.data, ba.length);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (UINT i = 0; i < numFiles; i++)
|
||||
{
|
||||
wstring sFilename = contentDis->readUTF();
|
||||
int length = contentDis->readInt();
|
||||
byteArray ba( length );
|
||||
contentDis->read(ba);
|
||||
levelGenerator->loadSchematicFile(sFilename, ba.data, ba.length);
|
||||
}
|
||||
}
|
||||
|
||||
LEVEL_GEN_ID lgoID = LEVEL_GEN_ID_NULL;
|
||||
|
|
|
|||
|
|
@ -195,8 +195,8 @@ void IUIScene_HUD::renderPlayerHealth()
|
|||
// Update health
|
||||
bool blink = pMinecraft->localplayers[iPad]->invulnerableTime / 3 % 2 == 1;
|
||||
if (pMinecraft->localplayers[iPad]->invulnerableTime < 10) blink = false;
|
||||
int currentHealth = pMinecraft->localplayers[iPad]->getHealth();
|
||||
int oldHealth = pMinecraft->localplayers[iPad]->lastHealth;
|
||||
int currentHealth = static_cast<int>(ceil(pMinecraft->localplayers[iPad]->getHealth()));
|
||||
int oldHealth = static_cast<int>(ceil(pMinecraft->localplayers[iPad]->lastHealth));
|
||||
bool bHasPoison = pMinecraft->localplayers[iPad]->hasEffect(MobEffect::poison);
|
||||
bool bHasWither = pMinecraft->localplayers[iPad]->hasEffect(MobEffect::wither);
|
||||
AttributeInstance *maxHealthAttribute = pMinecraft->localplayers[iPad]->getAttribute(SharedMonsterAttributes::MAX_HEALTH);
|
||||
|
|
|
|||
|
|
@ -578,9 +578,12 @@ bool UIScene::handleMouseClick(F32 x, F32 y)
|
|||
if (bestCtrl->getControlType() == UIControl::eCheckBox)
|
||||
{
|
||||
UIControl_CheckBox *cb = static_cast<UIControl_CheckBox*>(bestCtrl);
|
||||
bool newState = !cb->IsChecked();
|
||||
cb->setChecked(newState);
|
||||
handleCheckboxToggled((F64)bestId, newState);
|
||||
if (cb->IsEnabled())
|
||||
{
|
||||
bool newState = !cb->IsChecked();
|
||||
cb->setChecked(newState);
|
||||
handleCheckboxToggled((F64)bestId, newState);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,18 +24,21 @@ bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z)
|
|||
|
||||
bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z, bool force)
|
||||
{
|
||||
if( !force )
|
||||
//Will only spawn a bonus chest if the world is new and has never been saved.
|
||||
if (level->isNew)
|
||||
{
|
||||
int t = 0;
|
||||
while (((t = level->getTile(x, y, z)) == 0 || t == Tile::leaves_Id) && y > 1)
|
||||
if( !force )
|
||||
{
|
||||
int t = 0;
|
||||
while (((t = level->getTile(x, y, z)) == 0 || t == Tile::leaves_Id) && y > 1)
|
||||
y--;
|
||||
|
||||
if (y < 1)
|
||||
{
|
||||
return false;
|
||||
if (y < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
|
@ -85,4 +88,6 @@ bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z,
|
|||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -410,9 +410,14 @@ bool EnderMan::hurt(DamageSource *source, float damage)
|
|||
|
||||
if ( dynamic_cast<EntityDamageSource *>(source) != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER))
|
||||
{
|
||||
aggroedByPlayer = true;
|
||||
if (!dynamic_pointer_cast<Player>(source->getEntity())->abilities.invulnerable)
|
||||
{
|
||||
aggroedByPlayer = true;
|
||||
}
|
||||
else setCreepy(false);
|
||||
}
|
||||
|
||||
|
||||
if (dynamic_cast<IndirectEntityDamageSource *>(source) != nullptr)
|
||||
{
|
||||
aggroedByPlayer = false;
|
||||
|
|
|
|||
|
|
@ -515,6 +515,15 @@ bool EntityHorse::canSpawn()
|
|||
return Animal::canSpawn();
|
||||
}
|
||||
|
||||
bool EntityHorse::removeWhenFarAway()
|
||||
{
|
||||
if (isTamed()) return false;
|
||||
if (isSaddled()) return false;
|
||||
if (isLeashed()) return false;
|
||||
if (getArmorType() > 0) return false;
|
||||
return Animal::removeWhenFarAway();
|
||||
}
|
||||
|
||||
|
||||
shared_ptr<EntityHorse> EntityHorse::getClosestMommy(shared_ptr<Entity> baby, double searchRadius)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ private:
|
|||
public:
|
||||
virtual void containerChanged();
|
||||
virtual bool canSpawn();
|
||||
virtual bool removeWhenFarAway() override;
|
||||
|
||||
protected:
|
||||
virtual shared_ptr<EntityHorse> getClosestMommy(shared_ptr<Entity> baby, double searchRadius);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,14 @@ bool Monster::hurt(DamageSource *source, float dmg)
|
|||
|
||||
if (sourceEntity != shared_from_this())
|
||||
{
|
||||
attackTarget = sourceEntity;
|
||||
if (sourceEntity->instanceof(eTYPE_PLAYER))
|
||||
{
|
||||
if (!dynamic_pointer_cast<Player>(sourceEntity)->abilities.invulnerable)
|
||||
{
|
||||
attackTarget = sourceEntity;
|
||||
}
|
||||
}
|
||||
else attackTarget = sourceEntity;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue