onyx.util
- class onyx.util.Range(min=None, max=None)
Range - Represents a range between two values
- Parameters
min (int, optional) – The minimum value. Defaults to None.
max (int, optional) – The maximum value. Defaults to None.
- build()
build - Returns the built range
- Raises
ValueError – Neither
min
normax
are specified- Returns
The built range
- Return type
str
- class onyx.util.AbsPos(x=None, y=None, z=None)
AbsPos - Represents an absolute position
- Parameters
x (int, optional) – X coordinate. Defaults to None.
y (int, optional) – Y coordinate. Defaults to None.
z (int, optional) – Z coordinate. Defaults to None.
- class onyx.util.RelPos(x=None, y=None, z=None)
RelPos - Represents a relative position
- Parameters
x (int, optional) – X coordinate. Defaults to None.
y (int, optional) – Y coordinate. Defaults to None.
z (int, optional) – Z coordinate. Defaults to None.
- class onyx.util.LocPos(left=None, up=None, forward=None)
LocPos - Represents a local position
- Parameters
left (int, optional) – Direction to the left of the entities rotation. Defaults to None.
up (int, optional) – Direction above the entities rotation. Defaults to None.
forward (int, optional) – Direction toward the entities location. Defaults to None.
- class onyx.util.AbsPos2D(x=None, y=None)
AbsPos2D - Represents an absolute position in 2D
- Parameters
x (int, optional) – X coordinate. Defaults to None.
y (int, optional) – Y coordinate. Defaults to None.
- class onyx.util.RelPos2D(x=None, y=None)
RelPos2D - Represents a relative position in 2D
- Parameters
x (int, optional) – X coordinate. Defaults to None.
y (int, optional) – Y coordinate. Defaults to None.
- class onyx.util.AbsRot(x=None, y=None)
AbsRot - Represents an absolute rotation
- Parameters
x (int, optional) – X (vertical) coordinate. Defaults to None.
y (int, optional) – Y (horizontal) coordinate. Defaults to None.
- class onyx.util.RelRot(x=None, y=None)
RelRot - Represents a relative rotation
- Parameters
x (int, optional) – X (vertical) coordinate. Defaults to None.
y (int, optional) – Y (horizontal) coordinate. Defaults to None.
- class onyx.util.ClickEvent(action, value)
ClickEvent - Represents a click event for text components
- Parameters
action (click_event_action) – The action to perform
value (str) – The value to pass to the action (url, command, etc.)
- build()
build - Returns the built click event
- Returns
The built click event
- Return type
str
- class onyx.util.HoverEvent(action=None, text=None, item_id=None, item_tags=None)
HoverEvent - Represents a hover event for text components
- Parameters
action (hover_event_action) – The action to perform (
show_text
orshow_item
)text (str, optional) – The text to show. Only used if
action
isshow_text
. Defaults to None.item_id (item, optional) – The ID of the item to show. Only used if
action
isshow_item
. Defaults to None.item_tags (dict, optional) – The data value of the item to show. Only used if
action
isshow_item
. Defaults to None.
- build()
build - Returns the built hover event
- Returns
The built hover event
- Return type
str
- class onyx.util.Item(type, name=None, lore=None, tags=None)
Item - Defines an item with name, lore, and NBT tags
- Parameters
type (item) – The ID of the item
name (TextComponent, optional) – The item name. Defaults to None.
lore (list, optional) – The lore of the item. Each item of the list should be its own text component. Defaults to None.
tags (Compound, optional) – The tags of the item. You must use an
nbtlib.Compound
object. Defaults to None.
- build()
build - Returns the built item
- Returns
The built item
- Return type
str
- class onyx.util.ParticleNormal(particle_type, position, delta, speed, count, optional_particle_argument=None)
ParticleNormal - Represents a normal particle class
- Parameters
particle_type (particle) – The type of particle
position (Vector3) – The position of the particle
delta (tuple) – The spread of the particle
speed (float) – How fast the particle moves
count (int) – How many particles there are
optional_particle_argument (Union[tuple, block, item], optional) – Any optional particle arguments. Should only be used with particle types
dust
,block
,falling_dust
, oritem
. Ifdust
, should be a tuple of 4 items representing RGBS (red, green, blue, size). Ifblock
orfaling_dust
, should be a block ID. Ifitem
, should be an item ID. Defaults to None.
- Raises
ValueError – Raised if an invalid optional argument is used
- build()
build - Returns the built particle
- Returns
The built particle
- Return type
str
- class onyx.util.ParticleEntityEffectModified(particle_type, position, RGB, brightness=128)
ParticleEntityEffectModified - Represents a particle with a modified entity effect (delta and speed act like RGBE values with a count of
0
)- Parameters
- Raises
ValueError – Raised when particle type is not
entity_effect
orambient_entity_effect
- build()
build - Returns the built particle
- Returns
The built particle
- Return type
str
- class onyx.util.ParticleMotion(particle_type, position, motion, motion_multiplier, optional_particle_argument=None)
ParticleMotion - Represents a particle with motion
- Parameters
particle_type (particle) – The particle type
position (Vector3) – The position of the particle
motion (tuple) – The motion of the particle
motion_multiplier (Union[int, float]) – The motion multiplier of the particle
optional_particle_argument (Union[tuple, block, item], optional) – Any optional particle arguments. Should only be used with particle types
dust
,block
,falling_dust
, oritem
. Ifdust
, should be a tuple of 4 items representing RGBS (red, green, blue, size). Ifblock
orfaling_dust
, should be a block ID. Ifitem
, should be an item ID. Defaults to None.
- build()
build - Returns the built particle
- Returns
The built particle
- Return type
str
- class onyx.util.ParticleNoteModified(position, color_modifier, color_multiplier)
ParticleNoteModified - Represents a note particle with a custom color
- Parameters
position (Vector3) – The position of the particle
color_modifier (float) – The color modifier of the particle. Should be from 0 to 1.
color_multiplier (int) – The color multiplier of the particle.
- build()
build - Returns the built particle
- Returns
The built particle
- Return type
str
- class onyx.util.Block(type, block_states=None, nbt=None)
Block - Defines a block with block states and NBT
- Parameters
type (block) – The type of the block
block_states (dict, optional) – Block states. Should be given as a dictionary with keys being block state names and values being values. Defaults to None.
nbt (Compound, optional) – Any NBT on the block. Defaults to None.
- class onyx.util.AttributeModifier(name, value, mode, uuid_override=None)
AttributeModifier - Defines an attribute modifier
- Parameters
name (str) – The name of the attribute modifier
value (Union[int, float]) – The value of the attribute modifier
mode (attribute_modifier_mode) – How the attribute modifier will affect the modifier. Either
add
,multiply
, ormultiply_base
.uuid_override (str, optional) – Override for the automatically generated UUID. Defaults to None.
- build(just_uuid=False)
build - Returns the built attribute modifier
- Parameters
just_uuid (bool, optional) – Whether or not just the UUID of the attribute modifier should be returned. Defaults to False.
- Returns
The built attribute modifier
- Return type
str
- class onyx.util.DataSource(source_type, location, path=None)
DataSource - Defines an NBT data location
- Parameters
source_type (source_type) – The type of the location (
storage
,entity
, orblock
)path (Union[slot, str], optional) – The data path. Defaults to None.
- build()
build - Returns the built data source
- Returns
The built data source
- Return type
str
- class onyx.util.StoreTarget(location, path, data_type=None, scale=None)
StoreTarget - Defines a target for storing data
- Parameters
location (Union[Vector3, Selector, str, Bossbar) – The location where the data should be stored
path (Union[str, bossbar_location]) – The path where the data should be stored
data_type (data_type, optional) – The data type of the location. Defaults to None.
scale (Union[int, float], optional) – The scale to store the data at. Defaults to None.
- build()
build - Returns the built store target
- Returns
The built store target
- Return type
str