Item stacks (function list)
Status: Implemented (API 1.24). Generated from
client/clight/idl/clight_api.jsonbytools/docs/gen_api_reference.py; do not edit by hand. 12 functions, the newest from API 1.6.
Explanations and examples: Items and item stacks. Every function of the stack module is listed here in table order.
The details of each function follow the table, in the same order. Side: where the function works (server, client, both). Context: the thread it may be called on (Conventions). Since: the API version that added it.
| C function | Lua | Side | Context | Since |
|---|---|---|---|---|
cl_stack_create |
cl.stack.create |
both | ANY | 1.0 |
cl_stack_create_by_name |
cl.stack.create_by_name |
both | ANY | 1.0 |
cl_stack_retain |
cl.stack.retain |
both | ANY | 1.0 |
cl_stack_release |
cl.stack.release |
both | ANY | 1.0 |
cl_stack_item |
cl.stack.item |
both | ANY | 1.0 |
cl_stack_count |
cl.stack.count |
both | ANY | 1.0 |
cl_stack_set_count |
cl.stack.set_count |
both | ANY | 1.0 |
cl_stack_is_empty |
cl.stack.is_empty |
both | ANY | 1.0 |
cl_stack_is |
cl.stack.is |
both | ANY | 1.0 |
cl_stack_set_name |
cl.stack.set_name |
both | ANY | 1.6 |
cl_stack_add_lore |
cl.stack.add_lore |
both | ANY | 1.6 |
cl_stack_clear_text |
cl.stack.clear_text |
both | ANY | 1.6 |
cl_stack_create
cl_item_stack cl_stack_create(cl_item_id item, int32_t count);
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.stack.create - C++:
clight::stack::create(cl_item_id item, int32_t count)→ItemStack - The returned handle is owned: release it ©, or let the RAII class do it (C++). Lua releases it when it is collected (or at once with
local s <close> = ...).
cl_stack_create_by_name
cl_item_stack cl_stack_create_by_name(cl_str id, int32_t count);
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.stack.create_by_name - C++:
clight::stack::create_by_name(std::string_view id, int32_t count)→ItemStack - The returned handle is owned: release it ©, or let the RAII class do it (C++). Lua releases it when it is collected (or at once with
local s <close> = ...).
cl_stack_retain
void cl_stack_retain(cl_item_stack s);
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.stack.retain,item_stack:retain(...) - C++:
ItemStack::retain()→void;clight::stack::retain(cl_item_stack s)→void
cl_stack_release
void cl_stack_release(cl_item_stack s);
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.stack.release,item_stack:release(...) - C++:
ItemStack::release()→void;clight::stack::release(cl_item_stack s)→void
cl_stack_item
cl_item_id cl_stack_item(cl_item_stack s);
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.stack.item,item_stack:item(...) - C++:
ItemStack::item()→cl_item_id;clight::stack::item(cl_item_stack s)→cl_item_id
cl_stack_count
int32_t cl_stack_count(cl_item_stack s);
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.stack.count,item_stack:count(...) - C++:
ItemStack::count()→int32_t;clight::stack::count(cl_item_stack s)→int32_t
cl_stack_set_count
cl_result cl_stack_set_count(cl_item_stack s, int32_t count);
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.stack.set_count,item_stack:set_count(...) - C++:
ItemStack::set_count(int32_t count)→Expected<void>;clight::stack::set_count(cl_item_stack s, int32_t count)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_stack_is_empty
bool cl_stack_is_empty(cl_item_stack s);
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.stack.is_empty,item_stack:is_empty(...) - C++:
ItemStack::is_empty()→bool;clight::stack::is_empty(cl_item_stack s)→bool
cl_stack_is
bool cl_stack_is(cl_item_stack s, cl_str item);
- Side: both. Context: ANY (any thread). Since: API 1.0.
- Lua:
cl.stack.is,item_stack:is(...) - C++:
ItemStack::is(std::string_view item)→bool;clight::stack::is(cl_item_stack s, std::string_view item)→bool
cl_stack_set_name
cl_result cl_stack_set_name(cl_item_stack s, cl_text name);
The stack’s custom name (minecraft:custom_name). Upright unless the text sets italic itself (vanilla draws custom names in italics; mods nearly always want them upright).
- Side: both. Context: ANY (any thread). Since: API 1.6.
- Lua:
cl.stack.set_name,item_stack:set_name(...) - C++:
ItemStack::set_name(cl_text name)→Expected<void>;clight::stack::set_name(cl_item_stack s, cl_text name)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_stack_add_lore
cl_result cl_stack_add_lore(cl_item_stack s, cl_text line);
Adds a line to the stack’s lore (minecraft:lore, at most 256 lines; upright unless the text sets italic).
- Side: both. Context: ANY (any thread). Since: API 1.6.
- Lua:
cl.stack.add_lore,item_stack:add_lore(...) - C++:
ItemStack::add_lore(cl_text line)→Expected<void>;clight::stack::add_lore(cl_item_stack s, cl_text line)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_stack_clear_text
cl_result cl_stack_clear_text(cl_item_stack s);
Removes the custom name and all lore lines set through the API.
- Side: both. Context: ANY (any thread). Since: API 1.6.
- Lua:
cl.stack.clear_text,item_stack:clear_text(...) - C++:
ItemStack::clear_text()→Expected<void>;clight::stack::clear_text(cl_item_stack s)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.