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/PistonPieceRenderer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Minecraft.Client/PistonPieceRenderer.cpp') diff --git a/Minecraft.Client/PistonPieceRenderer.cpp b/Minecraft.Client/PistonPieceRenderer.cpp index c51d2e0f..0982e69a 100644 --- a/Minecraft.Client/PistonPieceRenderer.cpp +++ b/Minecraft.Client/PistonPieceRenderer.cpp @@ -12,7 +12,7 @@ ResourceLocation PistonPieceRenderer::SIGN_LOCATION = ResourceLocation(TN_ITEM_S PistonPieceRenderer::PistonPieceRenderer() { - tileRenderer = NULL; + tileRenderer = nullptr; } void PistonPieceRenderer::render(shared_ptr _entity, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) @@ -21,7 +21,7 @@ void PistonPieceRenderer::render(shared_ptr _entity, double x, doubl shared_ptr entity = dynamic_pointer_cast(_entity); Tile *tile = Tile::tiles[entity->getId()]; - if (tile != NULL && entity->getProgress(a) <= 1) // 4J - changed condition from < to <= as our chunk update is async to main thread and so we can have to render these with progress of 1 + if (tile != nullptr && entity->getProgress(a) <= 1) // 4J - changed condition from < to <= as our chunk update is async to main thread and so we can have to render these with progress of 1 { Tesselator *t = Tesselator::getInstance(); bindTexture(&TextureAtlas::LOCATION_BLOCKS); @@ -35,7 +35,7 @@ void PistonPieceRenderer::render(shared_ptr _entity, double x, doubl t->begin(); - t->offset((float) x - entity->x + entity->getXOff(a), (float) y - entity->y + entity->getYOff(a), (float) z - entity->z + entity->getZOff(a)); + t->offset(static_cast(x) - entity->x + entity->getXOff(a), static_cast(y) - entity->y + entity->getYOff(a), static_cast(z) - entity->z + entity->getZOff(a)); t->color(1, 1, 1); if (tile == Tile::pistonExtension && entity->getProgress(a) < 0.5f) { @@ -45,11 +45,11 @@ void PistonPieceRenderer::render(shared_ptr _entity, double x, doubl else if (entity->isSourcePiston() && !entity->isExtending()) { // special case for withdrawing the arm back into the base - Tile::pistonExtension->setOverrideTopTexture(((PistonBaseTile *) tile)->getPlatformTexture()); + Tile::pistonExtension->setOverrideTopTexture(static_cast(tile)->getPlatformTexture()); tileRenderer->tesselatePistonArmNoCulling(Tile::pistonExtension, entity->x, entity->y, entity->z, entity->getProgress(a) < 0.5f, entity->getData()); Tile::pistonExtension->clearOverrideTopTexture(); - t->offset((float) x - entity->x, (float) y - entity->y, (float) z - entity->z); + t->offset(static_cast(x) - entity->x, static_cast(y) - entity->y, static_cast(z) - entity->z); tileRenderer->tesselatePistonBaseForceExtended(tile, entity->x, entity->y, entity->z, entity->getData()); } else -- cgit v1.2.3