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/FurnaceTileEntity.cpp | 42 +++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'Minecraft.World/FurnaceTileEntity.cpp') diff --git a/Minecraft.World/FurnaceTileEntity.cpp b/Minecraft.World/FurnaceTileEntity.cpp index 901235c0..1aa2c300 100644 --- a/Minecraft.World/FurnaceTileEntity.cpp +++ b/Minecraft.World/FurnaceTileEntity.cpp @@ -53,7 +53,7 @@ shared_ptr FurnaceTileEntity::removeItem(unsigned int slot, int co { m_charcoalUsed = false; - if (items[slot] != nullptr) + if (items[slot] != NULL) { if (items[slot]->count <= count) { @@ -79,7 +79,7 @@ shared_ptr FurnaceTileEntity::removeItemNoUpdate(int slot) { m_charcoalUsed = false; - if (items[slot] != nullptr) + if (items[slot] != NULL) { shared_ptr item = items[slot]; items[slot] = nullptr; @@ -92,7 +92,7 @@ shared_ptr FurnaceTileEntity::removeItemNoUpdate(int slot) void FurnaceTileEntity::setItem(unsigned int slot, shared_ptr item) { items[slot] = item; - if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); } @@ -140,16 +140,16 @@ void FurnaceTileEntity::load(CompoundTag *base) void FurnaceTileEntity::save(CompoundTag *base) { TileEntity::save(base); - base->putShort(L"BurnTime", static_cast(litTime)); - base->putShort(L"CookTime", static_cast(tickCount)); + base->putShort(L"BurnTime", (short) (litTime)); + base->putShort(L"CookTime", (short) (tickCount)); ListTag *listTag = new ListTag(); for (unsigned 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(i)); + tag->putByte(L"Slot", (byte) i); items[i]->save(tag); listTag->add(tag); } @@ -194,7 +194,7 @@ void FurnaceTileEntity::tick() litTime--; } - if ( level != nullptr && !level->isClientSide) + if ( level != NULL && !level->isClientSide) { if (litTime == 0 && canBurn()) { @@ -202,7 +202,7 @@ void FurnaceTileEntity::tick() if (litTime > 0) { changed = true; - if (items[SLOT_FUEL] != nullptr) + if (items[SLOT_FUEL] != NULL) { // 4J Added: Keep track of whether charcoal was used in production of current stack. if ( items[SLOT_FUEL]->getItem()->id == Item::coal_Id @@ -215,7 +215,7 @@ void FurnaceTileEntity::tick() if (items[SLOT_FUEL]->count == 0) { Item *remaining = items[SLOT_FUEL]->getItem()->getCraftingRemainingItem(); - items[SLOT_FUEL] = remaining != nullptr ? std::make_shared(remaining) : nullptr; + items[SLOT_FUEL] = remaining != NULL ? shared_ptr(new ItemInstance(remaining)) : nullptr; } } } @@ -249,10 +249,10 @@ void FurnaceTileEntity::tick() bool FurnaceTileEntity::canBurn() { - if (items[SLOT_INPUT] == nullptr) return false; + if (items[SLOT_INPUT] == NULL) return false; const ItemInstance *burnResult = FurnaceRecipes::getInstance()->getResult(items[SLOT_INPUT]->getItem()->id); - if (burnResult == nullptr) return false; - if (items[SLOT_RESULT] == nullptr) return true; + if (burnResult == NULL) return false; + if (items[SLOT_RESULT] == NULL) return true; if (!items[SLOT_RESULT]->sameItem_not_shared(burnResult)) return false; if (items[SLOT_RESULT]->count < getMaxStackSize() && items[SLOT_RESULT]->count < items[SLOT_RESULT]->getMaxStackSize()) return true; if (items[SLOT_RESULT]->count < burnResult->getMaxStackSize()) return true; @@ -265,7 +265,7 @@ void FurnaceTileEntity::burn() if (!canBurn()) return; const ItemInstance *result = FurnaceRecipes::getInstance()->getResult(items[SLOT_INPUT]->getItem()->id); - if (items[SLOT_RESULT] == nullptr) items[SLOT_RESULT] = result->copy(); + if (items[SLOT_RESULT] == NULL) items[SLOT_RESULT] = result->copy(); else if (items[SLOT_RESULT]->id == result->id) items[SLOT_RESULT]->count++; items[SLOT_INPUT]->count--; @@ -275,12 +275,12 @@ void FurnaceTileEntity::burn() int FurnaceTileEntity::getBurnDuration(shared_ptr itemInstance) { - if (itemInstance == nullptr) return 0; + if (itemInstance == NULL) return 0; int id = itemInstance->getItem()->id; Item *item = itemInstance->getItem(); - if (id < 256 && Tile::tiles[id] != nullptr) + if (id < 256 && Tile::tiles[id] != NULL) { Tile *tile = Tile::tiles[id]; @@ -300,15 +300,15 @@ int FurnaceTileEntity::getBurnDuration(shared_ptr itemInstance) } } - if (dynamic_cast(item) && static_cast(item)->getTier() == Item::Tier::WOOD) + if (dynamic_cast(item) && ((DiggerItem *) item)->getTier() == Item::Tier::WOOD) { return BURN_INTERVAL; } - else if (dynamic_cast(item) && static_cast(item)->getTier() == Item::Tier::WOOD) + else if (dynamic_cast(item) && ((WeaponItem *) item)->getTier() == Item::Tier::WOOD) { return BURN_INTERVAL; } - else if (dynamic_cast(item) && static_cast(item)->getTier() == Item::Tier::WOOD) + else if (dynamic_cast(item) && ((HoeItem *) item)->getTier() == Item::Tier::WOOD) { return BURN_INTERVAL; } @@ -396,7 +396,7 @@ bool FurnaceTileEntity::canTakeItemThroughFace(int slot, shared_ptr FurnaceTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new FurnaceTileEntity() ); TileEntity::clone(result); result->litTime = litTime; @@ -405,7 +405,7 @@ shared_ptr FurnaceTileEntity::clone() for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr) + if (items[i] != NULL) { result->items[i] = ItemInstance::clone(items[i]); } -- cgit v1.2.3