cEnchantments


Index:
Articles
Classes
Hooks

Quick navigation:
BannerPattern
BossBarColor
BossBarDivisionType
cArrowEntity
cBeaconEntity
cBedEntity
cBlockArea
cBlockEntity
cBlockEntityWithItems
cBlockInfo
cBoat
cBoundingBox
cBrewingstandEntity
cChatColor
cChestEntity
cChunkDesc
cClientHandle
cColor
cCommandBlockEntity
cCompositeChat
cCraftingGrid
cCraftingRecipe
cCryptoHash
cCuboid
cDispenserEntity
cDropperEntity
cDropSpenserEntity
cEnchantments
cEnderCrystal
cEntity
cEntityEffect
cExpBottleEntity
cExpOrb
cFallingBlock
cFile
cFireChargeEntity
cFireworkEntity
cFloater
cFlowerPotEntity
cFurnaceEntity
cGhastFireballEntity
cHangingEntity
cHopperEntity
cIniFile
cInventory
cItem
cItemFrame
cItemGrid
cItems
cJson
cJukeboxEntity
cLeashKnot
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
cStringCompression
cTCPLink
cTeam
cThrownEggEntity
cThrownEnderPearlEntity
cThrownSnowballEntity
cTNTEntity
cUDPEndpoint
cUrlClient
cUrlParser
CustomStatistic
cUUID
cWebAdmin
cWindow
cWitherSkullEntity
cWorld
EffectID
HTTPFormData
HTTPRequest
HTTPTemplateRequest
ItemCategory
lxp
SmokeDirection
sqlite3
StatisticsManager
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)
StringSpecstring
cEnchantments
Creates a new cEnchantments object filled with enchantments based on the string description
() (constructor)
cEnchantments
Creates a new empty cEnchantments object
operator ==
OtherEnchantmentscEnchantments
boolean
Returns true if this enchantments object has the same enchantments as OtherEnchantments.
Add
OthercEnchantments
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
StringSpecstring
Adds the enchantments in the string description into the object. If a specified enchantment already existed, it is overwritten.
CanAddEnchantment
EnchantmentNumIDnumber
boolean
Returns true if the specified enchantment is not mutually exclusive with any of the enchantments stored by the object.
Clear Removes all enchantments
Count
number
Get the count of enchantments contained within the class
GetLevel
EnchantmentNumIDnumber
number
Returns the level of the specified enchantment stored in this object; 0 if not stored
IsEmpty
boolean
Returns true if the object stores no enchantments
SetLevel
EnchantmentNumIDnumber
Levelnumber
Sets the level for the specified enchantment, adding it if not stored before, or removing it if Level < = 0
StringToEnchantmentID
EnchantmentNamestring
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 by APIDump on 2024-10-25 05:01:00, Build ID Unknown, Commit approx: 0325de7dacaf1e2feaea5eaab4791bc23d78f9e7