summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluksor111@gmail.com <luksor111@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-12-27 16:07:12 +0100
committerluksor111@gmail.com <luksor111@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-12-27 16:07:12 +0100
commit69107bd54fb4b9dc273d16e4073e4861245d2331 (patch)
treeec1ee7e004ce4eaa48cfa5997d68b0b9f6619165
parentFixed Linux compilation (diff)
downloadcuberite-69107bd54fb4b9dc273d16e4073e4861245d2331.tar
cuberite-69107bd54fb4b9dc273d16e4073e4861245d2331.tar.gz
cuberite-69107bd54fb4b9dc273d16e4073e4861245d2331.tar.bz2
cuberite-69107bd54fb4b9dc273d16e4073e4861245d2331.tar.lz
cuberite-69107bd54fb4b9dc273d16e4073e4861245d2331.tar.xz
cuberite-69107bd54fb4b9dc273d16e4073e4861245d2331.tar.zst
cuberite-69107bd54fb4b9dc273d16e4073e4861245d2331.zip
-rw-r--r--source/Chunk.h4
-rw-r--r--source/ChunkMap.h4
-rw-r--r--source/Items/ItemSlab.h14
-rw-r--r--source/World.h4
4 files changed, 17 insertions, 9 deletions
diff --git a/source/Chunk.h b/source/Chunk.h
index b5dfd380d..04f634b5b 100644
--- a/source/Chunk.h
+++ b/source/Chunk.h
@@ -169,7 +169,7 @@ public:
bool ForEachChest(cChestCallback & a_Callback); // Lua-accessible
/// Calls the callback for each dispenser; returns true if all dispensers processed, false if the callback aborted by returning true
- bool ForEachDispenser(cDispenserCallback & a_Callback); // Lua-accessible
+ bool ForEachDispenser(cDispenserCallback & a_Callback);
/// Calls the callback for each furnace; returns true if all furnaces processed, false if the callback aborted by returning true
bool ForEachFurnace(cFurnaceCallback & a_Callback); // Lua-accessible
@@ -178,7 +178,7 @@ public:
bool DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback); // Lua-acessible
/// Calls the callback for the dispenser at the specified coords; returns false if there's no dispenser at those coords, true if found
- bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback); // Lua-accessible
+ bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback);
/// Calls the callback for the furnace at the specified coords; returns false if there's no furnace at those coords, true if found
bool DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback); // Lua-accessible
diff --git a/source/ChunkMap.h b/source/ChunkMap.h
index ba037444a..12c6e7275 100644
--- a/source/ChunkMap.h
+++ b/source/ChunkMap.h
@@ -185,7 +185,7 @@ public:
bool ForEachChestInChunk (int a_ChunkX, int a_ChunkZ, cChestCallback & a_Callback); // Lua-accessible
/// Calls the callback for each dispenser in the specified chunk; returns true if all dispensers processed, false if the callback aborted by returning true
- bool ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & a_Callback); // Lua-accessible
+ bool ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & a_Callback);
/// Calls the callback for each furnace in the specified chunk; returns true if all furnaces processed, false if the callback aborted by returning true
bool ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback & a_Callback); // Lua-accessible
@@ -194,7 +194,7 @@ public:
bool DoWithChestAt (int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback); // Lua-acessible
/// Calls the callback for the dispenser at the specified coords; returns false if there's no dispenser at those coords, true if found
- bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback); // Lua-accessible
+ bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback);
/// Calls the callback for the furnace at the specified coords; returns false if there's no furnace at those coords, true if found
bool DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback); // Lua-accessible
diff --git a/source/Items/ItemSlab.h b/source/Items/ItemSlab.h
index 36779138b..174beae22 100644
--- a/source/Items/ItemSlab.h
+++ b/source/Items/ItemSlab.h
@@ -29,12 +29,20 @@ public:
&& (Block == a_Item->m_ItemType) // Same slab
&& ((Meta & 0x7) == (a_Item->m_ItemHealth & 0x7))) // Same Texture
{
- cItem Item(a_Item->m_ItemType, 1);
- if (a_Player->GetInventory().RemoveItem(Item))
+ if(a_Player->GetGameMode() == eGameMode_Creative)
{
- a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, Block - 1, Meta); // Block - 1 simple hack to save one if statement
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, Block - 1, Meta); // Block - 1 simple hack to save one if statement
return true;
}
+ else
+ {
+ cItem Item(a_Item->m_ItemType, 1);
+ if (a_Player->GetInventory().RemoveItem(Item))
+ {
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, Block - 1, Meta); // Block - 1 simple hack to save one if statement
+ return true;
+ }
+ }
}
return false;
}
diff --git a/source/World.h b/source/World.h
index cefb9abf2..b7b6b6934 100644
--- a/source/World.h
+++ b/source/World.h
@@ -319,7 +319,7 @@ public:
bool ForEachChestInChunk (int a_ChunkX, int a_ChunkZ, cChestCallback & a_Callback); // Exported in ManualBindings.cpp
/// Calls the callback for each dispenser in the specified chunk; returns true if all dispensers processed, false if the callback aborted by returning true
- bool ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & a_Callback); // Exported in ManualBindings.cpp
+ bool ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & a_Callback);
/// Calls the callback for each furnace in the specified chunk; returns true if all furnaces processed, false if the callback aborted by returning true
bool ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback & a_Callback); // Exported in ManualBindings.cpp
@@ -328,7 +328,7 @@ public:
bool DoWithChestAt (int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback); // Exported in ManualBindings.cpp
/// Calls the callback for the dispenser at the specified coords; returns false if there's no dispenser at those coords, true if found
- bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback); // Exported in ManualBindings.cpp
+ bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback);
/// Calls the callback for the furnace at the specified coords; returns false if there's no furnace at those coords, true if found
bool DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback); // Exported in ManualBindings.cpp