From 7074f35e4ba831e358117842b99ee35b87f85ae5 Mon Sep 17 00:00:00 2001 From: void_17 Date: Mon, 2 Mar 2026 15:58:20 +0700 Subject: shared_ptr -> std::shared_ptr This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today. --- Minecraft.World/PistonBaseTile.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'Minecraft.World/PistonBaseTile.cpp') diff --git a/Minecraft.World/PistonBaseTile.cpp b/Minecraft.World/PistonBaseTile.cpp index cbad5cec..ab8199c3 100644 --- a/Minecraft.World/PistonBaseTile.cpp +++ b/Minecraft.World/PistonBaseTile.cpp @@ -119,12 +119,12 @@ bool PistonBaseTile::isSolidRender(bool isServerLevel) return false; } -bool PistonBaseTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool PistonBaseTile::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { return false; } -void PistonBaseTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +void PistonBaseTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) { int targetData = getNewFacing(level, x, y, z, dynamic_pointer_cast(by) ); level->setData(x, y, z, targetData); @@ -180,7 +180,7 @@ void PistonBaseTile::checkIfExtend(Level *level, int x, int y, int z) * This method checks neighbor signals for this block and the block above, * and directly beneath. However, it avoids checking blocks that would be * pushed by this block. - * + * * @param level * @param x * @param y @@ -249,7 +249,7 @@ void PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, else if (param1 == TRIGGER_CONTRACT) { PIXBeginNamedEvent(0,"Contract phase A\n"); - shared_ptr prevTileEntity = level->getTileEntity(x + Facing::STEP_X[facing], y + Facing::STEP_Y[facing], z + Facing::STEP_Z[facing]); + std::shared_ptr prevTileEntity = level->getTileEntity(x + Facing::STEP_X[facing], y + Facing::STEP_Y[facing], z + Facing::STEP_Z[facing]); if (prevTileEntity != NULL && dynamic_pointer_cast(prevTileEntity) != NULL) { dynamic_pointer_cast(prevTileEntity)->finalTick(); @@ -280,10 +280,10 @@ void PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, // the block two steps away is a moving piston block piece, // so replace it with the real data, since it's probably // this piston which is changing too fast - shared_ptr tileEntity = level->getTileEntity(twoX, twoY, twoZ); + std::shared_ptr tileEntity = level->getTileEntity(twoX, twoY, twoZ); if (tileEntity != NULL && dynamic_pointer_cast(tileEntity) != NULL ) { - shared_ptr ppe = dynamic_pointer_cast(tileEntity); + std::shared_ptr ppe = dynamic_pointer_cast(tileEntity); if (ppe->getFacing() == facing && ppe->isExtending()) { @@ -337,7 +337,7 @@ void PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, ignoreUpdate(false); } -void PistonBaseTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void PistonBaseTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { int data = (forceData == -1 ) ? level->getData(x, y, z) : forceData; @@ -377,7 +377,7 @@ void PistonBaseTile::updateDefaultShape() setShape(0, 0, 0, 1, 1, 1); } -void PistonBaseTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) +void PistonBaseTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, std::shared_ptr source) { setShape(0, 0, 0, 1, 1, 1); Tile::addAABBs(level, x, y, z, box, boxes, source); @@ -404,9 +404,9 @@ bool PistonBaseTile::isExtended(int data) return (data & EXTENDED_BIT) != 0; } -int PistonBaseTile::getNewFacing(Level *level, int x, int y, int z, shared_ptr player) +int PistonBaseTile::getNewFacing(Level *level, int x, int y, int z, std::shared_ptr player) { - if (Mth::abs((float) player->x - x) < 2 && Mth::abs((float) player->z - z) < 2) + if (Mth::abs((float) player->x - x) < 2 && Mth::abs((float) player->z - z) < 2) { // If the player is above the block, the slot is on the top double py = player->y + 1.82 - player->heightOffset; @@ -456,7 +456,7 @@ bool PistonBaseTile::isPushable(int block, Level *level, int cx, int cy, int cz, { return false; } - + if (!allowDestroyable && Tile::tiles[block]->getPistonPushReaction() == Material::PUSH_DESTROY) { return false; @@ -486,7 +486,7 @@ bool PistonBaseTile::canPush(Level *level, int sx, int sy, int sz, int facing) // out of bounds return false; } - + // 4J - added to also check for out of bounds in x/z for our finite world int minXZ = - (level->dimension->getXZSize() * 16 ) / 2; int maxXZ = (level->dimension->getXZSize() * 16 ) / 2 - 1; @@ -529,7 +529,7 @@ bool PistonBaseTile::canPush(Level *level, int sx, int sy, int sz, int facing) void PistonBaseTile::stopSharingIfServer(Level *level, int x, int y, int z) { if( !level->isClientSide ) - { + { MultiPlayerLevel *clientLevel = Minecraft::GetInstance()->getLevel(level->dimension->id); if( clientLevel ) { @@ -552,7 +552,7 @@ bool PistonBaseTile::createPush(Level *level, int sx, int sy, int sz, int facing // out of bounds return false; } - + // 4J - added to also check for out of bounds in x/z for our finite world int minXZ = - (level->dimension->getXZSize() * 16 ) / 2; int maxXZ = (level->dimension->getXZSize() * 16 ) / 2 - 1; -- cgit v1.2.3