GenericPlaceableItem

Undocumented in source.

Members

Functions

place
block_t place(World world, BlockPosition position, uint face)
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

block
block_t block [@property getter]
Undocumented in source.
placeable
bool placeable [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From Item

m_pc_tag
Compound m_pc_tag;
Undocumented in source.
m_pe_tag
Compound m_pe_tag;
Undocumented in source.
parseJSON
void parseJSON(std.json.JSONValue data)
Undocumented in source. Be warned that the author may not have intended to support it.
data
sul.items.Item data [@property getter]

Gets the item's data.

java
bool java [@property getter]
javaId
ushort javaId [@property getter]
javaMeta
ushort javaMeta [@property getter]

Indicates wether the item exists in Minecraft.

bedrock
bool bedrock [@property getter]

Indicates whether the item exists in Minecraft.

bedrockId
ushort bedrockId [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
bedrockMeta
ushort bedrockMeta [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
name
string name [@property getter]

Gets the name (not the custom name!) of the item.

max
ubyte max [@property getter]

Indicates the highest number of items that can be stacked in a slot. This number is the default slot's count if not specified when created.

tool
bool tool [@property getter]

Indicates whether the item is a tool. A tool can be used on blocks and entities and its meta will vary.

toolType
ubyte toolType [@property getter]

Gets the item's tool type.

toolMaterial
ubyte toolMaterial [@property getter]

Gets the tool's material if the item is a tool. Items with ID 0 have unspecified material, 1 is the minimum (wood) and 5 is the maximum (diamond).

finished
bool finished [@property getter]

If the item is a tool, checks whether its damage is higher than its durability.

attack
uint attack [@property getter]

Indicates the damage caused by the item when used as a weapon. The value indicates the base damage without the influence of enchantments or effects.

consumeable
bool consumeable [@property getter]

Indicates whether or not an item can be eaten/drunk. If true, Item::onConsumed(Human consumer) will be called when this item is eaten/drunk.

alwaysConsumeable
bool alwaysConsumeable [@property getter]

Indicates whether the item can be consumed when the holder's hunger is full.

onConsumed
Item onConsumed(Player player)

If consumeable is true, this function is called. when the item is eaten/drunk by its holder, who's passed as the first arguments. Return: null: the item count will be reduced by 1 item: the item will substitutes the consumed item

placeable
bool placeable [@property getter]

Indicates whether or not the item can be placed. If this function returns true, Item::place(World world) will be probably called next for place a block

onPlaced
bool onPlaced(Player player, BlockPosition tpos, uint tface)

Function called when the item is ready to be placed by a player (the event for the player has already been called).

place
ushort place(World world, BlockPosition position, uint face)

If Item::placeable returns true, this function should return an instance of the block that will be placed.

useOnBlock
bool useOnBlock(Player player, Block block, BlockPosition position, ubyte face)

Function called when the item is used on a block clicking the right mouse button or performing a long pressure on the screen.

destroyOn
bool destroyOn(Player player, Block block, BlockPosition position)

Function called when the item is used to the destroy a block.

useOnEntity
bool useOnEntity(Player player, Entity entity)

Function called when the item is used on an entity as right click or long screen pressure.

attackOnEntity
bool attackOnEntity(Player player, Entity entity)

Function called when the item is used against an entity as a left click or screen tap.

onThrowed
bool onThrowed(Player player)

Function called when the item is throwed or aimed.

onReleased
bool onReleased(Player holder)

Function called when the item is released, usually after it has been throwed (which is used as aim-start function).

javaCompound
Compound javaCompound [@property getter]
pocketCompound
Compound pocketCompound [@property getter]

Gets the item's compound tag with the custom data of the item. It may be null if the item has no custom behaviours.

parseJavaCompound
void parseJavaCompound(Compound compound)
parseBedrockCompound
void parseBedrockCompound(Compound compound)

Parses a compound, usually received from the client or saved in a world. The tag should never be null as the method doesn't check it.

clear
void clear()

Removes the custom behaviours of the item, like custom name and enchantments.

customName
string customName [@property getter]

Gets the item's custom name.

customName
string customName [@property setter]

Sets the item's custom name.

lore
string lore [@property getter]

Gets the item's lore or description which is displayed under the item's name when the item is hovered in the player's inventory.

lore
string[] lore [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
lore
string lore [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
addEnchantment
void addEnchantment(Enchantment ench)
void addEnchantment(sel.data.enchantment.Enchantment ench, ubyte level)
void addEnchantment(sel.data.enchantment.Enchantment ench, string level)
opBinaryRight
void opBinaryRight(Enchantment ench)

Adds an enchantment to the item.

opBinaryRight
Enchantment* opBinaryRight(sel.data.enchantment.Enchantment ench)

Gets a pointer to the enchantment. This method can be used to check if the item has an enchantment and its level.

removeEnchantment
void removeEnchantment(sel.data.enchantment.Enchantment ench)
opBinaryRight
void opBinaryRight(sul.enchantments.Enchantment ench)

Removes an enchantment from the item.

unbreakable
bool unbreakable [@property getter]

If the item is a tool, indicates whether the item is consumed when used for breaking or combat.

unbreakable
bool unbreakable [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Object o)

Deep comparation of 2 instantiated items. Compare ids, metas, custom names and enchantments.

opEquals
bool opEquals(item_t item)
bool opEquals(item_t[] items)

Compare an item with its type as a string or a group of strings.

toString
string toString()

Returns the item as string in format "name" or "name:damage" for tools.

slot
Slot slot [@property getter]

Create a slot with the Item::max as count

Meta