From 087b7e7abfe81dd7f0fdcdea36ac9f245950df1a Mon Sep 17 00:00:00 2001 From: Loki Rautio Date: Sat, 7 Mar 2026 21:12:22 -0600 Subject: 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. --- Minecraft.World/ChestTile.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'Minecraft.World/ChestTile.cpp') diff --git a/Minecraft.World/ChestTile.cpp b/Minecraft.World/ChestTile.cpp index ff3c0b40..11178b8a 100644 --- a/Minecraft.World/ChestTile.cpp +++ b/Minecraft.World/ChestTile.cpp @@ -208,18 +208,18 @@ void ChestTile::neighborChanged(Level *level, int x, int y, int z, int type) { BaseEntityTile::neighborChanged(level, x, y, z, type); shared_ptr(cte) = dynamic_pointer_cast(level->getTileEntity(x, y, z)); - if (cte != nullptr) cte->clearCache(); + if (cte != NULL) cte->clearCache(); } void ChestTile::onRemove(Level *level, int x, int y, int z, int id, int data) { shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (container != nullptr ) + if (container != NULL ) { for (unsigned int i = 0; i < container->getContainerSize(); i++) { shared_ptr item = container->getItem(i); - if (item != nullptr) + if (item != NULL) { float xo = random->nextFloat() * 0.8f + 0.1f; float yo = random->nextFloat() * 0.8f + 0.1f; @@ -231,16 +231,16 @@ void ChestTile::onRemove(Level *level, int x, int y, int z, int id, int data) if (count > item->count) count = item->count; item->count -= count; - shared_ptr newItem = std::make_shared(item->id, count, item->getAuxValue()); + shared_ptr newItem = shared_ptr( new ItemInstance(item->id, count, item->getAuxValue()) ); newItem->set4JData( item->get4JData() ); - shared_ptr itemEntity = std::make_shared(level, x + xo, y + yo, z + zo, newItem); + shared_ptr itemEntity = shared_ptr(new ItemEntity(level, x + xo, y + yo, z + zo, newItem ) ); float pow = 0.05f; - itemEntity->xd = static_cast(random->nextGaussian()) * pow; - itemEntity->yd = static_cast(random->nextGaussian()) * pow + 0.2f; - itemEntity->zd = static_cast(random->nextGaussian()) * pow; + itemEntity->xd = (float) random->nextGaussian() * pow; + itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; + itemEntity->zd = (float) random->nextGaussian() * pow; if (item->hasTag()) { - itemEntity->getItem()->setTag(static_cast(item->getTag()->copy())); + itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy()); } level->addEntity(itemEntity); @@ -272,7 +272,7 @@ bool ChestTile::use(Level *level, int x, int y, int z, shared_ptr player } shared_ptr container = getContainer(level, x, y, z); - if (container != nullptr) + if (container != NULL) { player->openContainer(container); } @@ -283,7 +283,7 @@ bool ChestTile::use(Level *level, int x, int y, int z, shared_ptr player shared_ptr ChestTile::getContainer(Level *level, int x, int y, int z) { shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (container == nullptr) return nullptr; + if (container == NULL) return nullptr; if (level->isSolidBlockingTile(x, y + 1, z)) return nullptr; if (isCatSittingOnChest(level,x, y, z)) return nullptr; @@ -293,10 +293,10 @@ shared_ptr ChestTile::getContainer(Level *level, int x, int y, int z) if (level->getTile(x, y, z - 1) == id && (level->isSolidBlockingTile(x, y + 1, z - 1) || isCatSittingOnChest(level, x, y, z - 1))) return nullptr; if (level->getTile(x, y, z + 1) == id && (level->isSolidBlockingTile(x, y + 1, z + 1) || isCatSittingOnChest(level, x, y, z + 1))) return nullptr; - if (level->getTile(x - 1, y, z) == id) container = std::make_shared(IDS_CHEST_LARGE, dynamic_pointer_cast(level->getTileEntity(x - 1, y, z)), container); - if (level->getTile(x + 1, y, z) == id) container = std::make_shared(IDS_CHEST_LARGE, container, dynamic_pointer_cast(level->getTileEntity(x + 1, y, z))); - if (level->getTile(x, y, z - 1) == id) container = std::make_shared(IDS_CHEST_LARGE, dynamic_pointer_cast(level->getTileEntity(x, y, z - 1)), container); - if (level->getTile(x, y, z + 1) == id) container = std::make_shared(IDS_CHEST_LARGE, container, dynamic_pointer_cast(level->getTileEntity(x, y, z + 1))); + if (level->getTile(x - 1, y, z) == id) container = shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast( level->getTileEntity(x - 1, y, z) ), container) ); + if (level->getTile(x + 1, y, z) == id) container = shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast( level->getTileEntity(x + 1, y, z) )) ); + if (level->getTile(x, y, z - 1) == id) container = shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast( level->getTileEntity(x, y, z - 1) ), container) ); + if (level->getTile(x, y, z + 1) == id) container = shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast( level->getTileEntity(x, y, z + 1) )) ); return container; } @@ -304,7 +304,7 @@ shared_ptr ChestTile::getContainer(Level *level, int x, int y, int z) shared_ptr ChestTile::newTileEntity(Level *level) { MemSect(50); - shared_ptr retval = std::make_shared(); + shared_ptr retval = shared_ptr( new ChestTileEntity() ); MemSect(0); return retval; } -- cgit v1.2.3