summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-03-14 23:52:51 +0100
committerHowaner <franzi.moos@googlemail.com>2014-03-14 23:52:51 +0100
commitccc29c7c6c344b00e5b6c9236cf615b253b9a1b5 (patch)
tree990c8ee65902d303c9bdbe0b0ca98759843febae
parentChange tnt documentation to ticks (diff)
downloadcuberite-ccc29c7c6c344b00e5b6c9236cf615b253b9a1b5.tar
cuberite-ccc29c7c6c344b00e5b6c9236cf615b253b9a1b5.tar.gz
cuberite-ccc29c7c6c344b00e5b6c9236cf615b253b9a1b5.tar.bz2
cuberite-ccc29c7c6c344b00e5b6c9236cf615b253b9a1b5.tar.lz
cuberite-ccc29c7c6c344b00e5b6c9236cf615b253b9a1b5.tar.xz
cuberite-ccc29c7c6c344b00e5b6c9236cf615b253b9a1b5.tar.zst
cuberite-ccc29c7c6c344b00e5b6c9236cf615b253b9a1b5.zip
-rw-r--r--src/BlockEntities/DispenserEntity.cpp6
-rw-r--r--src/Items/ItemHandler.cpp1
-rw-r--r--src/Items/ItemItemFrame.h6
-rw-r--r--src/Items/ItemLighter.h22
4 files changed, 33 insertions, 2 deletions
diff --git a/src/BlockEntities/DispenserEntity.cpp b/src/BlockEntities/DispenserEntity.cpp
index cbfbb1b6a..e03bf776d 100644
--- a/src/BlockEntities/DispenserEntity.cpp
+++ b/src/BlockEntities/DispenserEntity.cpp
@@ -138,6 +138,12 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
break;
}
+ case E_ITEM_FIRE_CHARGE:
+ {
+ // TODO: Spawn fireball entity
+ break;
+ }
+
default:
{
DropFromSlot(a_Chunk, a_SlotNum);
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index 1d357fcf1..232791f99 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -107,6 +107,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
case E_ITEM_EGG: return new cItemEggHandler();
case E_ITEM_EMPTY_MAP: return new cItemEmptyMapHandler();
case E_ITEM_ENDER_PEARL: return new cItemEnderPearlHandler();
+ case E_ITEM_FIRE_CHARGE: return new cItemLighterHandler(a_ItemType);
case E_ITEM_FIREWORK_ROCKET: return new cItemFireworkHandler();
case E_ITEM_FISHING_ROD: return new cItemFishingRodHandler(a_ItemType);
case E_ITEM_FLINT_AND_STEEL: return new cItemLighterHandler(a_ItemType);
diff --git a/src/Items/ItemItemFrame.h b/src/Items/ItemItemFrame.h
index 74e987445..27e7dba35 100644
--- a/src/Items/ItemItemFrame.h
+++ b/src/Items/ItemItemFrame.h
@@ -34,7 +34,11 @@ public:
if (Block == E_BLOCK_AIR)
{
cItemFrame * ItemFrame = new cItemFrame(a_Dir, a_BlockX, a_BlockY, a_BlockZ);
- ItemFrame->Initialize(a_World);
+ if (!ItemFrame->Initialize(a_World))
+ {
+ delete ItemFrame;
+ return false;
+ }
if (!a_Player->IsGameModeCreative())
{
diff --git a/src/Items/ItemLighter.h b/src/Items/ItemLighter.h
index 18873e911..2db6c829a 100644
--- a/src/Items/ItemLighter.h
+++ b/src/Items/ItemLighter.h
@@ -26,7 +26,26 @@ public:
return false;
}
- a_Player->UseEquippedItem();
+ if (!a_Player->IsGameModeCreative())
+ {
+ switch (m_ItemType)
+ {
+ case E_ITEM_FLINT_AND_STEEL:
+ {
+ a_Player->UseEquippedItem();
+ break;
+ }
+ case E_ITEM_FIRE_CHARGE:
+ {
+ a_Player->GetInventory().RemoveOneEquippedItem();
+ break;
+ }
+ default:
+ {
+ ASSERT(!"Unknown Lighter Item!");
+ }
+ }
+ }
switch (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ))
{
@@ -49,6 +68,7 @@ public:
if (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_AIR)
{
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_FIRE, 0);
+ a_World->BroadcastSoundEffect("fire.ignite", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 1.0F, 1.04F);
break;
}
}