summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Items/ItemHandler.cpp87
1 files changed, 59 insertions, 28 deletions
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index 6ffcc718d..caa623abc 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -33,6 +33,7 @@
#include "ItemLilypad.h"
#include "ItemMap.h"
#include "ItemMinecart.h"
+#include "ItemMushroomSoup.h"
#include "ItemNetherWart.h"
#include "ItemPainting.h"
#include "ItemPickaxe.h"
@@ -125,6 +126,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
case E_BLOCK_LILY_PAD: return new cItemLilypadHandler(a_ItemType);
case E_ITEM_MAP: return new cItemMapHandler();
case E_ITEM_MILK: return new cItemMilkHandler();
+ case E_ITEM_MUSHROOM_SOUP: return new cItemMushroomSoupHandler(a_ItemType);
case E_ITEM_ITEM_FRAME: return new cItemItemFrameHandler(a_ItemType);
case E_ITEM_NETHER_WART: return new cItemNetherWartHandler(a_ItemType);
case E_ITEM_PAINTING: return new cItemPaintingHandler(a_ItemType);
@@ -191,6 +193,11 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
return new cItemSeedsHandler(a_ItemType);
}
+ case E_ITEM_ACACIA_DOOR:
+ case E_ITEM_BIRCH_DOOR:
+ case E_ITEM_DARK_OAK_DOOR:
+ case E_ITEM_JUNGLE_DOOR:
+ case E_ITEM_SPRUCE_DOOR:
case E_ITEM_IRON_DOOR:
case E_ITEM_WOODEN_DOOR:
{
@@ -212,20 +219,22 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
case E_ITEM_BREAD:
case E_ITEM_COOKED_CHICKEN:
case E_ITEM_COOKED_FISH:
+ case E_ITEM_COOKED_MUTTON:
case E_ITEM_COOKED_PORKCHOP:
+ case E_ITEM_COOKED_RABBIT:
case E_ITEM_COOKIE:
case E_ITEM_GOLDEN_CARROT:
case E_ITEM_MELON_SLICE:
- case E_ITEM_MUSHROOM_SOUP:
- case E_ITEM_MUTTON:
case E_ITEM_POISONOUS_POTATO:
case E_ITEM_PUMPKIN_PIE:
- case E_ITEM_RED_APPLE:
+ case E_ITEM_RABBIT_STEW:
case E_ITEM_RAW_BEEF:
case E_ITEM_RAW_CHICKEN:
case E_ITEM_RAW_FISH:
case E_ITEM_RAW_MUTTON:
case E_ITEM_RAW_PORKCHOP:
+ case E_ITEM_RAW_RABBIT:
+ case E_ITEM_RED_APPLE:
case E_ITEM_ROTTEN_FLESH:
case E_ITEM_SPIDER_EYE:
case E_ITEM_STEAK:
@@ -333,7 +342,7 @@ void cItemHandler::OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const
{
cChunkInterface ChunkInterface(a_World->GetChunkMap());
cBlockInServerPluginInterface PluginInterface(*a_World);
- Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ, CanHarvestBlock(Block), a_Player->GetEquippedItem().m_Enchantments.GetLevel(cEnchantments::enchSilkTouch) > 0);
+ Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ, CanHarvestBlock(Block));
}
if (!cBlockInfo::IsOneHitDig(Block))
@@ -391,8 +400,12 @@ char cItemHandler::GetMaxStackSize(void)
switch (m_ItemType)
{
+ case E_ITEM_ACACIA_DOOR: return 64;
+ case E_ITEM_ARMOR_STAND: return 16;
case E_ITEM_ARROW: return 64;
case E_ITEM_BAKED_POTATO: return 64;
+ case E_ITEM_BANNER: return 16;
+ case E_ITEM_BIRCH_DOOR: return 64;
case E_ITEM_BLAZE_POWDER: return 64;
case E_ITEM_BLAZE_ROD: return 64;
case E_ITEM_BONE: return 64;
@@ -403,7 +416,6 @@ char cItemHandler::GetMaxStackSize(void)
case E_ITEM_BREWING_STAND: return 64;
case E_ITEM_BUCKET: return 16;
case E_ITEM_CARROT: return 64;
- case E_ITEM_CAKE: return 1;
case E_ITEM_CAULDRON: return 64;
case E_ITEM_CLAY: return 64;
case E_ITEM_CLAY_BRICK: return 64;
@@ -414,7 +426,9 @@ char cItemHandler::GetMaxStackSize(void)
case E_ITEM_COOKED_CHICKEN: return 64;
case E_ITEM_COOKED_FISH: return 64;
case E_ITEM_COOKED_PORKCHOP: return 64;
+ case E_ITEM_COOKED_MUTTON: return 64;
case E_ITEM_COOKIE: return 64;
+ case E_ITEM_DARK_OAK_DOOR: return 64;
case E_ITEM_DIAMOND: return 64;
case E_ITEM_DYE: return 64;
case E_ITEM_EGG: return 16;
@@ -438,6 +452,7 @@ char cItemHandler::GetMaxStackSize(void)
case E_ITEM_GOLD_NUGGET: return 64;
case E_ITEM_GUNPOWDER: return 64;
case E_ITEM_HEAD: return 64;
+ case E_ITEM_JUNGLE_DOOR: return 64;
case E_ITEM_IRON: return 64;
case E_ITEM_ITEM_FRAME: return 64;
case E_ITEM_LEATHER: return 64;
@@ -451,11 +466,16 @@ char cItemHandler::GetMaxStackSize(void)
case E_ITEM_PAPER: return 64;
case E_ITEM_POISONOUS_POTATO: return 64;
case E_ITEM_POTATO: return 64;
+ case E_ITEM_PRISMARINE_CRYSTALS: return 64;
+ case E_ITEM_PRISMARINE_SHARD: return 64;
case E_ITEM_PUMPKIN_PIE: return 64;
case E_ITEM_PUMPKIN_SEEDS: return 64;
+ case E_ITEM_RABBITS_FOOT: return 64;
+ case E_ITEM_RABBIT_HIDE: return 64;
case E_ITEM_RAW_BEEF: return 64;
case E_ITEM_RAW_CHICKEN: return 64;
case E_ITEM_RAW_FISH: return 64;
+ case E_ITEM_RAW_MUTTON: return 64;
case E_ITEM_RAW_PORKCHOP: return 64;
case E_ITEM_RED_APPLE: return 64;
case E_ITEM_REDSTONE_DUST: return 64;
@@ -467,6 +487,7 @@ char cItemHandler::GetMaxStackSize(void)
case E_ITEM_SNOWBALL: return 16;
case E_ITEM_SPAWN_EGG: return 64;
case E_ITEM_SPIDER_EYE: return 64;
+ case E_ITEM_SPRUCE_DOOR: return 64;
case E_ITEM_STEAK: return 64;
case E_ITEM_STICK: return 64;
case E_ITEM_STRING: return 64;
@@ -545,41 +566,47 @@ bool cItemHandler::CanHarvestBlock(BLOCKTYPE a_BlockType)
switch (a_BlockType)
{
case E_BLOCK_ANVIL:
- case E_BLOCK_ENCHANTMENT_TABLE:
- case E_BLOCK_FURNACE:
- case E_BLOCK_LIT_FURNACE:
+ case E_BLOCK_BRICK:
+ case E_BLOCK_CAULDRON:
case E_BLOCK_COAL_ORE:
- case E_BLOCK_STONE:
case E_BLOCK_COBBLESTONE:
- case E_BLOCK_END_STONE:
- case E_BLOCK_MOSSY_COBBLESTONE:
- case E_BLOCK_SANDSTONE_STAIRS:
- case E_BLOCK_SANDSTONE:
- case E_BLOCK_STONE_BRICKS:
- case E_BLOCK_NETHER_BRICK:
- case E_BLOCK_NETHERRACK:
- case E_BLOCK_STONE_SLAB:
- case E_BLOCK_DOUBLE_STONE_SLAB:
- case E_BLOCK_STONE_PRESSURE_PLATE:
- case E_BLOCK_BRICK:
case E_BLOCK_COBBLESTONE_STAIRS:
case E_BLOCK_COBBLESTONE_WALL:
- case E_BLOCK_STONE_BRICK_STAIRS:
- case E_BLOCK_NETHER_BRICK_STAIRS:
- case E_BLOCK_CAULDRON:
- case E_BLOCK_OBSIDIAN:
case E_BLOCK_DIAMOND_BLOCK:
case E_BLOCK_DIAMOND_ORE:
+ case E_BLOCK_DOUBLE_STONE_SLAB:
+ case E_BLOCK_EMERALD_ORE:
+ case E_BLOCK_ENCHANTMENT_TABLE:
+ case E_BLOCK_END_STONE:
+ case E_BLOCK_FURNACE:
case E_BLOCK_GOLD_BLOCK:
case E_BLOCK_GOLD_ORE:
- case E_BLOCK_REDSTONE_ORE:
- case E_BLOCK_REDSTONE_ORE_GLOWING:
- case E_BLOCK_EMERALD_ORE:
case E_BLOCK_IRON_BLOCK:
case E_BLOCK_IRON_ORE:
- case E_BLOCK_LAPIS_ORE:
+ case E_BLOCK_IRON_TRAPDOOR:
case E_BLOCK_LAPIS_BLOCK:
+ case E_BLOCK_LAPIS_ORE:
+ case E_BLOCK_LIT_FURNACE:
+ case E_BLOCK_MOSSY_COBBLESTONE:
+ case E_BLOCK_NETHER_BRICK:
+ case E_BLOCK_NETHER_BRICK_STAIRS:
+ case E_BLOCK_NETHER_BRICK_FENCE:
+ case E_BLOCK_NETHERRACK:
+ case E_BLOCK_NEW_STONE_SLAB:
+ case E_BLOCK_OBSIDIAN:
+ case E_BLOCK_PRISMARINE_BLOCK:
+ case E_BLOCK_RED_SANDSTONE:
+ case E_BLOCK_RED_SANDSTONE_STAIRS:
+ case E_BLOCK_REDSTONE_ORE:
+ case E_BLOCK_REDSTONE_ORE_GLOWING:
+ case E_BLOCK_SANDSTONE_STAIRS:
+ case E_BLOCK_SANDSTONE:
case E_BLOCK_SNOW:
+ case E_BLOCK_STONE:
+ case E_BLOCK_STONE_BRICKS:
+ case E_BLOCK_STONE_BRICK_STAIRS:
+ case E_BLOCK_STONE_PRESSURE_PLATE:
+ case E_BLOCK_STONE_SLAB:
case E_BLOCK_VINES:
case E_BLOCK_PACKED_ICE:
case E_BLOCK_MOB_SPAWNER:
@@ -635,6 +662,10 @@ bool cItemHandler::GetEatEffect(cEntityEffect::eType & a_EffectType, int & a_Eff
bool cItemHandler::EatItem(cPlayer * a_Player, cItem * a_Item)
{
UNUSED(a_Item);
+ if (!a_Player->IsGameModeCreative())
+ {
+ a_Player->GetInventory().RemoveOneEquippedItem();
+ }
FoodInfo Info = GetFoodInfo();
if ((Info.FoodLevel > 0) || (Info.Saturation > 0.f))