diff options
-rw-r--r-- | src/BlockEntities/DispenserEntity.cpp | 2 | ||||
-rw-r--r-- | src/Blocks/BlockCauldron.h | 6 | ||||
-rw-r--r-- | src/Entities/ArrowEntity.cpp | 2 | ||||
-rw-r--r-- | src/Entities/Player.cpp | 4 | ||||
-rw-r--r-- | src/Items/ItemBottle.h | 3 | ||||
-rw-r--r-- | src/Items/ItemBucket.h | 3 | ||||
-rw-r--r-- | src/Items/ItemFood.h | 5 | ||||
-rw-r--r-- | src/Items/ItemMilk.h | 2 | ||||
-rw-r--r-- | src/Items/ItemPotion.h | 2 | ||||
-rw-r--r-- | src/Mobs/Cow.cpp | 2 | ||||
-rw-r--r-- | src/Mobs/Mooshroom.cpp | 4 |
11 files changed, 16 insertions, 19 deletions
diff --git a/src/BlockEntities/DispenserEntity.cpp b/src/BlockEntities/DispenserEntity.cpp index 6cb63b495..268a108c2 100644 --- a/src/BlockEntities/DispenserEntity.cpp +++ b/src/BlockEntities/DispenserEntity.cpp @@ -306,7 +306,7 @@ Vector3d cDispenserEntity::GetShootVector(NIBBLETYPE a_Meta) bool cDispenserEntity::ScoopUpLiquid(int a_SlotNum, short a_ResultingBucketItemType) { - cItem LiquidBucket(a_ResultingBucketItemType, 1); + cItem LiquidBucket(a_ResultingBucketItemType); if (m_Contents.GetSlot(a_SlotNum).m_ItemCount == 1) { // Special case: replacing one empty bucket with one full bucket diff --git a/src/Blocks/BlockCauldron.h b/src/Blocks/BlockCauldron.h index 40eab2be9..a359533af 100644 --- a/src/Blocks/BlockCauldron.h +++ b/src/Blocks/BlockCauldron.h @@ -32,8 +32,7 @@ public: if (!a_Player.IsGameModeCreative()) { a_Player.GetInventory().RemoveOneEquippedItem(); - cItem NewItem(E_ITEM_BUCKET, 1); - a_Player.GetInventory().AddItem(NewItem); + a_Player.GetInventory().AddItem(cItem(E_ITEM_BUCKET)); } } break; @@ -44,8 +43,7 @@ public: { a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, --Meta); a_Player.GetInventory().RemoveOneEquippedItem(); - cItem NewItem(E_ITEM_POTIONS, 1, 0); - a_Player.GetInventory().AddItem(NewItem); + a_Player.GetInventory().AddItem(cItem(E_ITEM_POTION)); } break; } diff --git a/src/Entities/ArrowEntity.cpp b/src/Entities/ArrowEntity.cpp index 6fef2c7ee..54ece0e16 100644 --- a/src/Entities/ArrowEntity.cpp +++ b/src/Entities/ArrowEntity.cpp @@ -145,7 +145,7 @@ void cArrowEntity::CollectedBy(cPlayer & a_Dest) // Do not add the arrow to the inventory when the player is in creative: if (!a_Dest.IsGameModeCreative()) { - int NumAdded = a_Dest.GetInventory().AddItem(E_ITEM_ARROW); + int NumAdded = a_Dest.GetInventory().AddItem(cItem(E_ITEM_ARROW)); if (NumAdded == 0) { // No space in the inventory diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index b182629ea..637cc3710 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -712,10 +712,6 @@ void cPlayer::FinishEating(void) { return; } - if (!IsGameModeCreative()) - { - GetInventory().RemoveOneEquippedItem(); - } ItemHandler->OnFoodEaten(m_World, this, &Item); } diff --git a/src/Items/ItemBottle.h b/src/Items/ItemBottle.h index 092d5d81a..b261937e5 100644 --- a/src/Items/ItemBottle.h +++ b/src/Items/ItemBottle.h @@ -84,8 +84,7 @@ public: } a_Player->GetInventory().RemoveOneEquippedItem(); - cItem NewItem(E_ITEM_POTION, 1, 0); - a_Player->GetInventory().AddItem(NewItem); + a_Player->GetInventory().AddItem(cItem(E_ITEM_POTION)); return true; } } ; diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h index 487b66c8f..7a91149d1 100644 --- a/src/Items/ItemBucket.h +++ b/src/Items/ItemBucket.h @@ -163,8 +163,7 @@ public: ASSERT(!"Inventory bucket mismatch"); return false; } - cItem Item(E_ITEM_BUCKET, 1); - if (!a_Player->GetInventory().AddItem(Item)) + if (!a_Player->GetInventory().AddItem(cItem(E_ITEM_BUCKET))) { return false; } diff --git a/src/Items/ItemFood.h b/src/Items/ItemFood.h index caeca2175..3f1c40d36 100644 --- a/src/Items/ItemFood.h +++ b/src/Items/ItemFood.h @@ -103,6 +103,11 @@ public: return false; } + if (!a_Player->IsGameModeCreative()) + { + a_Player->GetInventory().RemoveOneEquippedItem(); + } + switch (m_ItemType) { case E_ITEM_BEETROOT_SOUP: diff --git a/src/Items/ItemMilk.h b/src/Items/ItemMilk.h index 79c44509f..515c80493 100644 --- a/src/Items/ItemMilk.h +++ b/src/Items/ItemMilk.h @@ -29,7 +29,7 @@ public: if (!a_Player->IsGameModeCreative()) { a_Player->GetInventory().RemoveOneEquippedItem(); - a_Player->GetInventory().AddItem(E_ITEM_BUCKET); + a_Player->GetInventory().AddItem(cItem(E_ITEM_BUCKET)); } return true; } diff --git a/src/Items/ItemPotion.h b/src/Items/ItemPotion.h index 906991348..28f8002cc 100644 --- a/src/Items/ItemPotion.h +++ b/src/Items/ItemPotion.h @@ -75,7 +75,7 @@ public: if (!a_Player->IsGameModeCreative()) { a_Player->GetInventory().RemoveOneEquippedItem(); - a_Player->GetInventory().AddItem(E_ITEM_GLASS_BOTTLE); + a_Player->GetInventory().AddItem(cItem(E_ITEM_GLASS_BOTTLE)); } return true; } diff --git a/src/Mobs/Cow.cpp b/src/Mobs/Cow.cpp index fbfa3bf22..ad6947662 100644 --- a/src/Mobs/Cow.cpp +++ b/src/Mobs/Cow.cpp @@ -47,7 +47,7 @@ void cCow::OnRightClicked(cPlayer & a_Player) if (!a_Player.IsGameModeCreative()) { a_Player.GetInventory().RemoveOneEquippedItem(); - a_Player.GetInventory().AddItem(E_ITEM_MILK); + a_Player.GetInventory().AddItem(cItem(E_ITEM_MILK)); } } } diff --git a/src/Mobs/Mooshroom.cpp b/src/Mobs/Mooshroom.cpp index 8be0c44dd..20cb7dac1 100644 --- a/src/Mobs/Mooshroom.cpp +++ b/src/Mobs/Mooshroom.cpp @@ -46,7 +46,7 @@ void cMooshroom::OnRightClicked(cPlayer & a_Player) if (!a_Player.IsGameModeCreative()) { a_Player.GetInventory().RemoveOneEquippedItem(); - a_Player.GetInventory().AddItem(E_ITEM_MILK); + a_Player.GetInventory().AddItem(cItem(E_ITEM_MILK)); } } break; case E_ITEM_BOWL: @@ -54,7 +54,7 @@ void cMooshroom::OnRightClicked(cPlayer & a_Player) if (!a_Player.IsGameModeCreative()) { a_Player.GetInventory().RemoveOneEquippedItem(); - a_Player.GetInventory().AddItem(E_ITEM_MUSHROOM_SOUP); + a_Player.GetInventory().AddItem(cItem(E_ITEM_MUSHROOM_SOUP)); } } break; case E_ITEM_SHEARS: |