aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/FallingTile.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.World/FallingTile.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.World/FallingTile.cpp')
-rw-r--r--Minecraft.World/FallingTile.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/Minecraft.World/FallingTile.cpp b/Minecraft.World/FallingTile.cpp
index c0eb7d22..0ff776fd 100644
--- a/Minecraft.World/FallingTile.cpp
+++ b/Minecraft.World/FallingTile.cpp
@@ -24,7 +24,7 @@ void FallingTile::_init()
hurtEntities = false;
fallDamageMax = 40;
fallDamageAmount = 2;
- tileData = NULL;
+ tileData = nullptr;
// 4J Added so that client-side falling tiles can fall through blocks
// This fixes a bug on the host where the tile update from the server comes in before the client-side falling tile
@@ -136,11 +136,11 @@ void FallingTile::tick()
{
hv->onLand(level, xt, yt, zt, data);
}
- if (tileData != NULL && Tile::tiles[tile]->isEntityTile())
+ if (tileData != nullptr && Tile::tiles[tile]->isEntityTile())
{
shared_ptr<TileEntity> tileEntity = level->getTileEntity(xt, yt, zt);
- if (tileEntity != NULL)
+ if (tileEntity != nullptr)
{
CompoundTag *swap = new CompoundTag();
tileEntity->save(swap);
@@ -161,13 +161,13 @@ void FallingTile::tick()
}
else
{
- if(dropItem && !cancelDrop) spawnAtLocation( shared_ptr<ItemInstance>(new ItemInstance(tile, 1, Tile::tiles[tile]->getSpawnResourcesAuxValue(data))), 0);
+ if(dropItem && !cancelDrop) spawnAtLocation(std::make_shared<ItemInstance>(tile, 1, Tile::tiles[tile]->getSpawnResourcesAuxValue(data)), 0);
}
}
}
else if ( (time > 20 * 5 && !level->isClientSide && (yt < 1 || yt > Level::maxBuildHeight)) || (time > 20 * 30))
{
- if(dropItem) spawnAtLocation( shared_ptr<ItemInstance>( new ItemInstance(tile, 1, Tile::tiles[tile]->getSpawnResourcesAuxValue(data) )), 0);
+ if(dropItem) spawnAtLocation(std::make_shared<ItemInstance>(tile, 1, Tile::tiles[tile]->getSpawnResourcesAuxValue(data)), 0);
remove();
}
}
@@ -212,15 +212,15 @@ void FallingTile::causeFallDamage(float distance)
void FallingTile::addAdditonalSaveData(CompoundTag *tag)
{
- tag->putByte(L"Tile", (byte) tile);
+ tag->putByte(L"Tile", static_cast<byte>(tile));
tag->putInt(L"TileID", tile);
- tag->putByte(L"Data", (byte) data);
- tag->putByte(L"Time", (byte) time);
+ tag->putByte(L"Data", static_cast<byte>(data));
+ tag->putByte(L"Time", static_cast<byte>(time));
tag->putBoolean(L"DropItem", dropItem);
tag->putBoolean(L"HurtEntities", hurtEntities);
tag->putFloat(L"FallHurtAmount", fallDamageAmount);
tag->putInt(L"FallHurtMax", fallDamageMax);
- if (tileData != NULL) tag->putCompound(L"TileEntityData", tileData);
+ if (tileData != nullptr) tag->putCompound(L"TileEntityData", tileData);
}
void FallingTile::readAdditionalSaveData(CompoundTag *tag)