aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/BrewingStandTileEntity.cpp
diff options
context:
space:
mode:
authorLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
committerLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
commit087b7e7abfe81dd7f0fdcdea36ac9f245950df1a (patch)
tree69454763e73ca764af4e682d3573080b13138a0e /Minecraft.World/BrewingStandTileEntity.cpp
parenta9be52c41a02d207233199e98898fe7483d7e817 (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/BrewingStandTileEntity.cpp')
-rw-r--r--Minecraft.World/BrewingStandTileEntity.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/Minecraft.World/BrewingStandTileEntity.cpp b/Minecraft.World/BrewingStandTileEntity.cpp
index 3d081bae..5bc6fd27 100644
--- a/Minecraft.World/BrewingStandTileEntity.cpp
+++ b/Minecraft.World/BrewingStandTileEntity.cpp
@@ -96,7 +96,7 @@ int BrewingStandTileEntity::getBrewTime()
bool BrewingStandTileEntity::isBrewable()
{
- if (items[INGREDIENT_SLOT] == nullptr || items[INGREDIENT_SLOT]->count <= 0)
+ if (items[INGREDIENT_SLOT] == NULL || items[INGREDIENT_SLOT]->count <= 0)
{
return false;
}
@@ -111,7 +111,7 @@ bool BrewingStandTileEntity::isBrewable()
bool oneResult = false;
for (int dest = 0; dest < 3; dest++)
{
- if (items[dest] != nullptr && items[dest]->id == Item::potion_Id)
+ if (items[dest] != NULL && items[dest]->id == Item::potion_Id)
{
int currentBrew = items[dest]->getAuxValue();
int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) );
@@ -129,7 +129,7 @@ bool BrewingStandTileEntity::isBrewable()
// TODO - find out whether actually checking pointers to MobEffectInstance classes for equality
// is of any use
bool equals = false;
- if( ( currentEffects != nullptr ) && ( newEffects != nullptr ) )
+ if( ( currentEffects != NULL ) && ( newEffects != NULL ) )
{
if( currentEffects->size() == newEffects->size() )
{
@@ -141,7 +141,7 @@ bool BrewingStandTileEntity::isBrewable()
}
if ((currentBrew > 0 && currentEffects == newEffects) ||
- (currentEffects != nullptr && (equals || newEffects == nullptr)))
+ (currentEffects != NULL && (equals || newEffects == NULL)))
{
}
else if (currentBrew != newBrew)
@@ -166,7 +166,7 @@ bool BrewingStandTileEntity::isBrewable()
bool oneResult = false;
for (int dest = 0; dest < 3; dest++)
{
- if (items[dest] != nullptr && items[dest]->id == Item::potion_Id)
+ if (items[dest] != NULL && items[dest]->id == Item::potion_Id)
{
int currentBrew = items[dest]->getAuxValue();
int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) );
@@ -176,7 +176,7 @@ bool BrewingStandTileEntity::isBrewable()
break;
}
}
- else if (isWater && items[dest] != nullptr && items[dest]->id == Item::glassBottle_Id)
+ else if (isWater && items[dest] != NULL && items[dest]->id == Item::glassBottle_Id)
{
oneResult = true;
break;
@@ -199,7 +199,7 @@ void BrewingStandTileEntity::doBrew()
{
for (int dest = 0; dest < 3; dest++)
{
- if (items[dest] != nullptr && items[dest]->id == Item::potion_Id)
+ if (items[dest] != NULL && items[dest]->id == Item::potion_Id)
{
int currentBrew = items[dest]->getAuxValue();
int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) );
@@ -211,7 +211,7 @@ void BrewingStandTileEntity::doBrew()
// TODO - find out whether actually checking pointers to MobEffectInstance classes for equality
// is of any use
bool equals = false;
- if( ( currentEffects != nullptr ) && ( newEffects != nullptr ) )
+ if( ( currentEffects != NULL ) && ( newEffects != NULL ) )
{
if( currentEffects->size() == newEffects->size() )
{
@@ -223,7 +223,7 @@ void BrewingStandTileEntity::doBrew()
}
if ((currentBrew > 0 && currentEffects == newEffects) ||
- (currentEffects != nullptr && (equals || newEffects == nullptr)))
+ (currentEffects != NULL && (equals || newEffects == NULL)))
{
if (!PotionItem::isThrowable(currentBrew) && PotionItem::isThrowable(newBrew))
{
@@ -246,22 +246,22 @@ void BrewingStandTileEntity::doBrew()
for (int dest = 0; dest < 3; dest++)
{
- if (items[dest] != nullptr && items[dest]->id == Item::potion_Id)
+ if (items[dest] != NULL && items[dest]->id == Item::potion_Id)
{
int currentBrew = items[dest]->getAuxValue();
int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) );
items[dest]->setAuxValue(newBrew);
}
- else if (isWater && items[dest] != nullptr && items[dest]->id == Item::glassBottle_Id)
+ else if (isWater && items[dest] != NULL && items[dest]->id == Item::glassBottle_Id)
{
- items[dest] = std::make_shared<ItemInstance>(Item::potion);
+ items[dest] = shared_ptr<ItemInstance>(new ItemInstance(Item::potion));
}
}
}
if (Item::items[ingredient->id]->hasCraftingRemainingItem())
{
- items[INGREDIENT_SLOT] = std::make_shared<ItemInstance>(Item::items[ingredient->id]->getCraftingRemainingItem());
+ items[INGREDIENT_SLOT] = shared_ptr<ItemInstance>(new ItemInstance(Item::items[ingredient->id]->getCraftingRemainingItem()));
}
else
{
@@ -275,7 +275,7 @@ void BrewingStandTileEntity::doBrew()
int BrewingStandTileEntity::applyIngredient(int currentBrew, shared_ptr<ItemInstance> ingredient)
{
- if (ingredient == nullptr)
+ if (ingredient == NULL)
{
return currentBrew;
}
@@ -322,15 +322,15 @@ void BrewingStandTileEntity::save(CompoundTag *base)
{
TileEntity::save(base);
- base->putShort(L"BrewTime", static_cast<short>(brewTime));
+ base->putShort(L"BrewTime", (short) (brewTime));
ListTag<CompoundTag> *listTag = new ListTag<CompoundTag>();
for (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);
}
@@ -354,7 +354,7 @@ shared_ptr<ItemInstance> BrewingStandTileEntity::removeItem(unsigned int slot, i
// option on the ingredients slot
// Fix for #65373 - TU8: Content: UI: Command "Take Half" in the Brewing Stand interface doesn't work as intended.
- if (slot >= 0 && slot < items.length && items[slot] != nullptr)
+ if (slot >= 0 && slot < items.length && items[slot] != NULL)
{
if (items[slot]->count <= count)
{
@@ -445,7 +445,7 @@ int BrewingStandTileEntity::getPotionBits()
int newCount = 0;
for (int potion = 0; potion < 3; potion++)
{
- if (items[potion] != nullptr)
+ if (items[potion] != NULL)
{
newCount |= (1 << potion);
}
@@ -476,7 +476,7 @@ bool BrewingStandTileEntity::canTakeItemThroughFace(int slot, shared_ptr<ItemIns
// 4J Added
shared_ptr<TileEntity> BrewingStandTileEntity::clone()
{
- shared_ptr<BrewingStandTileEntity> result = std::make_shared<BrewingStandTileEntity>();
+ shared_ptr<BrewingStandTileEntity> result = shared_ptr<BrewingStandTileEntity>( new BrewingStandTileEntity() );
TileEntity::clone(result);
result->brewTime = brewTime;
@@ -485,7 +485,7 @@ shared_ptr<TileEntity> BrewingStandTileEntity::clone()
for (unsigned int i = 0; i < items.length; i++)
{
- if (items.data[i] != nullptr)
+ if (items.data[i] != NULL)
{
result->items.data[i] = ItemInstance::clone(items.data[i]);
}