summaryrefslogtreecommitdiffstats
path: root/source/cSurvivalInventory.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-04 14:08:20 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-04 14:08:20 +0200
commitb355bdeccecf727d30e48634df9b5d424db570bc (patch)
tree00489a1317e6ad22a28698f24bd9935160257789 /source/cSurvivalInventory.cpp
parentFixed MSVC2010 projects for new zlib (diff)
downloadcuberite-b355bdeccecf727d30e48634df9b5d424db570bc.tar
cuberite-b355bdeccecf727d30e48634df9b5d424db570bc.tar.gz
cuberite-b355bdeccecf727d30e48634df9b5d424db570bc.tar.bz2
cuberite-b355bdeccecf727d30e48634df9b5d424db570bc.tar.lz
cuberite-b355bdeccecf727d30e48634df9b5d424db570bc.tar.xz
cuberite-b355bdeccecf727d30e48634df9b5d424db570bc.tar.zst
cuberite-b355bdeccecf727d30e48634df9b5d424db570bc.zip
Diffstat (limited to '')
-rw-r--r--source/cSurvivalInventory.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/source/cSurvivalInventory.cpp b/source/cSurvivalInventory.cpp
index 088c4362c..a39cc6b59 100644
--- a/source/cSurvivalInventory.cpp
+++ b/source/cSurvivalInventory.cpp
@@ -7,6 +7,7 @@
#include "cWindow.h"
#include "cItem.h"
#include "cRecipeChecker.h"
+#include "CraftingRecipes.h"
#include "cRoot.h"
#include "packets/cPacket_WindowClick.h"
@@ -69,16 +70,29 @@ void cSurvivalInventory::Clicked( cPacket* a_ClickPacket )
LOG("No Inventory window! WTF");
}
- if( Packet->m_SlotNum >= (short)c_CraftOffset && Packet->m_SlotNum < (short)(c_CraftOffset+c_CraftSlots+1) )
+ if ((Packet->m_SlotNum >= (short)c_CraftOffset) && (Packet->m_SlotNum < (short)(c_CraftOffset + c_CraftSlots + 1)))
{
cItem CookedItem;
- if( Packet->m_SlotNum == 0 && !bDontCook )
+ if ((Packet->m_SlotNum == 0) && !bDontCook)
{
- CookedItem = cRoot::Get()->GetRecipeChecker()->CookIngredients( m_Slots+c_CraftOffset+1, 2, 2, true );
+ // Consume the items from the crafting grid:
+ CookedItem = cRoot::Get()->GetCraftingRecipes()->Craft(m_Slots + c_CraftOffset + 1, 2, 2);
+ // Upgrade the crafting result from the new crafting grid contents:
+ CookedItem = cRoot::Get()->GetCraftingRecipes()->Offer(m_Slots + c_CraftOffset + 1, 2, 2);
+ if (CookedItem.IsEmpty())
+ {
+ // Fallback to the old recipes:
+ CookedItem = cRoot::Get()->GetRecipeChecker()->CookIngredients( m_Slots+c_CraftOffset+1, 2, 2, true );
+ }
}
else
{
- CookedItem = cRoot::Get()->GetRecipeChecker()->CookIngredients( m_Slots+c_CraftOffset+1, 2, 2 );
+ CookedItem = cRoot::Get()->GetCraftingRecipes()->Offer(m_Slots + c_CraftOffset + 1, 2, 2);
+ if (CookedItem.IsEmpty())
+ {
+ // Fallback to the old recipes:
+ CookedItem = cRoot::Get()->GetRecipeChecker()->CookIngredients( m_Slots+c_CraftOffset+1, 2, 2 );
+ }
}
m_Slots[c_CraftOffset] = CookedItem;
LOG("You cooked: %i x %i !!", m_Slots[c_CraftOffset].m_ItemID, m_Slots[c_CraftOffset].m_ItemCount );