Skip to main content

yog_event/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, "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, "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, "YogBlockActions.getBlockState";
13    /// Sets the block state at `pos`.
14    SetState { dim: String, pos: BlockPos, state: String } -> bool = ids::service_block::SET_STATE, "YogBlockActions.setBlockState";
15    /// The block's state.
16    Info { dim: String, pos: BlockPos } -> Option<BlockInfo> = ids::service_block::INFO, "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, "YogBlockActions.breakBlock";
19    /// Applies bone meal to the block.
20    Bonemeal { dim: String, pos: BlockPos } -> bool = ids::service_block::BONEMEAL, "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, "YogBlockActions.useItemOnBlock";
23    /// Empties a bucket at `pos`.
24    PourFluid { dim: String, pos: BlockPos, bucket: String } -> bool = ids::service_block::POUR_FLUID, "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, "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, "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, "YogBlockActions.setRedstoneOutput";
31    /// A container's slot.
32    InventorySlot { dim: String, pos: BlockPos, slot: u32 } -> Option<Stack> = ids::service_block::INVENTORY_SLOT, "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, "YogBlockActions.setInventorySlot";
35}