aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/BrewingStandTile.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/BrewingStandTile.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/BrewingStandTile.cpp')
-rw-r--r--Minecraft.World/BrewingStandTile.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/Minecraft.World/BrewingStandTile.cpp b/Minecraft.World/BrewingStandTile.cpp
index 1aeb52d8..ec7242c8 100644
--- a/Minecraft.World/BrewingStandTile.cpp
+++ b/Minecraft.World/BrewingStandTile.cpp
@@ -10,7 +10,7 @@
BrewingStandTile::BrewingStandTile(int id) : BaseEntityTile(id, Material::metal, isSolidRender())
{
random = new Random();
- iconBase = NULL;
+ iconBase = nullptr;
}
BrewingStandTile::~BrewingStandTile()
@@ -30,7 +30,7 @@ int BrewingStandTile::getRenderShape()
shared_ptr<TileEntity> BrewingStandTile::newTileEntity(Level *level)
{
- return shared_ptr<TileEntity>(new BrewingStandTileEntity());
+ return std::make_shared<BrewingStandTileEntity>();
}
bool BrewingStandTile::isCubeShaped()
@@ -60,7 +60,7 @@ bool BrewingStandTile::use(Level *level, int x, int y, int z, shared_ptr<Player>
return true;
}
shared_ptr<BrewingStandTileEntity> brewingStand = dynamic_pointer_cast<BrewingStandTileEntity>(level->getTileEntity(x, y, z));
- if (brewingStand != NULL) player->openBrewingStand(brewingStand);
+ if (brewingStand != nullptr) player->openBrewingStand(brewingStand);
return true;
}
@@ -86,13 +86,13 @@ void BrewingStandTile::animateTick(Level *level, int xt, int yt, int zt, Random
void BrewingStandTile::onRemove(Level *level, int x, int y, int z, int id, int data)
{
shared_ptr<TileEntity> tileEntity = level->getTileEntity(x, y, z);
- if (tileEntity != NULL && ( dynamic_pointer_cast<BrewingStandTileEntity>(tileEntity) != NULL) )
+ if (tileEntity != nullptr && ( dynamic_pointer_cast<BrewingStandTileEntity>(tileEntity) != nullptr) )
{
shared_ptr<BrewingStandTileEntity> container = dynamic_pointer_cast<BrewingStandTileEntity>(tileEntity);
for (int i = 0; i < container->getContainerSize(); i++)
{
shared_ptr<ItemInstance> item = container->getItem(i);
- if (item != NULL)
+ if (item != nullptr)
{
float xo = random->nextFloat() * 0.8f + 0.1f;
float yo = random->nextFloat() * 0.8f + 0.1f;
@@ -104,14 +104,14 @@ void BrewingStandTile::onRemove(Level *level, int x, int y, int z, int id, int d
if (count > item->count) count = item->count;
item->count -= count;
- shared_ptr<ItemEntity> itemEntity = shared_ptr<ItemEntity>(new ItemEntity(level, x + xo, y + yo, z + zo, shared_ptr<ItemInstance>( new ItemInstance(item->id, count, item->getAuxValue()))));
+ shared_ptr<ItemEntity> itemEntity = std::make_shared<ItemEntity>(level, x + xo, y + yo, z + zo, shared_ptr<ItemInstance>(new ItemInstance(item->id, count, item->getAuxValue())));
float pow = 0.05f;
- itemEntity->xd = (float) random->nextGaussian() * pow;
- itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f;
- itemEntity->zd = (float) random->nextGaussian() * pow;
+ itemEntity->xd = static_cast<float>(random->nextGaussian()) * pow;
+ itemEntity->yd = static_cast<float>(random->nextGaussian()) * pow + 0.2f;
+ itemEntity->zd = static_cast<float>(random->nextGaussian()) * pow;
if (item->hasTag())
{
- itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy());
+ itemEntity->getItem()->setTag(static_cast<CompoundTag *>(item->getTag()->copy()));
}
level->addEntity(itemEntity);
}