diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-08-04 21:48:33 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-08-04 21:48:33 +0200 |
commit | 434ea542e174bc686a7c981476e23d30d18989c3 (patch) | |
tree | 7c4a20b9974816158ba08f9c8440cac46aa9f72b /src/Items | |
parent | Fixed #1286 (diff) | |
download | cuberite-434ea542e174bc686a7c981476e23d30d18989c3.tar cuberite-434ea542e174bc686a7c981476e23d30d18989c3.tar.gz cuberite-434ea542e174bc686a7c981476e23d30d18989c3.tar.bz2 cuberite-434ea542e174bc686a7c981476e23d30d18989c3.tar.lz cuberite-434ea542e174bc686a7c981476e23d30d18989c3.tar.xz cuberite-434ea542e174bc686a7c981476e23d30d18989c3.tar.zst cuberite-434ea542e174bc686a7c981476e23d30d18989c3.zip |
Diffstat (limited to 'src/Items')
-rw-r--r-- | src/Items/ItemBow.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Items/ItemBow.h b/src/Items/ItemBow.h index e7a77dcbc..90645dd9a 100644 --- a/src/Items/ItemBow.h +++ b/src/Items/ItemBow.h @@ -57,6 +57,12 @@ public: } Force = std::min(Force, 1.0); + // Has the player a arrow? + if (!a_Player->IsGameModeCreative() && !a_Player->GetInventory().HasItems(cItem(E_ITEM_ARROW))) + { + return; + } + // Create the arrow entity: cArrowEntity * Arrow = new cArrowEntity(*a_Player, Force * 2); if (Arrow == NULL) @@ -73,6 +79,10 @@ public: a_Player->GetWorld()->BroadcastSoundEffect("random.bow", a_Player->GetPosX(), a_Player->GetPosY(), a_Player->GetPosZ(), 0.5, (float)Force); if (!a_Player->IsGameModeCreative()) { + if (a_Player->GetEquippedItem().m_Enchantments.GetLevel(cEnchantments::enchInfinity) == 0) + { + a_Player->GetInventory().RemoveItem(cItem(E_ITEM_ARROW)); + } a_Player->UseEquippedItem(); } } |