Project modernization (#630)

* Fixed boats falling and a TP glitch #266

* Replaced every C-style cast with C++ ones

* Replaced every C-style cast with C++ ones

* Fixed boats falling and a TP glitch #266

* Updated NULL to nullptr and fixing some type issues

* Modernized and fixed a few bugs

- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.

* Fixing more conflicts

* Replace int loops with size_t and start work on overrides
This commit is contained in:
ModMaker101
2026-03-07 21:56:03 -05:00
committed by GitHub
parent 1be5faaea7
commit a9be52c41a
1373 changed files with 19903 additions and 19449 deletions

View File

@@ -15,7 +15,7 @@ FireworksRocketEntity::FireworksRocketEntity(Level *level) : Entity(level)
void FireworksRocketEntity::defineSynchedData()
{
entityData->defineNULL(DATA_ID_FIREWORKS_ITEM, NULL);
entityData->defineNULL(DATA_ID_FIREWORKS_ITEM, nullptr);
}
bool FireworksRocketEntity::shouldRenderAtSqrDistance(double distance)
@@ -35,13 +35,13 @@ FireworksRocketEntity::FireworksRocketEntity(Level *level, double x, double y, d
heightOffset = 0;
int flightCount = 1;
if (sourceItem != NULL && sourceItem->hasTag())
if (sourceItem != nullptr && sourceItem->hasTag())
{
entityData->set(DATA_ID_FIREWORKS_ITEM, sourceItem);
CompoundTag *tag = sourceItem->getTag();
CompoundTag *compound = tag->getCompound(FireworksItem::TAG_FIREWORKS);
if (compound != NULL)
if (compound != nullptr)
{
flightCount += compound->getByte(FireworksItem::TAG_FLIGHT);
}
@@ -61,8 +61,8 @@ void FireworksRocketEntity::lerpMotion(double xd, double yd, double zd)
if (xRotO == 0 && yRotO == 0)
{
double sd = Mth::sqrt(xd * xd + zd * zd);
yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI);
xRotO = xRot = (float) (atan2(yd, sd) * 180 / PI);
yRotO = yRot = static_cast<float>(atan2(xd, zd) * 180 / PI);
xRotO = xRot = static_cast<float>(atan2(yd, sd) * 180 / PI);
}
}
@@ -79,8 +79,8 @@ void FireworksRocketEntity::tick()
move(xd, yd, zd);
double sd = Mth::sqrt(xd * xd + zd * zd);
yRot = (float) (atan2(xd, zd) * 180 / PI);
xRot = (float) (atan2(yd, sd) * 180 / PI);
yRot = static_cast<float>(atan2(xd, zd) * 180 / PI);
xRot = static_cast<float>(atan2(yd, sd) * 180 / PI);
while (xRot - xRotO < -180)
xRotO -= 360;
@@ -120,8 +120,8 @@ void FireworksRocketEntity::handleEntityEvent(byte eventId)
if (eventId == EntityEvent::FIREWORKS_EXPLODE && level->isClientSide)
{
shared_ptr<ItemInstance> sourceItem = entityData->getItemInstance(DATA_ID_FIREWORKS_ITEM);
CompoundTag *tag = NULL;
if (sourceItem != NULL && sourceItem->hasTag())
CompoundTag *tag = nullptr;
if (sourceItem != nullptr && sourceItem->hasTag())
{
tag = sourceItem->getTag()->getCompound(FireworksItem::TAG_FIREWORKS);
}
@@ -135,7 +135,7 @@ void FireworksRocketEntity::addAdditonalSaveData(CompoundTag *tag)
tag->putInt(L"Life", life);
tag->putInt(L"LifeTime", lifetime);
shared_ptr<ItemInstance> itemInstance = entityData->getItemInstance(DATA_ID_FIREWORKS_ITEM);
if (itemInstance != NULL)
if (itemInstance != nullptr)
{
CompoundTag *itemTag = new CompoundTag();
itemInstance->save(itemTag);
@@ -150,10 +150,10 @@ void FireworksRocketEntity::readAdditionalSaveData(CompoundTag *tag)
lifetime = tag->getInt(L"LifeTime");
CompoundTag *itemTag = tag->getCompound(L"FireworksItem");
if (itemTag != NULL)
if (itemTag != nullptr)
{
shared_ptr<ItemInstance> fromTag = ItemInstance::fromTag(itemTag);
if (fromTag != NULL)
if (fromTag != nullptr)
{
entityData->set(DATA_ID_FIREWORKS_ITEM, fromTag);
}