aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/CommandBlock.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-08 19:08:36 -0400
committerGitHub <noreply@github.com>2026-03-08 18:08:36 -0500
commit28614b922fb77149a54da1a87bebfbc98736f296 (patch)
tree7f828ba86a4ee18d0a80d29de64f6199a5412512 /Minecraft.World/CommandBlock.cpp
parent88798b501d0cf6287b6f87acb2592676e3cec58d (diff)
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
Diffstat (limited to 'Minecraft.World/CommandBlock.cpp')
-rw-r--r--Minecraft.World/CommandBlock.cpp8
1 files changed, 4 insertions, 4 deletions
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<TileEntity> CommandBlock::newTileEntity(Level *level)
{
- return shared_ptr<CommandBlockEntity>( new CommandBlockEntity() );
+ return std::make_shared<CommandBlockEntity>();
}
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> tileEntity = level->getTileEntity(x, y, z);
- if (tileEntity != NULL && dynamic_pointer_cast<CommandBlockEntity>( tileEntity ) != NULL)
+ if (tileEntity != nullptr && dynamic_pointer_cast<CommandBlockEntity>( tileEntity ) != nullptr)
{
shared_ptr<CommandBlockEntity> commandBlock = dynamic_pointer_cast<CommandBlockEntity>( tileEntity );
commandBlock->setSuccessCount(commandBlock->performCommand(level));
@@ -55,7 +55,7 @@ bool CommandBlock::use(Level *level, int x, int y, int z, shared_ptr<Player> pla
{
shared_ptr<CommandBlockEntity> amce = dynamic_pointer_cast<CommandBlockEntity>( 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> tileEntity = level->getTileEntity(x, y, z);
- if (tileEntity != NULL && dynamic_pointer_cast<CommandBlockEntity>( tileEntity ) != NULL)
+ if (tileEntity != nullptr && dynamic_pointer_cast<CommandBlockEntity>( tileEntity ) != nullptr)
{
return dynamic_pointer_cast<CommandBlockEntity>( tileEntity )->getSuccessCount();
}