diff options
author | Franz Reiter <franzi.moos@googlemail.com> | 2014-08-04 22:30:58 +0200 |
---|---|---|
committer | Franz Reiter <franzi.moos@googlemail.com> | 2014-08-04 22:30:58 +0200 |
commit | e2c4fbd4e24183fca2f23dd3ccb81bcd52ce68ad (patch) | |
tree | c2dde2ce88914c28c44158f9261facdb4317e33c /src/Items | |
parent | Merge branch 'master' of https://github.com/mc-server/MCServer (diff) | |
parent | Changed arrow comment. (diff) | |
download | cuberite-e2c4fbd4e24183fca2f23dd3ccb81bcd52ce68ad.tar cuberite-e2c4fbd4e24183fca2f23dd3ccb81bcd52ce68ad.tar.gz cuberite-e2c4fbd4e24183fca2f23dd3ccb81bcd52ce68ad.tar.bz2 cuberite-e2c4fbd4e24183fca2f23dd3ccb81bcd52ce68ad.tar.lz cuberite-e2c4fbd4e24183fca2f23dd3ccb81bcd52ce68ad.tar.xz cuberite-e2c4fbd4e24183fca2f23dd3ccb81bcd52ce68ad.tar.zst cuberite-e2c4fbd4e24183fca2f23dd3ccb81bcd52ce68ad.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..fdc24689c 100644 --- a/src/Items/ItemBow.h +++ b/src/Items/ItemBow.h @@ -57,6 +57,12 @@ public: } Force = std::min(Force, 1.0); + // Does the player have an 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(); } } |