|
Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Go to the documentation of this file.
46 short a_ItemDamage = 0,
47 const AString & a_Enchantments =
"",
48 const AString & a_CustomName =
"",
54 #ifdef TOLUA_EXPOSITION
130 void GetJson(Json::Value & a_OutValue)
const;
133 void FromJson(
const Json::Value & a_Value);
138 static bool IsEnchantable(
short a_ItemType,
bool a_FromBook =
false);
152 int AddEnchantment(
int a_EnchantmentID,
unsigned int a_Level,
bool a_FromBook);
214 :
public std::vector<cItem>
232 void Set (
int a_Idx,
const cItem & a_Item);
233 void Add (
const cItem & a_Item) {push_back(a_Item); }
234 void Add (
short a_ItemType) { emplace_back(a_ItemType); }
235 void Add (
short a_ItemType,
char a_ItemCount) { emplace_back(a_ItemType, a_ItemCount); }
238 size_t Size (
void)
const {
return size(); }
239 void Set (
int a_Idx,
short a_ItemType,
char a_ItemCount,
short a_ItemDamage);
243 void Add (
short a_ItemType,
char a_ItemCount,
short a_ItemDamage)
245 emplace_back(a_ItemType, a_ItemCount, a_ItemDamage);
cFireworkItem m_FireworkItem
bool IsSameType(const cItem &a_Item) const
static bool IsEnchantable(short a_ItemType, bool a_FromBook=false)
Returns true if the specified item type is enchantable.
void Add(const cItem &a_Item)
void FromJson(const Json::Value &a_Value)
Loads the item data from JSON representation.
void Clear(void)
Empties the item and frees up any dynamic storage used by the internals.
bool IsEqual(const cItem &a_Item) const
cItem & AddCount(char a_AmountToAdd)
Adds the specified count to this object and returns the reference to self (useful for chaining)
bool IsDamageable(void) const
cItem CopyOne(void) const
Returns a copy of this item with m_ItemCount set to 1.
cItems(void)
Need a Lua-accessible constructor.
cEnchantments m_Enchantments
int AddEnchantment(int a_EnchantmentID, unsigned int a_Level, bool a_FromBook)
Adds this specific enchantment to this item, returning the cost.
Compares two items for the same type or category.
cItems & operator=(const cItems &)=default
bool IsLoreEmpty(void) const
unsigned GetEnchantability()
Returns the enchantability of the item.
bool IsEqualTo(const cFireworkItem &a_Item) const
Used to store loot probability tables.
const cItemHandler & GetHandler(void) const
Returns the cItemHandler responsible for this item type.
void Set(int a_Idx, const cItem &a_Item)
bool IsCustomNameEmpty(void) const
short GetMaxDamage(void) const
Returns the maximum damage value that this item can have; zero if damage is not applied.
void AddItemGrid(const cItemGrid &a_ItemGrid)
Adds a copy of all items in a_ItemGrid.
void Empty(void)
Empties the item and frees up any dynamic storage used by the internals.
This class bridges a vector of cItem for safe access via Lua.
bool IsEmpty(void) const
Returns true if the item represents an empty stack - either the type is invalid, or count is zero.
int AddEnchantmentsFromItem(const cItem &a_Other)
Adds the enchantments on a_Other to this item, returning the XP cost of the transfer.
bool CanHaveEnchantment(int a_EnchantmentID)
Returns whether or not this item is allowed to have the given enchantment.
bool DamageItem(short a_Amount=1)
Damages a weapon / tool.
bool IsFullStack(void) const
Returns true if the item is stacked up to its maximum stacking.
void Add(short a_ItemType, char a_ItemCount)
Class that stores item enchantments or stored-enchantments The enchantments may be serialized to a st...
char GetMaxStackSize(void) const
Returns the maximum amount of stacked items of this type.
cItem(void)
Creates an empty item.
bool Contains(const cItem &a_Item)
void Add(short a_ItemType)
bool IsBothNameAndLoreEmpty(void) const
void GetJson(Json::Value &a_OutValue) const
Saves the item data into JSON representation.
AStringVector m_LoreTable
bool EnchantByXPLevels(unsigned a_NumXPLevels, MTRand &a_Random)
Randomly enchants the item using the specified number of XP levels.
Class to wrap any random engine to provide a more convenient interface.
bool ContainsType(const cItem &a_Item)
bool operator()(const cItem &a_Lhs, const cItem &a_Rhs) const
void Add(short a_ItemType, char a_ItemCount, short a_ItemDamage)
std::vector< AString > AStringVector