From 28614b922fb77149a54da1a87bebfbc98736f296 Mon Sep 17 00:00:00 2001 From: ModMaker101 <119018978+ModMaker101@users.noreply.github.com> Date: Sun, 8 Mar 2026 19:08:36 -0400 Subject: Modernize project codebase (#906) * 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 * Add safety checks and fix a issue with vector going OOR --- Minecraft.Client/ItemFrameRenderer.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Minecraft.Client/ItemFrameRenderer.cpp') diff --git a/Minecraft.Client/ItemFrameRenderer.cpp b/Minecraft.Client/ItemFrameRenderer.cpp index 2d7493ec..55354aac 100644 --- a/Minecraft.Client/ItemFrameRenderer.cpp +++ b/Minecraft.Client/ItemFrameRenderer.cpp @@ -33,15 +33,15 @@ void ItemFrameRenderer::render(shared_ptr _itemframe, double x, double shared_ptr itemFrame = dynamic_pointer_cast(_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(itemFrame->x - x) - 0.5f; + float yOffs = static_cast(itemFrame->y - y) - 0.5f; + float zOffs = static_cast(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(xt) - xOffs, static_cast(yt) - yOffs, static_cast(zt) - zOffs); drawFrame(itemFrame); drawItem(itemFrame); @@ -110,9 +110,9 @@ void ItemFrameRenderer::drawItem(shared_ptr entity) Minecraft *pMinecraft=Minecraft::GetInstance(); shared_ptr instance = entity->getItem(); - if (instance == NULL) return; + if (instance == nullptr) return; - shared_ptr itemEntity = shared_ptr(new ItemEntity(entity->level, 0, 0, 0, instance)); + shared_ptr itemEntity = std::make_shared(entity->level, 0, 0, 0, instance); itemEntity->getItem()->count = 1; itemEntity->bobOffs = 0; @@ -154,7 +154,7 @@ void ItemFrameRenderer::drawItem(shared_ptr entity) t->end(); shared_ptr 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 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(180 + entity->dir * 90) ), false, true); ct->rot = compassRot; ct->rota = compassRotA; } -- cgit v1.2.3