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/ArmorDyeRecipe.cpp | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'Minecraft.World/ArmorDyeRecipe.cpp') diff --git a/Minecraft.World/ArmorDyeRecipe.cpp b/Minecraft.World/ArmorDyeRecipe.cpp index d4581182..46d43868 100644 --- a/Minecraft.World/ArmorDyeRecipe.cpp +++ b/Minecraft.World/ArmorDyeRecipe.cpp @@ -13,12 +13,12 @@ bool ArmorDyeRecipe::matches(shared_ptr craftSlots, Level *le for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == nullptr) continue; + if (item == NULL) continue; ArmorItem *armor = dynamic_cast(item->getItem()); if (armor) { - if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == nullptr) + if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == NULL) { target = item; } @@ -37,7 +37,7 @@ bool ArmorDyeRecipe::matches(shared_ptr craftSlots, Level *le } } - return target != nullptr && !dyes.empty(); + return target != NULL && !dyes.empty(); } shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptr craftSlots) @@ -46,19 +46,19 @@ shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptrgetContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == nullptr) continue; + if (item == NULL) continue; armor = dynamic_cast(item->getItem()); if (armor) { - if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == nullptr) + if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == NULL) { target = item->copy(); target->count = 1; @@ -66,9 +66,9 @@ shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptrhasCustomColor(item)) { int color = armor->getColor(target); - float red = static_cast((color >> 16) & 0xFF) / 0xFF; - float green = static_cast((color >> 8) & 0xFF) / 0xFF; - float blue = static_cast(color & 0xFF) / 0xFF; + float red = (float) ((color >> 16) & 0xFF) / 0xFF; + float green = (float) ((color >> 8) & 0xFF) / 0xFF; + float blue = (float) (color & 0xFF) / 0xFF; intensityTotal += max(red, max(green, blue)) * 0xFF; @@ -86,9 +86,9 @@ shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptrid == Item::dye_powder_Id) { int tileData = ColoredTile::getTileDataForItemAuxValue(item->getAuxValue()); - int red = static_cast(Sheep::COLOR[tileData][0] * 0xFF); - int green = static_cast(Sheep::COLOR[tileData][1] * 0xFF); - int blue = static_cast(Sheep::COLOR[tileData][2] * 0xFF); + int red = (int) (Sheep::COLOR[tileData][0] * 0xFF); + int green = (int) (Sheep::COLOR[tileData][1] * 0xFF); + int blue = (int) (Sheep::COLOR[tileData][2] * 0xFF); intensityTotal += max(red, max(green, blue)); @@ -104,19 +104,19 @@ shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptr(intensityTotal) / colourCounts; - float resultIntensity = static_cast(max(red, max(green, blue))); + float averageIntensity = (float) intensityTotal / colourCounts; + float resultIntensity = (float) max(red, max(green, blue)); // System.out.println(averageIntensity + ", " + resultIntensity); - red = static_cast((float)red * averageIntensity / resultIntensity); - green = static_cast((float)green * averageIntensity / resultIntensity); - blue = static_cast((float)blue * averageIntensity / resultIntensity); + red = (int) ((float) red * averageIntensity / resultIntensity); + green = (int) ((float) green * averageIntensity / resultIntensity); + blue = (int) ((float) blue * averageIntensity / resultIntensity); int rgb = red; rgb = (rgb << 8) + green; @@ -138,7 +138,7 @@ int ArmorDyeRecipe::size() const ItemInstance *ArmorDyeRecipe::getResultItem() { - return nullptr; + return NULL; } const int ArmorDyeRecipe::getGroup() @@ -175,7 +175,7 @@ void ArmorDyeRecipe::reqs(INGREDIENTS_REQUIRED *pIngReq) #if 0 for ( ItemInstance *expected : *ingredients ) { - if (expected!=nullptr) + if (expected!=NULL) { int iAuxVal = expected->getAuxValue(); TempIngReq.uiGridA[iCount++]=expected->id | iAuxVal<<24; -- cgit v1.2.3