Skip to main content

yog_event/planes/things/block/
actions.rs

1//! Blocks: the host's actions.
2
3use yog_core::{BlockInfo, BlockPos, Stack};
4use yog_ids as ids;
5
6actions! {
7    /// A block entity's data as SNBT.
8    Nbt { dim: String, pos: BlockPos } -> Option<String> = ids::service_block::NBT, "actions.YogBlockActions.getBlockNbt";
9    /// Merges `snbt` into a block entity's data.
10    SetNbt { dim: String, pos: BlockPos, snbt: String } -> bool = ids::service_block::SET_NBT, "actions.YogBlockActions.setBlockNbt";
11    /// The block state at `pos` (`minecraft:oak_log[axis=y]`).
12    State { dim: String, pos: BlockPos } -> Option<String> = ids::service_block::STATE, "actions.YogBlockActions.getBlockState";
13    /// Sets the block state at `pos`.
14    SetState { dim: String, pos: BlockPos, state: String } -> bool = ids::service_block::SET_STATE, "actions.YogBlockActions.setBlockState";
15    /// The block's state.
16    Info { dim: String, pos: BlockPos } -> Option<BlockInfo> = ids::service_block::INFO, "actions.YogQueries.blockInfo";
17    /// Breaks the block (dropping it or not).
18    Destroy { dim: String, pos: BlockPos, drop: bool, breaker: String } -> bool = ids::service_block::DESTROY, "actions.YogBlockActions.breakBlock";
19    /// Applies bone meal to the block.
20    Bonemeal { dim: String, pos: BlockPos } -> bool = ids::service_block::BONEMEAL, "actions.YogBlockActions.bonemeal";
21    /// Uses `item` on a face of the block, as `player` would.
22    UseItem { dim: String, pos: BlockPos, face: u8, item: String, player: String } -> bool = ids::service_block::USE_ITEM, "actions.YogBlockActions.useItemOnBlock";
23    /// Empties a bucket at `pos`.
24    PourFluid { dim: String, pos: BlockPos, bucket: String } -> bool = ids::service_block::POUR_FLUID, "actions.YogBlockActions.pourFluid";
25    /// The redstone power reaching the block; `None` without the dimension.
26    RedstonePower { dim: String, pos: BlockPos } -> Option<u8> = ids::service_block::REDSTONE_POWER, "actions.YogQueries.redstonePower";
27    /// The strongest signal the block gives out; `None` if it gives none.
28    RedstoneSignal { dim: String, pos: BlockPos } -> Option<u8> = ids::service_block::REDSTONE_SIGNAL, "actions.YogQueries.redstoneSignal";
29    /// Sets a mod block's redstone output.
30    SetRedstoneOutput { dim: String, pos: BlockPos, level: i32 } -> bool = ids::service_block::SET_REDSTONE_OUTPUT, "actions.YogBlockActions.setRedstoneOutput";
31    /// A container's slot.
32    InventorySlot { dim: String, pos: BlockPos, slot: u32 } -> Option<Stack> = ids::service_block::INVENTORY_SLOT, "actions.YogQueries.getInventorySlot";
33    /// Sets a container's slot.
34    SetInventorySlot { dim: String, pos: BlockPos, slot: u32, item: String, count: u32, snbt: String } -> bool = ids::service_block::SET_INVENTORY_SLOT, "actions.YogBlockActions.setInventorySlot";
35}