QtCraft API C++ classes QML types Handbook

QcItemDrop Struct

An item that a block (or other content) drops, with count, chance and conditions. More...

Header: #include <common/content/blocks/QcBlockDefinition.h>

Public Functions

int mostCount() const

Public Variables

double chance
int count
QString item
int maxCount
QList<QcShapeCondition> when
QcBlockId
enum class QcBlockSoundAction { Break, Place, Step, Hit }
enum class QcBlockSupport { None, Below, Attached }
enum class QcFacingRule { Away, Toward, Into, Against }
enum class QcRailAction { None, Boost, Activate }
enum class QcRenderLayer { Invisible, Opaque, Cutout, Translucent }
const QcBlockId qcAirBlockId
const int qcBlockSoundActionCount

Detailed Description

Member Function Documentation

int QcItemDrop::mostCount() const

Returns the most items this drop gives.

Member Variable Documentation

double QcItemDrop::chance

Probability in [0, 1] that this drop appears at all.

int QcItemDrop::count

Number of items dropped ("count", 1 to 64 for blocks).

QString QcItemDrop::item

Qualified name of the dropped item ("item").

int QcItemDrop::maxCount

More than count items, chosen evenly between count and this (lapis lazuli drops 4 to 9, a squid 1 to 3 ink sacs); 0 for exactly count. A later fortune enchantment raises it.

QList<QcShapeCondition> QcItemDrop::when

Block drops only: states that drop it (every condition holds); empty for all states. Server side only (crops drop their harvest only when ripe, decision E-289).

Related Non-Members

[alias] QcBlockId

Runtime block id: index into the registry, assigned at registration. Never persisted; persistent data refers to blocks by name.

enum class QcBlockSoundAction

What happens to a block when it makes a sound.

ConstantValueDescription
QcItemDrop::QcBlockSoundAction::Break0The block is broken.
QcItemDrop::QcBlockSoundAction::Place1The block is placed.
QcItemDrop::QcBlockSoundAction::Step2A body walks on the block.
QcItemDrop::QcBlockSoundAction::Hit3Each strike while mining.

enum class QcBlockSupport

What a block needs next to it to stay in place; without it, it breaks and drops.

ConstantValueDescription
QcItemDrop::QcBlockSupport::None0Needs nothing next to it.
QcItemDrop::QcBlockSupport::Below1A full solid top face below (plants, floor torches).
QcItemDrop::QcBlockSupport::Attached2A full solid face on the side its attach property names (torches, ladders).

enum class QcFacingRule

How a placed block's facing follows the player's horizontal view direction.

ConstantValueDescription
QcItemDrop::QcFacingRule::Away0Facing where the player looks (stairs climb away, doors open away).
QcItemDrop::QcFacingRule::Toward1Facing back at the player (furnace and chest fronts).
QcItemDrop::QcFacingRule::Into2Facing into the clicked block (a hopper's spout); placed on top, down (decision E-342).
QcItemDrop::QcFacingRule::Against3Towards the clicked block on a side face, where the player looks on the top or bottom (a vertical slab lying against the clicked block, decision E-755).

enum class QcRailAction

What a rail does to the minecarts on it (decision E-384): a powered rail speeds them up while it is powered and brakes them while it is not; an activator rail acts on them while it is powered (the rider gets out, a hopper cart stops pulling) and lets a hopper cart pull again while it is not.

ConstantValueDescription
QcItemDrop::QcRailAction::None0A plain rail (\c {"railAction"} none or missing).
QcItemDrop::QcRailAction::Boost1A powered rail (\c {"railAction": "boost"}).
QcItemDrop::QcRailAction::Activate2An activator rail (\c {"railAction": "activate"}).

enum class QcRenderLayer

Render pass of a block ("render": opaque, cutout, translucent or invisible).

Cross-shaped blocks default to cutout, all others to opaque.

ConstantValueDescription
QcItemDrop::QcRenderLayer::Invisible0Not drawn at all (air).
QcItemDrop::QcRenderLayer::Opaque1Drawn in the opaque pass without transparency.
QcItemDrop::QcRenderLayer::Cutout2Alpha-tested (e.g. leaves): drawn in the opaque pass, does not hide neighbour faces.
QcItemDrop::QcRenderLayer::Translucent3Alpha-blended (e.g. water, glass).

const QcBlockId qcAirBlockId

Id of air, the one block the registry defines itself and the empty value of chunk storage.

const int qcBlockSoundActionCount

Number of values of QcBlockSoundAction.