cEnchantments


Index:
Articles
Classes
Hooks

Quick navigation:
cArrowEntity
cBeaconEntity
cBlockArea
cBlockEntity
cBlockEntityWithItems
cBlockInfo
cBoundingBox
cBrewingstandEntity
cChatColor
cChestEntity
cChunkDesc
cClientHandle
cCommandBlockEntity
cCompositeChat
cCraftingGrid
cCraftingRecipe
cCryptoHash
cCuboid
cDispenserEntity
cDropperEntity
cDropSpenserEntity
cEnchantments
cEntity
cEntityEffect
cExpBottleEntity
cFile
cFireChargeEntity
cFireworkEntity
cFloater
cFlowerPotEntity
cFurnaceEntity
cGhastFireballEntity
cHangingEntity
cHopperEntity
cIniFile
cInventory
cItem
cItemFrame
cItemGrid
cItems
cJson
cJukeboxEntity
cLineBlockTracer
cLuaWindow
cMap
cMapManager
cMobHeadEntity
cMobSpawnerEntity
cMojangAPI
cMonster
cNetwork
cNoteEntity
cObjective
cPainting
cPawn
cPickup
cPlayer
cPlugin
cPluginLua
cPluginManager
cProjectileEntity
cRankManager
cRoot
cScoreboard
cServer
cServerHandle
cSignEntity
cSplashPotionEntity
cStatManager
cStringCompression
cTCPLink
cTeam
cThrownEggEntity
cThrownEnderPearlEntity
cThrownSnowballEntity
cTNTEntity
cTracer
cUDPEndpoint
cUrlClient
cUrlParser
cWebAdmin
cWindow
cWitherSkullEntity
cWorld
HTTPFormData
HTTPRequest
HTTPTemplateRequest
ItemCategory
lxp
sqlite3
TakeDamageInfo
tolua
Vector3d
Vector3f
Vector3i
Globals

Contents


cEnchantments class

This class is the storage for enchantments for a single cItem object, through its m_Enchantments member variable. Although it is possible to create a standalone object of this class, it is not yet used in any API directly.

Enchantments can be initialized either programmatically by calling the individual functions (SetLevel()), or by using a string description of the enchantment combination. This string description is in the form "id=lvl;id=lvl;...;id=lvl;", where id is either a numerical ID of the enchantment, or its textual representation from the table below, and lvl is the desired enchantment level. The class can also create its string description from its current contents; however that string description will only have the numerical IDs.

See the cItem class for usage examples.


Constants

NameValueNotes
enchAquaAffinity 6
enchBaneOfArthropods 18
enchBlastProtection 3
enchDepthStrider 8
enchEfficiency 32
enchFeatherFalling 2
enchFireAspect 20
enchFireProtection 1
enchFlame 50
enchFortune 35
enchInfinity 51
enchKnockback 19
enchLooting 21
enchLuckOfTheSea 61
enchLure 62
enchPower 48
enchProjectileProtection 4
enchProtection 0
enchPunch 49
enchRespiration 5
enchSharpness 16
enchSilkTouch 33
enchSmite 17
enchThorns 7
enchUnbreaking 34

Functions

NameParametersReturn valueNotes
() (constructor) cEnchantments Creates a new empty cEnchantments object
() (constructor) StringSpec cEnchantments Creates a new cEnchantments object filled with enchantments based on the string description
operator == OtherEnchantments bool Returns true if this enchantments object has the same enchantments as OtherEnchantments.
Add Other Adds the enchantments contained in Other into this object. Existing enchantments are preserved, unless Other specifies a different level, in which case the level is changed to the Other's one.
AddFromString StringSpec Adds the enchantments in the string description into the object. If a specified enchantment already existed, it is overwritten.
Clear Removes all enchantments
Count number Get the count of enchantments contained within the class
GetLevel EnchantmentNumID number Returns the level of the specified enchantment stored in this object; 0 if not stored
IsEmpty bool Returns true if the object stores no enchantments
SetLevel EnchantmentNumID, Level Sets the level for the specified enchantment, adding it if not stored before, or removing it if Level < = 0
StringToEnchantmentID EnchantmentTextID number (STATIC) Returns the enchantment numerical ID, -1 if not understood. Case insensitive. Also understands plain numbers.
ToString string Returns the string description of all the enchantments stored in this object, in numerical-ID form
Generated on 2016-08-22 23:53:06, Build ID Unknown, Commit approx: 2ed4af74edd14ae17e1c6c64d44caa7b7fc30d5a