From a9be52c41a02d207233199e98898fe7483d7e817 Mon Sep 17 00:00:00 2001 From: ModMaker101 <119018978+ModMaker101@users.noreply.github.com> Date: Sat, 7 Mar 2026 21:56:03 -0500 Subject: 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 --- Minecraft.World/CommandBlock.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Minecraft.World/CommandBlock.cpp') diff --git a/Minecraft.World/CommandBlock.cpp b/Minecraft.World/CommandBlock.cpp index e1b6b8dd..c151172e 100644 --- a/Minecraft.World/CommandBlock.cpp +++ b/Minecraft.World/CommandBlock.cpp @@ -10,7 +10,7 @@ CommandBlock::CommandBlock(int id) : BaseEntityTile(id, Material::metal, isSolid shared_ptr CommandBlock::newTileEntity(Level *level) { - return shared_ptr( new CommandBlockEntity() ); + return std::make_shared(); } void CommandBlock::neighborChanged(Level *level, int x, int y, int z, int type) @@ -38,7 +38,7 @@ void CommandBlock::tick(Level *level, int x, int y, int z, Random *random) { shared_ptr tileEntity = level->getTileEntity(x, y, z); - if (tileEntity != NULL && dynamic_pointer_cast( tileEntity ) != NULL) + if (tileEntity != nullptr && dynamic_pointer_cast( tileEntity ) != nullptr) { shared_ptr commandBlock = dynamic_pointer_cast( tileEntity ); commandBlock->setSuccessCount(commandBlock->performCommand(level)); @@ -55,7 +55,7 @@ bool CommandBlock::use(Level *level, int x, int y, int z, shared_ptr pla { shared_ptr amce = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (amce != NULL) + if (amce != nullptr) { player->openTextEdit(amce); } @@ -72,7 +72,7 @@ int CommandBlock::getAnalogOutputSignal(Level *level, int x, int y, int z, int d { shared_ptr tileEntity = level->getTileEntity(x, y, z); - if (tileEntity != NULL && dynamic_pointer_cast( tileEntity ) != NULL) + if (tileEntity != nullptr && dynamic_pointer_cast( tileEntity ) != nullptr) { return dynamic_pointer_cast( tileEntity )->getSuccessCount(); } -- cgit v1.2.3