Module itemutil

Provides various utility functions for working with items.

Functions

blop (position_or_object, itemstrings_or_stacks, x_strength, y_strength, z_strength, split_mode) "Blops" the item into existence at the given position and assigns it a random velocity/acceleration.
get_itemstring (item) Gets the item string from the given item.
split (itemstring_or_itemstack, split_mode) Splits the given item stack according to the provided method.
split_random (itemstring_or_itemstack) Splits the given item stack randomly.
split_single (itemstring_or_itemstack) Splits the given item stack into single items.

Fields

SPLIT_MODE_RANDOM The split mode for randomly splitting the stack.
SPLIT_MODE_SINGLE The split mode for splitting the stack into single items.
SPLIT_MODE_STACK The split mode for preserving the complete stack.


Functions

blop (position_or_object, itemstrings_or_stacks, x_strength, y_strength, z_strength, split_mode)
"Blops" the item into existence at the given position and assigns it a random velocity/acceleration.

Parameters:

  • position_or_object The position, a pos value or an ObjectRef.
  • itemstrings_or_stacks The item string or an ItemStack.
  • x_strength Optional. The strength of the random movement in the x direction, defaults to 5.
  • y_strength Optional. The strength o the random movement in the y direction, defaults to 5, minimum is 1.
  • z_strength Optional. The strength of the random movement in the z direction, defaults to 5.
  • split_mode Optional. The mode for splitting the items, defaults to SPLIT_MODE_STACK.

Returns:

    The spawned items in a List.
get_itemstring (item)
Gets the item string from the given item.

Parameters:

  • item The item for which to get the item string.

Returns:

    The item string, or nil.
split (itemstring_or_itemstack, split_mode)
Splits the given item stack according to the provided method.

Parameters:

  • itemstring_or_itemstack The item string or ItemStack to split.
  • split_mode The split mode.

Returns:

    A List of item strings, an empty List it could not be split.
split_random (itemstring_or_itemstack)
Splits the given item stack randomly.

Parameters:

  • itemstring_or_itemstack The item string or ItemStack to split randomly.

Returns:

    The List of item strings.
split_single (itemstring_or_itemstack)
Splits the given item stack into single items.

Parameters:

  • itemstring_or_itemstack The item string or ItemStack to split into single items.

Returns:

    The List of item strings.

Fields

SPLIT_MODE_RANDOM
The split mode for randomly splitting the stack.
SPLIT_MODE_SINGLE
The split mode for splitting the stack into single items.
SPLIT_MODE_STACK
The split mode for preserving the complete stack.
generated by LDoc 1.4.2