aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ShapedRecipy.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-07 21:56:03 -0500
committerGitHub <noreply@github.com>2026-03-08 09:56:03 +0700
commita9be52c41a02d207233199e98898fe7483d7e817 (patch)
tree71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.World/ShapedRecipy.cpp
parent1be5faaea781402e7de06b263eeca4c688b7712c (diff)
Project modernization (#630)
* Fixed boats falling and a TP glitch #266 * Replaced every C-style cast with C++ ones * Replaced every C-style cast with C++ ones * Fixed boats falling and a TP glitch #266 * Updated NULL to nullptr and fixing some type issues * Modernized and fixed a few bugs - Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances. * Fixing more conflicts * Replace int loops with size_t and start work on overrides
Diffstat (limited to 'Minecraft.World/ShapedRecipy.cpp')
-rw-r--r--Minecraft.World/ShapedRecipy.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/Minecraft.World/ShapedRecipy.cpp b/Minecraft.World/ShapedRecipy.cpp
index ee737321..7a0e85b0 100644
--- a/Minecraft.World/ShapedRecipy.cpp
+++ b/Minecraft.World/ShapedRecipy.cpp
@@ -52,18 +52,18 @@ bool ShapedRecipy::matches(shared_ptr<CraftingContainer> craftSlots, int xOffs,
for (int y = 0; y < 3; y++) {
int xs = x - xOffs;
int ys = y - yOffs;
- ItemInstance *expected = NULL;
+ ItemInstance *expected = nullptr;
if (xs >= 0 && ys >= 0 && xs < width && ys < height)
{
if (xFlip) expected = recipeItems[(width - xs - 1) + ys * width];
else expected = recipeItems[xs + ys * width];
}
shared_ptr<ItemInstance> item = craftSlots->getItem(x, y);
- if (item == NULL && expected == NULL)
+ if (item == nullptr && expected == nullptr)
{
continue;
}
- if ((item == NULL && expected != NULL) || (item != NULL && expected == NULL))
+ if ((item == nullptr && expected != nullptr) || (item != nullptr && expected == nullptr))
{
return false;
}
@@ -84,15 +84,15 @@ shared_ptr<ItemInstance> ShapedRecipy::assemble(shared_ptr<CraftingContainer> cr
{
shared_ptr<ItemInstance> result = getResultItem()->copy();
- if (_keepTag && craftSlots != NULL)
+ if (_keepTag && craftSlots != nullptr)
{
for (int i = 0; i < craftSlots->getContainerSize(); i++)
{
shared_ptr<ItemInstance> item = craftSlots->getItem(i);
- if (item != NULL && item->hasTag())
+ if (item != nullptr && item->hasTag())
{
- result->setTag((CompoundTag *) item->tag->copy());
+ result->setTag(static_cast<CompoundTag *>(item->tag->copy()));
}
}
}
@@ -117,7 +117,7 @@ bool ShapedRecipy::reqs(int iRecipe)
if (x < width && y < height)
{
ItemInstance *expected = recipeItems[x+y*width];
- if (expected!=NULL)
+ if (expected!=nullptr)
{
//printf("\tIngredient %d is %d\n",iCount++,expected->id);
}
@@ -159,7 +159,7 @@ void ShapedRecipy::reqs(INGREDIENTS_REQUIRED *pIngReq)
{
ItemInstance *expected = recipeItems[x+y*width];
- if (expected!=NULL)
+ if (expected!=nullptr)
{
int iAuxVal = expected->getAuxValue();
TempIngReq.uiGridA[x+y*3]=expected->id | iAuxVal<<24;