aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/ItemFrameRenderer.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-07 21:56:03 -0500
committerGitHub <noreply@github.com>2026-03-08 09:56:03 +0700
commita9be52c41a02d207233199e98898fe7483d7e817 (patch)
tree71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.Client/ItemFrameRenderer.cpp
parent1be5faaea781402e7de06b263eeca4c688b7712c (diff)
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
Diffstat (limited to 'Minecraft.Client/ItemFrameRenderer.cpp')
-rw-r--r--Minecraft.Client/ItemFrameRenderer.cpp16
1 files changed, 8 insertions, 8 deletions
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<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;
}