Revert "Project modernization (#630)"

This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.

This reverts commit a9be52c41a.
This commit is contained in:
Loki Rautio
2026-03-07 21:12:22 -06:00
parent a9be52c41a
commit 087b7e7abf
1373 changed files with 19449 additions and 19903 deletions

View File

@@ -20,7 +20,7 @@ void ItemEntity::_init()
age = 0;
throwTime = 0;
health = 5;
bobOffs = static_cast<float>(Math::random() * PI * 2);
bobOffs = (float) (Math::random() * PI * 2);
// 4J Stu - This function call had to be moved here from the Entity ctor to ensure that
// the derived version of the function is called
@@ -36,11 +36,11 @@ void ItemEntity::_init(Level *level, double x, double y, double z)
setPos(x, y, z);
yRot = static_cast<float>(Math::random() * 360);
yRot = (float) (Math::random() * 360);
xd = static_cast<float>(Math::random() * 0.2f - 0.1f);
xd = (float) (Math::random() * 0.2f - 0.1f);
yd = +0.2f;
zd = static_cast<float>(Math::random() * 0.2f - 0.1f);
zd = (float) (Math::random() * 0.2f - 0.1f);
}
ItemEntity::ItemEntity(Level *level, double x, double y, double z) : Entity(level)
@@ -66,7 +66,7 @@ ItemEntity::ItemEntity(Level *level) : Entity( level )
void ItemEntity::defineSynchedData()
{
getEntityData()->defineNULL(DATA_ITEM, nullptr);
getEntityData()->defineNULL(DATA_ITEM, NULL);
}
void ItemEntity::tick()
@@ -84,7 +84,7 @@ void ItemEntity::tick()
// 4J - added parameter here so that these don't care about colliding with other entities
move(xd, yd, zd, true);
bool moved = static_cast<int>(xo) != static_cast<int>(x) || static_cast<int>(yo) != static_cast<int>(y) || static_cast<int>(zo) != static_cast<int>(z);
bool moved = (int) xo != (int) x || (int) yo != (int) y || (int) zo != (int) z;
if (moved || tickCount % 25 == 0)
{
@@ -192,7 +192,7 @@ bool ItemEntity::hurt(DamageSource *source, float damage)
if (level->isClientSide ) return false;
if (isInvulnerable()) return false;
if (getItem() != nullptr && getItem()->id == Item::netherStar_Id && source->isExplosion()) return false;
if (getItem() != NULL && getItem()->id == Item::netherStar_Id && source->isExplosion()) return false;
markHurt();
health -= damage;
if (health <= 0)
@@ -204,9 +204,9 @@ bool ItemEntity::hurt(DamageSource *source, float damage)
void ItemEntity::addAdditonalSaveData(CompoundTag *entityTag)
{
entityTag->putShort(L"Health", static_cast<byte>(health));
entityTag->putShort(L"Age", static_cast<short>(age));
if (getItem() != nullptr) entityTag->putCompound(L"Item", getItem()->save(new CompoundTag()));
entityTag->putShort(L"Health", (byte) health);
entityTag->putShort(L"Age", (short) age);
if (getItem() != NULL) entityTag->putCompound(L"Item", getItem()->save(new CompoundTag()));
}
void ItemEntity::readAdditionalSaveData(CompoundTag *tag)
@@ -215,7 +215,7 @@ void ItemEntity::readAdditionalSaveData(CompoundTag *tag)
age = tag->getShort(L"Age");
CompoundTag *itemTag = tag->getCompound(L"Item");
setItem(ItemInstance::fromTag(itemTag));
if (getItem() == nullptr) remove();
if (getItem() == NULL) remove();
}
void ItemEntity::playerTouch(shared_ptr<Player> player)
@@ -280,14 +280,14 @@ shared_ptr<ItemInstance> ItemEntity::getItem()
{
shared_ptr<ItemInstance> result = getEntityData()->getItemInstance(DATA_ITEM);
if (result == nullptr)
if (result == NULL)
{
if (level != nullptr)
if (level != NULL)
{
app.DebugPrintf("Item entity %d has no item?!\n", entityId);
//level.getLogger().severe("Item entity " + entityId + " has no item?!");
}
return std::make_shared<ItemInstance>(Tile::stone);
return shared_ptr<ItemInstance>(new ItemInstance(Tile::stone));
}
return result;