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

@@ -33,15 +33,15 @@ void ItemFrameRenderer::render(shared_ptr<Entity> _itemframe, double x, double
shared_ptr<ItemFrame> itemFrame = dynamic_pointer_cast<ItemFrame>(_itemframe);
glPushMatrix();
float xOffs = (float) (itemFrame->x - x) - 0.5f;
float yOffs = (float) (itemFrame->y - y) - 0.5f;
float zOffs = (float) (itemFrame->z - z) - 0.5f;
float xOffs = static_cast<float>(itemFrame->x - x) - 0.5f;
float yOffs = static_cast<float>(itemFrame->y - y) - 0.5f;
float zOffs = static_cast<float>(itemFrame->z - z) - 0.5f;
int xt = itemFrame->xTile + Direction::STEP_X[itemFrame->dir];
int yt = itemFrame->yTile;
int zt = itemFrame->zTile + Direction::STEP_Z[itemFrame->dir];
glTranslatef((float) xt - xOffs, (float) yt - yOffs, (float) zt - zOffs);
glTranslatef(static_cast<float>(xt) - xOffs, static_cast<float>(yt) - yOffs, static_cast<float>(zt) - zOffs);
drawFrame(itemFrame);
drawItem(itemFrame);
@@ -110,9 +110,9 @@ void ItemFrameRenderer::drawItem(shared_ptr<ItemFrame> entity)
Minecraft *pMinecraft=Minecraft::GetInstance();
shared_ptr<ItemInstance> instance = entity->getItem();
if (instance == NULL) return;
if (instance == nullptr) return;
shared_ptr<ItemEntity> itemEntity = shared_ptr<ItemEntity>(new ItemEntity(entity->level, 0, 0, 0, instance));
shared_ptr<ItemEntity> itemEntity = std::make_shared<ItemEntity>(entity->level, 0, 0, 0, instance);
itemEntity->getItem()->count = 1;
itemEntity->bobOffs = 0;
@@ -154,7 +154,7 @@ void ItemFrameRenderer::drawItem(shared_ptr<ItemFrame> entity)
t->end();
shared_ptr<MapItemSavedData> data = Item::map->getSavedData(itemEntity->getItem(), entity->level);
if (data != NULL)
if (data != nullptr)
{
entityRenderDispatcher->itemInHandRenderer->minimap->render(nullptr, entityRenderDispatcher->textures, data, entity->entityId);
}
@@ -168,7 +168,7 @@ void ItemFrameRenderer::drawItem(shared_ptr<ItemFrame> entity)
double compassRotA = ct->rota;
ct->rot = 0;
ct->rota = 0;
ct->updateFromPosition(entity->level, entity->x, entity->z, Mth::wrapDegrees( (float)(180 + entity->dir * 90) ), false, true);
ct->updateFromPosition(entity->level, entity->x, entity->z, Mth::wrapDegrees( static_cast<float>(180 + entity->dir * 90) ), false, true);
ct->rot = compassRot;
ct->rota = compassRotA;
}