summaryrefslogtreecommitdiffstats
path: root/src/Items
diff options
context:
space:
mode:
Diffstat (limited to 'src/Items')
-rw-r--r--src/Items/CMakeLists.txt54
-rw-r--r--src/Items/ItemBucket.h2
-rw-r--r--src/Items/ItemFood.h2
-rw-r--r--src/Items/ItemHandler.cpp4
-rw-r--r--src/Items/ItemPickaxe.h4
-rw-r--r--src/Items/ItemPotion.h6
-rw-r--r--src/Items/ItemShovel.h2
-rw-r--r--src/Items/ItemSign.h7
8 files changed, 63 insertions, 18 deletions
diff --git a/src/Items/CMakeLists.txt b/src/Items/CMakeLists.txt
index a6fe6ea70..12a467672 100644
--- a/src/Items/CMakeLists.txt
+++ b/src/Items/CMakeLists.txt
@@ -4,9 +4,53 @@ project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
-file(GLOB SOURCE
- "*.cpp"
- "*.h"
-)
+SET (SRCS
+ ItemHandler.cpp)
-add_library(Items ${SOURCE})
+SET (HDRS
+ ItemArmor.h
+ ItemBed.h
+ ItemBoat.h
+ ItemBow.h
+ ItemBrewingStand.h
+ ItemBucket.h
+ ItemCake.h
+ ItemCauldron.h
+ ItemCloth.h
+ ItemComparator.h
+ ItemDoor.h
+ ItemDye.h
+ ItemEmptyMap.h
+ ItemFishingRod.h
+ ItemFlowerPot.h
+ ItemFood.h
+ ItemHandler.h
+ ItemHoe.h
+ ItemItemFrame.h
+ ItemLeaves.h
+ ItemLighter.h
+ ItemLilypad.h
+ ItemMap.h
+ ItemMilk.h
+ ItemMinecart.h
+ ItemMobHead.h
+ ItemNetherWart.h
+ ItemPainting.h
+ ItemPickaxe.h
+ ItemPotion.h
+ ItemRedstoneDust.h
+ ItemRedstoneRepeater.h
+ ItemSapling.h
+ ItemSeeds.h
+ ItemShears.h
+ ItemShovel.h
+ ItemSign.h
+ ItemSpawnEgg.h
+ ItemString.h
+ ItemSugarcane.h
+ ItemSword.h
+ ItemThrowable.h)
+
+if(NOT MSVC)
+ add_library(Items ${SRCS} ${HDRS})
+endif()
diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h
index 6d7926fa4..a17c4838b 100644
--- a/src/Items/ItemBucket.h
+++ b/src/Items/ItemBucket.h
@@ -117,7 +117,7 @@ public:
return false;
}
cItem Item(E_ITEM_BUCKET, 1);
- if (!a_Player->GetInventory().AddItem(Item,true,true))
+ if (!a_Player->GetInventory().AddItem(Item, true, true))
{
return false;
}
diff --git a/src/Items/ItemFood.h b/src/Items/ItemFood.h
index 961cf482d..ff1d7991b 100644
--- a/src/Items/ItemFood.h
+++ b/src/Items/ItemFood.h
@@ -26,7 +26,7 @@ public:
virtual FoodInfo GetFoodInfo(void) override
{
- switch(m_ItemType)
+ switch (m_ItemType)
{
// Please keep alpha-sorted.
case E_ITEM_BAKED_POTATO: return FoodInfo(6, 7.2);
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index 178bc2fca..bf1d4e4cb 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -94,7 +94,7 @@ cItemHandler * cItemHandler::GetItemHandler(int a_ItemType)
cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
{
- switch(a_ItemType)
+ switch (a_ItemType)
{
default: return new cItemHandler(a_ItemType);
@@ -263,7 +263,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
void cItemHandler::Deinit()
{
- for(int i = 0; i < 2267; i++)
+ for (int i = 0; i < 2267; i++)
{
delete m_ItemHandler[i];
m_ItemHandler[i] = NULL;
diff --git a/src/Items/ItemPickaxe.h b/src/Items/ItemPickaxe.h
index 82bec52d4..647d59b5c 100644
--- a/src/Items/ItemPickaxe.h
+++ b/src/Items/ItemPickaxe.h
@@ -17,7 +17,7 @@ public:
char PickaxeLevel()
{
- switch(m_ItemType)
+ switch (m_ItemType)
{
case E_ITEM_WOODEN_PICKAXE: return 1;
case E_ITEM_GOLD_PICKAXE: return 1;
@@ -31,7 +31,7 @@ public:
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
{
- switch(a_BlockType)
+ switch (a_BlockType)
{
case E_BLOCK_OBSIDIAN:
{
diff --git a/src/Items/ItemPotion.h b/src/Items/ItemPotion.h
index f3afbf99b..f16d89b39 100644
--- a/src/Items/ItemPotion.h
+++ b/src/Items/ItemPotion.h
@@ -17,8 +17,8 @@ public:
}
- /** Returns the potion particle type (used by the client for visuals), based on the potion's damage value */
- static int GetPotionParticleType(short a_ItemDamage)
+ /** Returns the potion color (used by the client for visuals), based on the potion's damage value */
+ static int GetPotionColor(short a_ItemDamage)
{
// Lowest six bits
return (a_ItemDamage & 0x3f);
@@ -156,7 +156,7 @@ public:
cSplashPotionEntity * Projectile = new cSplashPotionEntity(
a_Player, Pos.x, Pos.y, Pos.z, Speed,
GetEntityEffectType(PotionDamage), cEntityEffect(GetEntityEffectDuration(PotionDamage),
- GetEntityEffectIntensity(PotionDamage)), GetPotionParticleType(PotionDamage)
+ GetEntityEffectIntensity(PotionDamage)), GetPotionColor(PotionDamage)
);
if (Projectile == NULL)
{
diff --git a/src/Items/ItemShovel.h b/src/Items/ItemShovel.h
index 333ba46e8..78cfe26fe 100644
--- a/src/Items/ItemShovel.h
+++ b/src/Items/ItemShovel.h
@@ -28,7 +28,7 @@ public:
{
cChunkInterface ChunkInterface(a_World->GetChunkMap());
cBlockInServerPluginInterface PluginInterface(*a_World);
- BlockHandler(Block)->DropBlock(ChunkInterface,*a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ);
+ BlockHandler(Block)->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ);
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
a_Player->UseEquippedItem();
diff --git a/src/Items/ItemSign.h b/src/Items/ItemSign.h
index 235a4fa93..0fa0fa0be 100644
--- a/src/Items/ItemSign.h
+++ b/src/Items/ItemSign.h
@@ -3,7 +3,8 @@
#include "ItemHandler.h"
#include "../World.h"
-#include "../Blocks/BlockSign.h"
+#include "../Blocks/BlockSignPost.h"
+#include "../Blocks/BlockWallSign.h"
@@ -34,12 +35,12 @@ public:
{
if (a_BlockFace == BLOCK_FACE_TOP)
{
- a_BlockMeta = cBlockSignHandler::RotationToMetaData(a_Player->GetYaw());
+ a_BlockMeta = cBlockSignPostHandler::RotationToMetaData(a_Player->GetYaw());
a_BlockType = E_BLOCK_SIGN_POST;
}
else
{
- a_BlockMeta = cBlockSignHandler::DirectionToMetaData(a_BlockFace);
+ a_BlockMeta = cBlockWallSignHandler::DirectionToMetaData(a_BlockFace);
a_BlockType = E_BLOCK_WALLSIGN;
}
return true;