aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/MinecartContainer.cpp
diff options
context:
space:
mode:
authorLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
committerLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
commit087b7e7abfe81dd7f0fdcdea36ac9f245950df1a (patch)
tree69454763e73ca764af4e682d3573080b13138a0e /Minecraft.World/MinecartContainer.cpp
parenta9be52c41a02d207233199e98898fe7483d7e817 (diff)
Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore functionality of the nightly. All in-game menus do not work and generating a world crashes. This reverts commit a9be52c41a02d207233199e98898fe7483d7e817.
Diffstat (limited to 'Minecraft.World/MinecartContainer.cpp')
-rw-r--r--Minecraft.World/MinecartContainer.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/Minecraft.World/MinecartContainer.cpp b/Minecraft.World/MinecartContainer.cpp
index 0e0fd3ac..20bfc4ea 100644
--- a/Minecraft.World/MinecartContainer.cpp
+++ b/Minecraft.World/MinecartContainer.cpp
@@ -33,7 +33,7 @@ void MinecartContainer::destroy(DamageSource *source)
for (int i = 0; i < getContainerSize(); i++)
{
shared_ptr<ItemInstance> item = getItem(i);
- if (item != nullptr)
+ if (item != NULL)
{
float xo = random->nextFloat() * 0.8f + 0.1f;
float yo = random->nextFloat() * 0.8f + 0.1f;
@@ -45,11 +45,11 @@ void MinecartContainer::destroy(DamageSource *source)
if (count > item->count) count = item->count;
item->count -= count;
- 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())));
+ 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()))) );
float pow = 0.05f;
- 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;
+ itemEntity->xd = (float) random->nextGaussian() * pow;
+ itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f;
+ itemEntity->zd = (float) random->nextGaussian() * pow;
level->addEntity(itemEntity);
}
}
@@ -63,7 +63,7 @@ shared_ptr<ItemInstance> MinecartContainer::getItem(unsigned int slot)
shared_ptr<ItemInstance> MinecartContainer::removeItem(unsigned int slot, int count)
{
- if (items[slot] != nullptr)
+ if (items[slot] != NULL)
{
if (items[slot]->count <= count)
{
@@ -83,7 +83,7 @@ shared_ptr<ItemInstance> MinecartContainer::removeItem(unsigned int slot, int co
shared_ptr<ItemInstance> MinecartContainer::removeItemNoUpdate(int slot)
{
- if (items[slot] != nullptr)
+ if (items[slot] != NULL)
{
shared_ptr<ItemInstance> item = items[slot];
items[slot] = nullptr;
@@ -95,7 +95,7 @@ shared_ptr<ItemInstance> MinecartContainer::removeItemNoUpdate(int slot)
void MinecartContainer::setItem(unsigned int slot, shared_ptr<ItemInstance> item)
{
items[slot] = item;
- if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize();
+ if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize();
}
void MinecartContainer::setChanged()
@@ -145,7 +145,7 @@ void MinecartContainer::remove()
for (int i = 0; i < getContainerSize(); i++)
{
shared_ptr<ItemInstance> item = getItem(i);
- if (item != nullptr)
+ if (item != NULL)
{
float xo = random->nextFloat() * 0.8f + 0.1f;
float yo = random->nextFloat() * 0.8f + 0.1f;
@@ -157,17 +157,17 @@ void MinecartContainer::remove()
if (count > item->count) count = item->count;
item->count -= count;
- 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())));
+ 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()))));
if (item->hasTag())
{
- itemEntity->getItem()->setTag(static_cast<CompoundTag *>(item->getTag()->copy()));
+ itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy());
}
float pow = 0.05f;
- 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;
+ itemEntity->xd = (float) random->nextGaussian() * pow;
+ itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f;
+ itemEntity->zd = (float) random->nextGaussian() * pow;
level->addEntity(itemEntity);
}
}
@@ -185,10 +185,10 @@ void MinecartContainer::addAdditonalSaveData(CompoundTag *base)
for (int i = 0; i < items.length; i++)
{
- if (items[i] != nullptr)
+ if (items[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
- tag->putByte(L"Slot", static_cast<byte>(i));
+ tag->putByte(L"Slot", (byte) i);
items[i]->save(tag);
listTag->add(tag);
}