Class endstone::ItemFrame¶
ClassList > endstone > ItemFrame
Represents a captured state of an item frame.
#include <endstone/block/item_frame.h>
Inherits the following classes: endstone::BlockState
Public Functions¶
| Type | Name |
|---|---|
| virtual std::optional< ItemStack > | getItem () const = 0 Gets the item in this frame. |
| virtual float | getItemDropChance () const = 0 Gets the chance of the item being dropped upon this frame's destruction. |
| virtual Rotation | getRotation () const = 0 Gets the rotation of the frame's item. |
| virtual void | setItem (const std::optional< ItemStack > & item) = 0 Sets the item in this frame. |
| virtual void | setItemDropChance (float chance) = 0 Sets the chance of the item being dropped upon this frame's destruction. |
| virtual void | setRotation (Rotation rotation) = 0 Sets the rotation of the frame's item. |
Public Functions inherited from endstone::BlockState¶
| Type | Name |
|---|---|
| virtual std::unique_ptr< Block > | getBlock () const = 0 Gets the block represented by this block state. |
| virtual std::unique_ptr< BlockData > | getData () const = 0 Gets the data for this block state. |
| virtual NotNull< Dimension > | getDimension () const = 0 Gets the dimension which contains the block represented by this block state. |
| virtual Location | getLocation () const = 0 Gets the location of this block state. |
| virtual const BlockType & | getType () const = 0 Gets the type of this block state. |
| virtual int | getX () const = 0 Gets the x-coordinate of this block state. |
| virtual int | getY () const = 0 Gets the y-coordinate of this block state. |
| virtual int | getZ () const = 0 Gets the z-coordinate of this block state. |
| virtual void | setData (const BlockData & data) = 0 Sets the data for this block state. |
| virtual void | setType (BlockTypeId type) = 0 Sets the type of this block state. |
| virtual bool | update () = 0 Attempts to update the block represented by this state, setting it to yhe new values as defined by this state. |
| virtual bool | update (bool force) = 0 Attempts to update the block represented by this state, setting it to the new values as defined by this state. |
| virtual bool | update (bool force, bool apply_physics) = 0 Attempts to update the block represented by this state, setting it to the new values as defined by this state. |
| ~BlockState () override |
Public Functions inherited from endstone::Object¶
See endstone::Object
| Type | Name |
|---|---|
| T * | as () Attempts to cast this object to the given type T. |
| const T * | as () const Attempts to cast this object to the given type T. |
| virtual const std::type_info & | getClassTypeId () const = 0 |
| bool | is () const Checks if this object is an instance of the given type T (or a subclass of T). |
| virtual bool | isInstanceOf (const std::type_info & target) const = 0 |
| virtual | ~Object () = default |
Public Functions Documentation¶
function getItem¶
Gets the item in this frame.
Returns:
a defensive copy of the item in this item frame, or std::nullopt if the frame is empty
function getItemDropChance¶
Gets the chance of the item being dropped upon this frame's destruction.
- A drop chance of 0.0F will never drop
- A drop chance of 1.0F will always drop
Returns:
chance of the item being dropped
function getRotation¶
Gets the rotation of the frame's item.
Returns:
the rotation
function setItem¶
Sets the item in this frame.
This resets the rotation of the frame, as placing an item in a frame does in-game.
Parameters:
itemthe new item, orstd::nulloptto empty the frame
function setItemDropChance¶
Sets the chance of the item being dropped upon this frame's destruction.
- A drop chance of 0.0F will never drop
- A drop chance of 1.0F will always drop
Parameters:
chancethe chance of the item being dropped
function setRotation¶
Sets the rotation of the frame's item.
Parameters:
rotationthe new rotation
The documentation for this class was generated from the following file include/endstone/block/item_frame.h