diff options
| author | Loki Rautio <lokirautio@gmail.com> | 2026-03-07 21:12:22 -0600 |
|---|---|---|
| committer | Loki Rautio <lokirautio@gmail.com> | 2026-03-07 21:12:22 -0600 |
| commit | 087b7e7abfe81dd7f0fdcdea36ac9f245950df1a (patch) | |
| tree | 69454763e73ca764af4e682d3573080b13138a0e /Minecraft.World/FurnaceTileEntity.cpp | |
| parent | a9be52c41a02d207233199e98898fe7483d7e817 (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/FurnaceTileEntity.cpp')
| -rw-r--r-- | Minecraft.World/FurnaceTileEntity.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
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<ItemInstance> 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<ItemInstance> FurnaceTileEntity::removeItemNoUpdate(int slot) { m_charcoalUsed = false; - if (items[slot] != nullptr) + if (items[slot] != NULL) { shared_ptr<ItemInstance> item = items[slot]; items[slot] = nullptr; @@ -92,7 +92,7 @@ shared_ptr<ItemInstance> FurnaceTileEntity::removeItemNoUpdate(int slot) void FurnaceTileEntity::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(); } @@ -140,16 +140,16 @@ void FurnaceTileEntity::load(CompoundTag *base) void FurnaceTileEntity::save(CompoundTag *base) { TileEntity::save(base); - base->putShort(L"BurnTime", static_cast<short>(litTime)); - base->putShort(L"CookTime", static_cast<short>(tickCount)); + base->putShort(L"BurnTime", (short) (litTime)); + base->putShort(L"CookTime", (short) (tickCount)); ListTag<CompoundTag> *listTag = new ListTag<CompoundTag>(); 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<byte>(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<ItemInstance>(remaining) : nullptr; + items[SLOT_FUEL] = remaining != NULL ? shared_ptr<ItemInstance>(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> 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> itemInstance) } } - if (dynamic_cast<DiggerItem *>(item) && static_cast<DiggerItem *>(item)->getTier() == Item::Tier::WOOD) + if (dynamic_cast<DiggerItem *>(item) && ((DiggerItem *) item)->getTier() == Item::Tier::WOOD) { return BURN_INTERVAL; } - else if (dynamic_cast<WeaponItem *>(item) && static_cast<WeaponItem *>(item)->getTier() == Item::Tier::WOOD) + else if (dynamic_cast<WeaponItem *>(item) && ((WeaponItem *) item)->getTier() == Item::Tier::WOOD) { return BURN_INTERVAL; } - else if (dynamic_cast<HoeItem *>(item) && static_cast<HoeItem *>(item)->getTier() == Item::Tier::WOOD) + else if (dynamic_cast<HoeItem *>(item) && ((HoeItem *) item)->getTier() == Item::Tier::WOOD) { return BURN_INTERVAL; } @@ -396,7 +396,7 @@ bool FurnaceTileEntity::canTakeItemThroughFace(int slot, shared_ptr<ItemInstance // 4J Added shared_ptr<TileEntity> FurnaceTileEntity::clone() { - shared_ptr<FurnaceTileEntity> result = std::make_shared<FurnaceTileEntity>(); + shared_ptr<FurnaceTileEntity> result = shared_ptr<FurnaceTileEntity>( new FurnaceTileEntity() ); TileEntity::clone(result); result->litTime = litTime; @@ -405,7 +405,7 @@ shared_ptr<TileEntity> 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]); } |
