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/DispenserTileEntity.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'Minecraft.World/DispenserTileEntity.cpp') diff --git a/Minecraft.World/DispenserTileEntity.cpp b/Minecraft.World/DispenserTileEntity.cpp index b1d8ecde..3e743e22 100644 --- a/Minecraft.World/DispenserTileEntity.cpp +++ b/Minecraft.World/DispenserTileEntity.cpp @@ -35,7 +35,7 @@ shared_ptr DispenserTileEntity::getItem(unsigned int slot) shared_ptr DispenserTileEntity::removeItem(unsigned int slot, int count) { - if (items[slot] != nullptr) + if (items[slot] != NULL) { if (items[slot]->count <= count) { @@ -61,7 +61,7 @@ shared_ptr DispenserTileEntity::removeItem(unsigned int slot, int shared_ptr DispenserTileEntity::removeItemNoUpdate(int slot) { - if (items[slot] != nullptr) + if (items[slot] != NULL) { shared_ptr item = items[slot]; items[slot] = nullptr; @@ -73,7 +73,7 @@ shared_ptr DispenserTileEntity::removeItemNoUpdate(int slot) // 4J-PB added for spawn eggs not being useable due to limits, so add them in again void DispenserTileEntity::AddItemBack(shared_ptritem, unsigned int slot) { - if (items[slot] != nullptr) + if (items[slot] != NULL) { // just increment the count of the items if(item->id==items[slot]->id) @@ -85,7 +85,7 @@ void DispenserTileEntity::AddItemBack(shared_ptritem, unsigned int else { items[slot] = item; - if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); setChanged(); } } @@ -99,10 +99,10 @@ bool DispenserTileEntity::removeProjectile(int itemId) { for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr && items[i]->id == itemId) + if (items[i] != NULL && items[i]->id == itemId) { shared_ptr removedItem = removeItem(i, 1); - return removedItem != nullptr; + return removedItem != NULL; } } return false; @@ -114,7 +114,7 @@ int DispenserTileEntity::getRandomSlot() int replaceOdds = 1; for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr && random->nextInt(replaceOdds++) == 0) + if (items[i] != NULL && random->nextInt(replaceOdds++) == 0) { replaceSlot = i; } @@ -126,7 +126,7 @@ int DispenserTileEntity::getRandomSlot() void DispenserTileEntity::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(); setChanged(); } @@ -134,7 +134,7 @@ int DispenserTileEntity::addItem(shared_ptr item) { for (int i = 0; i < items.length; i++) { - if (items[i] == nullptr || items[i]->id == 0) + if (items[i] == NULL || items[i]->id == 0) { setItem(i, item); return i; @@ -186,10 +186,10 @@ void DispenserTileEntity::save(CompoundTag *base) 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); } @@ -231,12 +231,12 @@ bool DispenserTileEntity::canPlaceItem(int slot, shared_ptr item) // 4J Added shared_ptr DispenserTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new DispenserTileEntity() ); TileEntity::clone(result); 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