summaryrefslogtreecommitdiffstats
path: root/src/Items
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:45:45 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:50:18 +0100
commitca6ef58b1ee8521e4b940ee4883dee714960e413 (patch)
tree8532add455224b07c07a759e3d906f50c0695888 /src/Items
parentMerge pull request #2972 from marvinkopf/PlayerAutoComplete (diff)
downloadcuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.gz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.bz2
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.lz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.xz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.zst
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.zip
Diffstat (limited to '')
-rw-r--r--src/Items/ItemArmor.h6
-rw-r--r--src/Items/ItemBed.h2
-rw-r--r--src/Items/ItemBoat.h16
-rw-r--r--src/Items/ItemBow.h14
-rw-r--r--src/Items/ItemBucket.h24
-rw-r--r--src/Items/ItemChest.h6
-rw-r--r--src/Items/ItemEmptyMap.h2
-rw-r--r--src/Items/ItemFishingRod.h2
-rw-r--r--src/Items/ItemFood.h2
-rw-r--r--src/Items/ItemGoldenApple.h2
-rw-r--r--src/Items/ItemHandler.cpp44
-rw-r--r--src/Items/ItemHandler.h22
-rw-r--r--src/Items/ItemLeaves.h2
-rw-r--r--src/Items/ItemLighter.h2
-rw-r--r--src/Items/ItemMap.h2
-rw-r--r--src/Items/ItemMilk.h4
-rw-r--r--src/Items/ItemMinecart.h12
-rw-r--r--src/Items/ItemMobHead.h6
-rw-r--r--src/Items/ItemNetherWart.h2
-rw-r--r--src/Items/ItemPickaxe.h8
-rw-r--r--src/Items/ItemPotion.h24
-rw-r--r--src/Items/ItemSeeds.h6
-rw-r--r--src/Items/ItemShears.h8
-rw-r--r--src/Items/ItemShovel.h2
-rw-r--r--src/Items/ItemSign.h2
-rw-r--r--src/Items/ItemSpawnEgg.h6
-rw-r--r--src/Items/ItemSword.h2
-rw-r--r--src/Items/ItemThrowable.h8
28 files changed, 119 insertions, 119 deletions
diff --git a/src/Items/ItemArmor.h b/src/Items/ItemArmor.h
index 252b94df9..906993a5b 100644
--- a/src/Items/ItemArmor.h
+++ b/src/Items/ItemArmor.h
@@ -47,14 +47,14 @@ public:
LOGWARNING("Used unknown armor: %i", a_Item.m_ItemType);
return false;
}
-
+
if (!a_Player->GetInventory().GetArmorSlot(SlotNum).IsEmpty())
{
return false;
}
-
+
a_Player->GetInventory().SetArmorSlot(SlotNum, a_Item.CopyOne());
-
+
cItem Item(a_Item);
Item.m_ItemCount--;
if (Item.m_ItemCount <= 0)
diff --git a/src/Items/ItemBed.h b/src/Items/ItemBed.h
index 15b924a08..7f30a65c5 100644
--- a/src/Items/ItemBed.h
+++ b/src/Items/ItemBed.h
@@ -41,7 +41,7 @@ public:
// The "foot" block:
NIBBLETYPE BlockMeta = cBlockBedHandler::RotationToMetaData(a_Player.GetYaw());
a_BlocksToPlace.emplace_back(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_BED, BlockMeta);
-
+
// Check if there is empty space for the "head" block:
// (Vanilla only allows beds to be placed into air)
Vector3i Direction = cBlockBedHandler::MetaDataToDirection(BlockMeta);
diff --git a/src/Items/ItemBoat.h b/src/Items/ItemBoat.h
index 452d86775..208904130 100644
--- a/src/Items/ItemBoat.h
+++ b/src/Items/ItemBoat.h
@@ -19,15 +19,15 @@ class cItemBoatHandler :
public cItemHandler
{
typedef cItemHandler super;
-
+
public:
cItemBoatHandler(int a_ItemType) :
super(a_ItemType)
{
}
-
-
-
+
+
+
virtual bool OnItemUse(
cWorld * a_World, cPlayer * a_Player, cBlockPluginInterface & a_PluginInterface, const cItem & a_Item,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace
@@ -44,12 +44,12 @@ public:
public:
Vector3d m_Pos;
bool m_HasFound;
-
+
cCallbacks(void) :
m_HasFound(false)
{
}
-
+
virtual bool OnNextBlock(int a_CBBlockX, int a_CBBlockY, int a_CBBlockZ, BLOCKTYPE a_CBBlockType, NIBBLETYPE a_CBBlockMeta, char a_CBEntryFace) override
{
if (a_CBBlockType != E_BLOCK_AIR)
@@ -61,7 +61,7 @@ public:
return false;
}
} Callbacks;
-
+
cLineBlockTracer Tracer(*a_World, Callbacks);
Vector3d Start(a_Player->GetEyePosition() + a_Player->GetLookVector());
Vector3d End(a_Player->GetEyePosition() + a_Player->GetLookVector() * 5);
@@ -76,7 +76,7 @@ public:
double x = Callbacks.m_Pos.x;
double y = Callbacks.m_Pos.y;
double z = Callbacks.m_Pos.z;
-
+
cBoat * Boat = new cBoat(x + 0.5, y + 1, z + 0.5);
Boat->Initialize(*a_World);
diff --git a/src/Items/ItemBow.h b/src/Items/ItemBow.h
index 8bbaa3d8c..fc0ee8434 100644
--- a/src/Items/ItemBow.h
+++ b/src/Items/ItemBow.h
@@ -19,22 +19,22 @@ class cItemBowHandler :
public cItemHandler
{
typedef cItemHandler super;
-
+
public:
cItemBowHandler(void) :
super(E_ITEM_BOW)
{
}
-
-
+
+
virtual bool OnItemUse(
cWorld * a_World, cPlayer * a_Player, cBlockPluginInterface & a_PluginInterface, const cItem & a_Item,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace
) override
{
ASSERT(a_Player != nullptr);
-
+
// Check if the player has an arrow in the inventory, or is in Creative:
if (!(a_Player->IsGameModeCreative() || a_Player->GetInventory().HasItems(cItem(E_ITEM_ARROW))))
{
@@ -45,8 +45,8 @@ public:
return true;
}
-
-
+
+
virtual void OnItemShoot(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override
{
// Actual shot - produce the arrow with speed based on the ticks that the bow was charged
@@ -98,7 +98,7 @@ public:
{
Arrow->SetPickupState(cArrowEntity::psNoPickup);
}
-
+
a_Player->UseEquippedItem();
}
diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h
index 4d39bde82..180a363ec 100644
--- a/src/Items/ItemBucket.h
+++ b/src/Items/ItemBucket.h
@@ -42,9 +42,9 @@ public:
}
}
}
-
-
-
+
+
+
bool ScoopUpFluid(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace)
{
if (a_BlockFace != BLOCK_FACE_NONE)
@@ -79,7 +79,7 @@ public:
{
return false;
}
-
+
// Check to see if destination block is too far away
// Reach Distance Multiplayer = 5 Blocks
if ((BlockPos.x - a_Player->GetPosX() > 5) || (BlockPos.z - a_Player->GetPosZ() > 5))
@@ -124,7 +124,7 @@ public:
{
return false;
}
-
+
BLOCKTYPE CurrentBlockType;
NIBBLETYPE CurrentBlockMeta;
eBlockFace EntryFace;
@@ -140,7 +140,7 @@ public:
{
return false;
}
-
+
if (a_Player->GetGameMode() != gmCreative)
{
// Remove fluid bucket, add empty bucket:
@@ -156,7 +156,7 @@ public:
return false;
}
}
-
+
// Wash away anything that was there prior to placing:
if (cFluidSimulator::CanWashAway(CurrentBlockType))
{
@@ -189,13 +189,13 @@ public:
public:
Vector3i m_Pos;
bool m_HasHitFluid;
-
+
cCallbacks(void) :
m_HasHitFluid(false)
{
}
-
+
virtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, char a_EntryFace) override
{
if (IsBlockWater(a_BlockType) || IsBlockLava(a_BlockType))
@@ -227,8 +227,8 @@ public:
a_BlockPos = Callbacks.m_Pos;
return true;
}
-
-
+
+
bool GetPlacementCoordsFromTrace(cWorld * a_World, cPlayer * a_Player, Vector3i & a_BlockPos, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta, eBlockFace & a_BlockFace)
{
@@ -240,7 +240,7 @@ public:
BLOCKTYPE m_ReplacedBlockType;
NIBBLETYPE m_ReplacedBlockMeta;
eBlockFace m_EntryFace;
-
+
virtual bool OnNextBlock(int a_CBBlockX, int a_CBBlockY, int a_CBBlockZ, BLOCKTYPE a_CBBlockType, NIBBLETYPE a_CBBlockMeta, char a_CBEntryFace) override
{
if (a_CBBlockType != E_BLOCK_AIR)
diff --git a/src/Items/ItemChest.h b/src/Items/ItemChest.h
index 3dd112c91..786ed1067 100644
--- a/src/Items/ItemChest.h
+++ b/src/Items/ItemChest.h
@@ -40,7 +40,7 @@ public:
// Clicked in air
return false;
}
-
+
if ((a_BlockY < 0) || (a_BlockY >= cChunkDef::Height))
{
// The clicked block is outside the world, ignore this call altogether (#128)
@@ -62,13 +62,13 @@ public:
else
{
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
-
+
if ((a_BlockY < 0) || (a_BlockY >= cChunkDef::Height))
{
// The block is being placed outside the world, ignore this packet altogether (#128)
return false;
}
-
+
NIBBLETYPE PlaceMeta;
BLOCKTYPE PlaceBlock;
a_World.GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, PlaceBlock, PlaceMeta);
diff --git a/src/Items/ItemEmptyMap.h b/src/Items/ItemEmptyMap.h
index f26f915c4..78d037313 100644
--- a/src/Items/ItemEmptyMap.h
+++ b/src/Items/ItemEmptyMap.h
@@ -20,7 +20,7 @@ class cItemEmptyMapHandler :
typedef cItemHandler super;
static const unsigned int DEFAULT_SCALE = 0;
-
+
public:
cItemEmptyMapHandler() :
super(E_ITEM_EMPTY_MAP)
diff --git a/src/Items/ItemFishingRod.h b/src/Items/ItemFishingRod.h
index 355ff2eae..3a2ef0275 100644
--- a/src/Items/ItemFishingRod.h
+++ b/src/Items/ItemFishingRod.h
@@ -86,7 +86,7 @@ class cItemFishingRodHandler :
public cItemHandler
{
typedef cItemHandler super;
-
+
public:
cItemFishingRodHandler(int a_ItemType) :
super(a_ItemType)
diff --git a/src/Items/ItemFood.h b/src/Items/ItemFood.h
index 2fbbb2528..cfdac26c6 100644
--- a/src/Items/ItemFood.h
+++ b/src/Items/ItemFood.h
@@ -11,7 +11,7 @@ class cItemFoodHandler :
public cItemHandler
{
typedef cItemHandler super;
-
+
public:
cItemFoodHandler(int a_ItemType)
: super(a_ItemType)
diff --git a/src/Items/ItemGoldenApple.h b/src/Items/ItemGoldenApple.h
index 5f6f1de6c..c6bd7e470 100644
--- a/src/Items/ItemGoldenApple.h
+++ b/src/Items/ItemGoldenApple.h
@@ -10,7 +10,7 @@ class cItemGoldenAppleHandler :
public cItemFoodHandler
{
typedef cItemFoodHandler super;
-
+
public:
cItemGoldenAppleHandler()
: super(E_ITEM_GOLDEN_APPLE)
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index 5d088dfcd..8a05149b0 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -104,7 +104,7 @@ cItemHandler * cItemHandler::CreateItemHandler(int a_ItemType)
switch (a_ItemType)
{
default: return new cItemHandler(a_ItemType);
-
+
// Single item per handler, alphabetically sorted:
case E_BLOCK_BIG_FLOWER: return new cItemBigFlowerHandler;
case E_BLOCK_CHEST: return new cItemChestHandler(a_ItemType);
@@ -152,7 +152,7 @@ cItemHandler * cItemHandler::CreateItemHandler(int a_ItemType)
case E_ITEM_SPAWN_EGG: return new cItemSpawnEggHandler(a_ItemType);
case E_ITEM_STRING: return new cItemStringHandler(a_ItemType);
case E_ITEM_SUGARCANE: return new cItemSugarcaneHandler(a_ItemType);
-
+
case E_ITEM_WOODEN_HOE:
case E_ITEM_STONE_HOE:
case E_ITEM_IRON_HOE:
@@ -161,7 +161,7 @@ cItemHandler * cItemHandler::CreateItemHandler(int a_ItemType)
{
return new cItemHoeHandler(a_ItemType);
}
-
+
case E_ITEM_WOODEN_PICKAXE:
case E_ITEM_STONE_PICKAXE:
case E_ITEM_IRON_PICKAXE:
@@ -170,7 +170,7 @@ cItemHandler * cItemHandler::CreateItemHandler(int a_ItemType)
{
return new cItemPickaxeHandler(a_ItemType);
}
-
+
case E_ITEM_WOODEN_SHOVEL:
case E_ITEM_STONE_SHOVEL:
case E_ITEM_IRON_SHOVEL:
@@ -179,7 +179,7 @@ cItemHandler * cItemHandler::CreateItemHandler(int a_ItemType)
{
return new cItemShovelHandler(a_ItemType);
}
-
+
case E_ITEM_WOODEN_SWORD:
case E_ITEM_STONE_SWORD:
case E_ITEM_IRON_SWORD:
@@ -188,14 +188,14 @@ cItemHandler * cItemHandler::CreateItemHandler(int a_ItemType)
{
return new cItemSwordHandler(a_ItemType);
}
-
+
case E_ITEM_BUCKET:
case E_ITEM_WATER_BUCKET:
case E_ITEM_LAVA_BUCKET:
{
return new cItemBucketHandler(a_ItemType);
}
-
+
case E_ITEM_CARROT:
case E_ITEM_MELON_SEEDS:
case E_ITEM_POTATO:
@@ -204,7 +204,7 @@ 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:
@@ -215,7 +215,7 @@ cItemHandler * cItemHandler::CreateItemHandler(int a_ItemType)
{
return new cItemDoorHandler(a_ItemType);
}
-
+
case E_ITEM_MINECART:
case E_ITEM_CHEST_MINECART:
case E_ITEM_FURNACE_MINECART:
@@ -224,7 +224,7 @@ cItemHandler * cItemHandler::CreateItemHandler(int a_ItemType)
{
return new cItemMinecartHandler(a_ItemType);
}
-
+
// Food (please keep alpha-sorted):
// (carrots and potatoes handled separately in SeedHandler as they're both seed and food)
case E_ITEM_BAKED_POTATO:
@@ -321,13 +321,13 @@ bool cItemHandler::OnPlayerPlace(
// Clicked in air
return false;
}
-
+
if ((a_BlockY < 0) || (a_BlockY >= cChunkDef::Height))
{
// The clicked block is outside the world, ignore this call altogether (#128)
return false;
}
-
+
BLOCKTYPE ClickedBlock;
NIBBLETYPE ClickedBlockMeta;
@@ -345,13 +345,13 @@ bool cItemHandler::OnPlayerPlace(
else
{
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
-
+
if ((a_BlockY < 0) || (a_BlockY >= cChunkDef::Height))
{
// The block is being placed outside the world, ignore this packet altogether (#128)
return false;
}
-
+
NIBBLETYPE PlaceMeta;
BLOCKTYPE PlaceBlock;
a_World.GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, PlaceBlock, PlaceMeta);
@@ -382,7 +382,7 @@ bool cItemHandler::OnPlayerPlace(
a_Player.GetInventory().SendEquippedSlot();
return false;
}
-
+
// Try to place the blocks:
if (!a_Player.PlaceBlocks(blocks))
{
@@ -477,7 +477,7 @@ bool cItemHandler::OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cI
UNUSED(a_BlockY);
UNUSED(a_BlockZ);
UNUSED(a_Dir);
-
+
return false;
}
@@ -488,7 +488,7 @@ bool cItemHandler::OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cI
void cItemHandler::OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ)
{
UNUSED(a_Item);
-
+
BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
cBlockHandler * Handler = cBlockInfo::GetHandler(Block);
@@ -537,7 +537,7 @@ short cItemHandler::GetDurabilityLossByAction(eDurabilityLostAction a_Action)
case dlaAttackEntity: return 2;
case dlaBreakBlock: return 1;
}
-
+
#ifndef __clang__
return 0;
#endif
@@ -554,7 +554,7 @@ char cItemHandler::GetMaxStackSize(void)
// All blocks can stack up to 64
return 64;
}
-
+
switch (m_ItemType)
{
case E_ITEM_ACACIA_DOOR: return 64;
@@ -693,7 +693,7 @@ bool cItemHandler::IsFood(void)
bool cItemHandler::IsDrinkable(short a_ItemDamage)
{
UNUSED(a_ItemDamage);
-
+
return false;
}
@@ -793,13 +793,13 @@ bool cItemHandler::GetPlacementBlockTypeMeta(
)
{
ASSERT(m_ItemType < 256); // Items with IDs above 255 should all be handled by specific handlers
-
+
if (m_ItemType >= 256)
{
LOGERROR("%s: Item %d is not eligible for direct block placement!", __FUNCTION__, m_ItemType);
return false;
}
-
+
cBlockHandler * BlockH = BlockHandler(static_cast<BLOCKTYPE>(m_ItemType));
cChunkInterface ChunkInterface(a_World->GetChunkMap());
return BlockH->GetPlacementBlockTypeMeta(
diff --git a/src/Items/ItemHandler.h b/src/Items/ItemHandler.h
index be2e2fade..a2b825fb7 100644
--- a/src/Items/ItemHandler.h
+++ b/src/Items/ItemHandler.h
@@ -29,7 +29,7 @@ public:
};
cItemHandler(int a_ItemType);
-
+
/** Force virtual destructor */
virtual ~cItemHandler() {}
@@ -45,7 +45,7 @@ public:
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
int a_CursorX, int a_CursorY, int a_CursorZ
);
-
+
/** Called from OnPlayerPlace() to determine the blocks that the current placement operation should set.
The block coords are where the new (main) block should be placed.
@@ -69,7 +69,7 @@ public:
int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
);
-
+
/** Called when the player tries to use the item (right mouse button).
Return false to abort the usage. DEFAULT: False */
@@ -77,7 +77,7 @@ public:
cWorld * a_World, cPlayer * a_Player, cBlockPluginInterface & a_PluginInterface, const cItem & a_Item,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace
);
-
+
/** Called when the client sends the SHOOT status in the lclk packet */
virtual void OnItemShoot(cPlayer *, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace)
@@ -95,16 +95,16 @@ public:
UNUSED(a_Player);
UNUSED(a_Item);
}
-
+
/** Called while the player diggs a block using this item */
virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_HeldItem, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace);
-
+
/** Called when the player destroys a block using this item. This also calls the drop function for the destroyed block */
virtual void OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ);
/** Called when a player attacks a other entity. */
virtual void OnEntityAttack(cPlayer * a_Attacker, cEntity * a_AttackedEntity);
-
+
/** Called after the player has eaten this item. */
virtual void OnFoodEaten(cWorld *a_World, cPlayer *a_Player, cItem *a_Item);
@@ -137,13 +137,13 @@ public:
/** Indicates if this item is a tool */
virtual bool IsTool(void);
-
+
/** Indicates if this item is food */
virtual bool IsFood(void);
-
+
/** Indicates if this item is drinkable */
virtual bool IsDrinkable(short a_ItemDamage);
-
+
/** Blocks simply get placed */
virtual bool IsPlaceable(void);
@@ -158,7 +158,7 @@ public:
static cItemHandler * GetItemHandler(const cItem & a_Item) { return GetItemHandler(a_Item.m_ItemType); }
static void Deinit();
-
+
protected:
int m_ItemType;
static cItemHandler * CreateItemHandler(int m_ItemType);
diff --git a/src/Items/ItemLeaves.h b/src/Items/ItemLeaves.h
index f48126dc5..57f1fa365 100644
--- a/src/Items/ItemLeaves.h
+++ b/src/Items/ItemLeaves.h
@@ -11,7 +11,7 @@ class cItemLeavesHandler :
public cItemHandler
{
typedef cItemHandler super;
-
+
public:
cItemLeavesHandler(int a_ItemType)
: cItemHandler(a_ItemType)
diff --git a/src/Items/ItemLighter.h b/src/Items/ItemLighter.h
index a1b4b871b..eda7ed64c 100644
--- a/src/Items/ItemLighter.h
+++ b/src/Items/ItemLighter.h
@@ -30,7 +30,7 @@ public:
{
return false;
}
-
+
if (!a_Player->IsGameModeCreative())
{
switch (m_ItemType)
diff --git a/src/Items/ItemMap.h b/src/Items/ItemMap.h
index 19b974767..afce4ba01 100644
--- a/src/Items/ItemMap.h
+++ b/src/Items/ItemMap.h
@@ -20,7 +20,7 @@ class cItemMapHandler :
typedef cItemHandler super;
static const unsigned int DEFAULT_RADIUS = 128;
-
+
public:
cItemMapHandler() :
super(E_ITEM_MAP)
diff --git a/src/Items/ItemMilk.h b/src/Items/ItemMilk.h
index c9a90865a..c426c0057 100644
--- a/src/Items/ItemMilk.h
+++ b/src/Items/ItemMilk.h
@@ -10,13 +10,13 @@ public:
super(E_ITEM_MILK)
{
}
-
+
virtual bool IsDrinkable(short a_ItemDamage) override
{
UNUSED(a_ItemDamage);
return true;
}
-
+
virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) override
{
UNUSED(a_Item);
diff --git a/src/Items/ItemMinecart.h b/src/Items/ItemMinecart.h
index 2cf42507b..6344c0178 100644
--- a/src/Items/ItemMinecart.h
+++ b/src/Items/ItemMinecart.h
@@ -18,15 +18,15 @@ class cItemMinecartHandler :
public cItemHandler
{
typedef cItemHandler super;
-
+
public:
cItemMinecartHandler(int a_ItemType) :
super(a_ItemType)
{
}
-
-
-
+
+
+
virtual bool OnItemUse(
cWorld * a_World, cPlayer * a_Player, cBlockPluginInterface & a_PluginInterface, const cItem & a_Item,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace
@@ -36,7 +36,7 @@ public:
{
return false;
}
-
+
// Check that there's rail in there:
BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
switch (Block)
@@ -55,7 +55,7 @@ public:
return false;
}
}
-
+
double x = static_cast<double>(a_BlockX) + 0.5;
double y = static_cast<double>(a_BlockY) + 0.5;
double z = static_cast<double>(a_BlockZ) + 0.5;
diff --git a/src/Items/ItemMobHead.h b/src/Items/ItemMobHead.h
index e0f72be9b..fdecabbbf 100644
--- a/src/Items/ItemMobHead.h
+++ b/src/Items/ItemMobHead.h
@@ -68,7 +68,7 @@ public:
cPlayer & m_Player;
eMobHeadType m_HeadType;
NIBBLETYPE m_BlockMeta;
-
+
virtual bool Item(cBlockEntity * a_BlockEntity)
{
if (a_BlockEntity->GetBlockType() != E_BLOCK_HEAD)
@@ -88,7 +88,7 @@ public:
MobHeadEntity->GetWorld()->BroadcastBlockEntity(MobHeadEntity->GetPosX(), MobHeadEntity->GetPosY(), MobHeadEntity->GetPosZ());
return false;
}
-
+
public:
cCallback (cPlayer & a_CBPlayer, eMobHeadType a_HeadType, NIBBLETYPE a_BlockMeta) :
m_Player(a_CBPlayer),
@@ -334,7 +334,7 @@ public:
return true;
}
-
+
virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
diff --git a/src/Items/ItemNetherWart.h b/src/Items/ItemNetherWart.h
index 10a0864b5..3586231b3 100644
--- a/src/Items/ItemNetherWart.h
+++ b/src/Items/ItemNetherWart.h
@@ -35,7 +35,7 @@ public:
// Only allow planting nether wart from the top side of the block
return false;
}
-
+
// Only allow placement on farmland
int X = a_BlockX;
int Y = a_BlockY;
diff --git a/src/Items/ItemPickaxe.h b/src/Items/ItemPickaxe.h
index 1d5abddb6..e69f47ae0 100644
--- a/src/Items/ItemPickaxe.h
+++ b/src/Items/ItemPickaxe.h
@@ -29,7 +29,7 @@ public:
default: return 0;
}
}
-
+
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
{
switch (a_BlockType)
@@ -38,7 +38,7 @@ public:
{
return PickaxeLevel() >= 4;
}
-
+
case E_BLOCK_DIAMOND_BLOCK:
case E_BLOCK_DIAMOND_ORE:
case E_BLOCK_EMERALD_ORE:
@@ -49,7 +49,7 @@ public:
{
return PickaxeLevel() >= 3;
}
-
+
case E_BLOCK_IRON_BLOCK:
case E_BLOCK_IRON_ORE:
case E_BLOCK_LAPIS_ORE:
@@ -57,7 +57,7 @@ public:
{
return PickaxeLevel() >= 2;
}
-
+
case E_BLOCK_ANVIL:
case E_BLOCK_BRICK:
case E_BLOCK_CAULDRON:
diff --git a/src/Items/ItemPotion.h b/src/Items/ItemPotion.h
index a176c591e..01c011fa3 100644
--- a/src/Items/ItemPotion.h
+++ b/src/Items/ItemPotion.h
@@ -8,14 +8,14 @@ class cItemPotionHandler:
public cItemHandler
{
typedef cItemHandler super;
-
+
public:
cItemPotionHandler():
super(E_ITEM_POTION)
{
}
-
+
// cItemHandler overrides:
virtual bool IsDrinkable(short a_ItemDamage) override
@@ -25,47 +25,47 @@ public:
return cEntityEffect::IsPotionDrinkable(a_ItemDamage);
}
-
+
virtual bool OnItemUse(
cWorld * a_World, cPlayer * a_Player, cBlockPluginInterface & a_PluginInterface, const cItem & a_Item,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace
) override
{
short PotionDamage = a_Item.m_ItemDamage;
-
+
// Do not throw non-splash potions:
if (cEntityEffect::IsPotionDrinkable(PotionDamage))
{
return false;
}
-
+
Vector3d Pos = a_Player->GetThrowStartPos();
Vector3d Speed = a_Player->GetLookVector() * 7;
-
+
if (a_World->CreateProjectile(Pos.x, Pos.y, Pos.z, cProjectileEntity::pkSplashPotion, a_Player, &a_Player->GetEquippedItem(), &Speed) == cEntity::INVALID_ID)
{
return false;
}
-
+
if (!a_Player->IsGameModeCreative())
{
a_Player->GetInventory().RemoveOneEquippedItem();
}
-
+
return true;
}
-
-
+
+
virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) override
{
short PotionDamage = a_Item->m_ItemDamage;
-
+
// Do not drink undrinkable potions:
if (!cEntityEffect::IsPotionDrinkable(a_Item->m_ItemDamage))
{
return false;
}
-
+
a_Player->AddEntityEffect(
cEntityEffect::GetPotionEffectType(PotionDamage),
cEntityEffect::GetPotionEffectDuration(PotionDamage),
diff --git a/src/Items/ItemSeeds.h b/src/Items/ItemSeeds.h
index e1db7c5f4..408899a78 100644
--- a/src/Items/ItemSeeds.h
+++ b/src/Items/ItemSeeds.h
@@ -42,7 +42,7 @@ public:
default: return FoodInfo(0, 0);
}
}
-
+
virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
@@ -55,7 +55,7 @@ public:
// Only allow planting seeds from the top side of the block
return false;
}
-
+
// Only allow placement on farmland
int X = a_BlockX;
int Y = a_BlockY;
@@ -65,7 +65,7 @@ public:
{
return false;
}
-
+
a_BlockMeta = 0;
switch (m_ItemType)
{
diff --git a/src/Items/ItemShears.h b/src/Items/ItemShears.h
index 73343f629..c8034b112 100644
--- a/src/Items/ItemShears.h
+++ b/src/Items/ItemShears.h
@@ -18,14 +18,14 @@ public:
cItemHandler(a_ItemType)
{
}
-
-
+
+
virtual bool IsTool(void) override
{
return true;
}
-
-
+
+
virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override
{
BLOCKTYPE Block;
diff --git a/src/Items/ItemShovel.h b/src/Items/ItemShovel.h
index cd235678d..739ed833e 100644
--- a/src/Items/ItemShovel.h
+++ b/src/Items/ItemShovel.h
@@ -36,7 +36,7 @@ public:
}
return false;
}
-
+
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
{
if (a_BlockType == E_BLOCK_SNOW)
diff --git a/src/Items/ItemSign.h b/src/Items/ItemSign.h
index 3da93e2f1..d8d0197d3 100644
--- a/src/Items/ItemSign.h
+++ b/src/Items/ItemSign.h
@@ -45,7 +45,7 @@ public:
return true;
}
-
+
virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
diff --git a/src/Items/ItemSpawnEgg.h b/src/Items/ItemSpawnEgg.h
index 85dd2d245..52317a6cb 100644
--- a/src/Items/ItemSpawnEgg.h
+++ b/src/Items/ItemSpawnEgg.h
@@ -29,7 +29,7 @@ public:
{
return false;
}
-
+
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
if (a_BlockFace == BLOCK_FACE_YM)
@@ -49,11 +49,11 @@ public:
}
return true;
}
-
+
return false;
}
-
+
/** Converts the Spawn egg item damage to the monster type to spawn.
Returns mtInvalidType for invalid damage values. */
static eMonsterType ItemDamageToMonsterType(short a_ItemDamage)
diff --git a/src/Items/ItemSword.h b/src/Items/ItemSword.h
index 3b0db7b21..a15a9e3db 100644
--- a/src/Items/ItemSword.h
+++ b/src/Items/ItemSword.h
@@ -51,7 +51,7 @@ public:
case dlaAttackEntity: return 1;
case dlaBreakBlock: return 2;
}
-
+
#ifndef __clang__
return 0;
#endif
diff --git a/src/Items/ItemThrowable.h b/src/Items/ItemThrowable.h
index 0e06623fc..d5a109887 100644
--- a/src/Items/ItemThrowable.h
+++ b/src/Items/ItemThrowable.h
@@ -24,7 +24,7 @@ public:
m_SpeedCoeff(a_SpeedCoeff)
{
}
-
+
virtual bool OnItemUse(
@@ -51,7 +51,7 @@ public:
return true;
}
-
+
protected:
cProjectileEntity::eKind m_ProjectileKind;
double m_SpeedCoeff;
@@ -79,7 +79,7 @@ class cItemSnowballHandler :
public cItemThrowableHandler
{
typedef cItemThrowableHandler super;
-
+
public:
cItemSnowballHandler(void) :
super(E_ITEM_SNOWBALL, cProjectileEntity::pkSnowball, 30)
@@ -95,7 +95,7 @@ class cItemEnderPearlHandler :
public cItemThrowableHandler
{
typedef cItemThrowableHandler super;
-
+
public:
cItemEnderPearlHandler(void) :
super(E_ITEM_ENDER_PEARL, cProjectileEntity::pkEnderPearl, 30)