Skip to content

Class endstone::EnchantmentOffer

ClassList > endstone > EnchantmentOffer

Represents an offer made by an enchanting table. More...

  • #include <endstone/enchantments/enchantment_offer.h>

Public Types

Type Name
typedef std::unordered_map< const Enchantment *, int > Enchantments

Public Functions

Type Name
EnchantmentOffer (Enchantments enchants, int cost)
Creates an enchanting offer.
int getCost () const
Gets the minimum player level required to select this offer.
const Enchantments & getEnchants () const
Gets the enchantments applied by this offer.
void setCost (int cost)
Sets the minimum player level required to select this offer.
void setEnchants (Enchantments enchants)
Sets the enchantments applied by this offer.

Detailed Description

Bedrock stores every enchantment that selecting an offer applies rather than a single hinted enchantment. Enchantments in an offer must be entries obtained from Endstone's Enchantment registry.

Public Types Documentation

typedef Enchantments

using endstone::EnchantmentOffer::Enchantments =  std::unordered_map<const Enchantment *, int>;

Public Functions Documentation

function EnchantmentOffer

Creates an enchanting offer.

inline endstone::EnchantmentOffer::EnchantmentOffer (
    Enchantments enchants,
    int cost
) 

Parameters:

  • enchants the enchantments and levels applied by the offer
  • cost the minimum player level required to select the offer, between 1 and 255

function getCost

Gets the minimum player level required to select this offer.

inline int endstone::EnchantmentOffer::getCost () const

Returns:

the minimum required player level


function getEnchants

Gets the enchantments applied by this offer.

inline const Enchantments & endstone::EnchantmentOffer::getEnchants () const

Returns:

the enchantments and their levels


function setCost

Sets the minimum player level required to select this offer.

inline void endstone::EnchantmentOffer::setCost (
    int cost
) 

Parameters:

  • cost the minimum required player level, between 1 and 255

function setEnchants

Sets the enchantments applied by this offer.

inline void endstone::EnchantmentOffer::setEnchants (
    Enchantments enchants
) 

Parameters:

  • enchants the enchantments and their levels


The documentation for this class was generated from the following file include/endstone/enchantments/enchantment_offer.h