Skip to main content

TripWireBlock

Struct TripWireBlock 

Source
pub struct TripWireBlock {
    block: BlockRef,
    hook: BlockRef,
}
Expand description

Vanilla TripWireBlock behavior.

Fields§

§block: BlockRef§hook: BlockRef

Implementations§

Source§

impl TripWireBlock

Source

pub const fn new(block: BlockRef, hook: BlockRef) -> Self

Creates tripwire behavior.

Source

fn should_connect_to(&self, state: BlockStateId, direction: Direction) -> bool

Source

fn set_connection( state: BlockStateId, direction: Direction, connected: bool, ) -> BlockStateId

Source

fn update_source(&self, world: &Arc<World>, pos: BlockPos, state: BlockStateId)

Source

fn check_pressed_for_entity( &self, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, )

Source

fn check_pressed(&self, world: &Arc<World>, pos: BlockPos)

Source

fn set_pressed( &self, world: &Arc<World>, pos: BlockPos, should_be_pressed: bool, )

Trait Implementations§

Source§

impl BlockBehavior for TripWireBlock

Source§

fn get_state_for_placement( &self, context: &BlockPlaceContext<'_>, ) -> Option<BlockStateId>

Returns the block state to use when placing this block.
Source§

fn update_shape( &self, state: BlockStateId, _world: &dyn ScheduledTickAccess, _pos: BlockPos, direction: Direction, _neighbor_pos: BlockPos, neighbor_state: BlockStateId, ) -> BlockStateId

Called when a neighboring block changes shape. Returns the new state for this block after considering the neighbor change. Implementations also own any block or fluid ticks that Vanilla schedules from updateShape; the world dispatcher does not infer them from the result.
Source§

fn on_place( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, old_state: BlockStateId, _moved_by_piston: bool, )

Called when this block is placed in the world. Read more
Source§

fn affect_neighbors_after_removal( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, moved_by_piston: bool, )

Called after this block is removed from the world, to affect neighbors. Read more
Source§

fn player_will_destroy( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, player: &Player, ) -> BlockStateId

Called before a player removes this block. Read more
Source§

fn get_entity_inside_collision_shape( &self, state: BlockStateId, _world: &dyn LevelReader, _pos: BlockPos, _entity: &dyn Entity, ) -> VoxelShape

Returns this block state’s shape used by vanilla entity-inside effects.
Source§

fn entity_inside( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, _effect_collector: &mut InsideBlockEffectCollector, _is_precise: bool, )

Called when an entity is inside this block’s collision area. Read more
Source§

fn tick(&self, _state: BlockStateId, world: &Arc<World>, pos: BlockPos)

Called when a scheduled tick fires for this block. Read more
Source§

fn type_name(&self) -> &'static str

Returns the Rust type name of the concrete behavior implementation.
Source§

fn pickup_block( &self, world: &Arc<World>, pos: BlockPos, state: BlockStateId, player: Option<&Player>, ) -> Option<PickupResult>

Called when a player uses an empty bucket on this block. Read more
Source§

fn update_indirect_neighbour_shapes( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, flags: UpdateFlags, update_limit: i32, )

Queues indirect neighbor-shape updates after this state changes. Read more
Source§

fn can_survive( &self, _state: BlockStateId, _world: &dyn LevelReader, _pos: BlockPos, ) -> bool

Returns whether this block can survive at the given position. Read more
Source§

fn can_be_replaced( &self, state: BlockStateId, context: &BlockPlaceContext<'_>, ) -> bool

Returns whether this block can be replaced by the held item during placement. Read more
Source§

fn set_placed_by( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, source: &PlacementSource<'_>, )

Called by block items after this block has been placed by an entity. Read more
Source§

fn attack( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, player: &Player, )

Called when a player starts attacking this block. Read more
Source§

fn player_destroy( &self, world: &Arc<World>, player: &Player, pos: BlockPos, state: BlockStateId, block_entity: Option<&SharedBlockEntity>, tool: &ItemStack, )

Called after a player destroys this block and drops/effects are processed. Read more
Source§

fn destroy(&self, state: BlockStateId, world: &Arc<World>, pos: BlockPos)

Called after a player successfully removes this block. Read more
Source§

fn get_drops( &self, state: BlockStateId, context: &BlockLootContext<'_>, ) -> Option<Vec<ItemStack>>

Overrides the loot generated for this block state. Read more
Source§

fn spawn_after_break( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, tool: &ItemStack, drop_experience: bool, )

Called for post-break effects such as experience drops. Read more
Source§

fn use_item_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, player: &Player, hand: InteractionHand, hit_result: &BlockHitResult, inv: &mut InventoryAccess, ) -> InteractionResult

Called when a player uses an item on this block. Read more
Source§

fn use_without_item( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, player: &Player, hit_result: &BlockHitResult, inv: &mut InventoryAccess, ) -> InteractionResult

Called when a player uses this block without an item (or as a fallback when use_item_on returns TryEmptyHandInteraction). Read more
Source§

fn handle_neighbor_changed( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, source_block: BlockRef, moved_by_piston: bool, )

Called when a neighboring block changes (not shape-related). Read more
Source§

fn is_signal_source( &self, _state: BlockStateId, _context: SignalQueryContext, ) -> bool

Returns whether this state is a redstone signal source.
Source§

fn is_diode(&self) -> bool

Returns whether this behavior is a vanilla diode block. Read more
Source§

fn is_trapdoor(&self) -> bool

Returns whether this behavior implements vanilla TrapDoorBlock semantics. Read more
Source§

fn is_rail(&self) -> bool

Returns whether this behavior implements vanilla BaseRailBlock semantics.
Source§

fn is_piston_base(&self) -> bool

Returns whether this behavior implements vanilla PistonBaseBlock semantics.
Source§

fn get_own_signal( &self, _state: BlockStateId, _world: &dyn LevelReader, _pos: BlockPos, _context: SignalQueryContext, ) -> i32

Returns this state’s direction-independent redstone signal strength.
Source§

fn get_signal( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, _direction: Direction, context: SignalQueryContext, ) -> i32

Returns the weak redstone signal emitted toward direction.
Source§

fn get_direct_signal( &self, _state: BlockStateId, _world: &dyn LevelReader, _pos: BlockPos, _direction: Direction, _context: SignalQueryContext, ) -> i32

Returns the direct redstone signal emitted toward direction.
Source§

fn is_redstone_conductor( &self, state: BlockStateId, _world: &dyn LevelReader, _pos: BlockPos, ) -> bool

Returns whether this state conducts direct redstone power through itself. Read more
Source§

fn trigger_event( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, param_a: i32, param_b: i32, ) -> bool

Handles a queued server block event. Read more
Source§

fn get_clone_item_stack( &self, block: BlockRef, state: BlockStateId, include_data: bool, ) -> Option<ItemStack>

Returns the item stack to give when a player picks this block (middle click). Read more
Source§

fn is_pathfindable( &self, state: BlockStateId, computation_type: PathComputationType, ) -> bool

Returns whether this block state is pathfindable for the supplied vanilla path computation. Read more
Source§

fn is_wooden_door(&self, state: BlockStateId) -> bool

Mirrors vanilla DoorBlock.isWoodenDoor. Read more
Source§

fn set_door_open( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, source_entity: Option<&dyn Entity>, open: bool, ) -> bool

Mirrors vanilla DoorBlock.setOpen for AI door goals.
Source§

fn default_get_collision_shape( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, context: BlockCollisionContext, ) -> VoxelShape

Returns this block state’s collision shape for the supplied collision context. Read more
Source§

fn get_collision_shape( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, context: BlockCollisionContext, ) -> VoxelShape

Returns this block state’s collision shape for the supplied collision context. Read more
Source§

fn get_collision_shape_offset( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, context: BlockCollisionContext, ) -> DVec3

Returns a block-local translation for this block state’s collision shape. Read more
Source§

fn get_collision_boxes( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, context: BlockCollisionContext, ) -> BlockCollisionBoxes

Resolves this block state’s collision shape to owned block-local boxes. Read more
Source§

fn get_block_support_boxes( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, ) -> BlockCollisionBoxes

Resolves vanilla BlockState.getBlockSupportShape to owned block-local boxes. Read more
Source§

fn is_face_sturdy( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, direction: Direction, support_type: SupportType, ) -> bool

Mirrors vanilla BlockState.isFaceSturdy(level, pos, direction, supportType). Read more
Source§

fn default_get_entity_inside_collision_shape( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, entity: &dyn Entity, ) -> VoxelShape

Returns this block state’s shape used by vanilla entity-inside effects. Read more
Source§

fn random_tick(&self, state: BlockStateId, world: &Arc<World>, pos: BlockPos)

Called on random tick for blocks that support random ticking. Read more
Source§

fn on_projectile_hit( &self, _state: BlockStateId, _world: &Arc<World>, _hit: &ClipHitResult, _projectile: &dyn Projectile, )

Called when a projectile hits this block. Read more
Source§

fn default_entity_inside( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, effect_collector: &mut InsideBlockEffectCollector, is_precise: bool, )

Default entity-inside hook. Read more
Source§

fn default_fall_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, context: EntityFallOnContext<'_>, ) -> Option<EntityFallDamage>

Default fall-on hook. Read more
Source§

fn fall_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, context: EntityFallOnContext<'_>, ) -> Option<EntityFallDamage>

Called when an entity lands on this block. Read more
Source§

fn after_fall_on_damage( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, fall_damage: &EntityFallDamage, damage_applied: bool, )

Called after fall damage requested by BlockBehavior::fall_on is applied. Read more
Source§

fn default_update_entity_movement_after_fall_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, context: EntityLandingContext, ) -> DVec3

Default post-fall movement hook. Read more
Source§

fn update_entity_movement_after_fall_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, context: EntityLandingContext, ) -> DVec3

Updates entity velocity after a vertical movement collision with this block. Read more
Source§

fn default_step_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, )

Default step-on hook. Read more
Source§

fn step_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, )

Called when an entity steps on this block while on ground. Read more
Source§

fn new_block_entity( &self, level: Weak<World>, pos: BlockPos, state: BlockStateId, ) -> BlockEntityCreation

Creates a new block entity for this block. Read more
Source§

fn get_block_entity_ticker( &self, world: &Arc<World>, state: BlockStateId, block_entity_type: BlockEntityTypeRef, ) -> Option<BlockEntityTicker>

Returns the server ticker selected by this live block state and entity type. Read more
Source§

fn get_game_event_listener( &self, world: &Arc<World>, block_entity: &dyn BlockEntity, ) -> Option<SharedGameEventListener>

Returns the game-event listener exposed by this block entity. Read more
Source§

fn should_keep_block_entity( &self, old_state: BlockStateId, new_state: BlockStateId, ) -> bool

Returns whether this new block should keep the old state’s block entity. Read more
Source§

fn has_analog_output_signal(&self, state: BlockStateId) -> bool

Returns whether this block can provide an analog output signal to comparators. Read more
Source§

fn get_analog_output_signal( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, direction: Direction, ) -> i32

Returns the analog output signal strength (0-15) for comparators. Read more
Source§

fn is_liquid_container(&self, state: BlockStateId) -> bool

Vanilla parity: whether this block implements LiquidBlockContainer. Read more
Source§

fn can_place_liquid(&self, state: BlockStateId, fluid: FluidRef) -> bool

Vanilla parity: LiquidBlockContainer.canPlaceLiquid(). Read more
Source§

fn can_place_liquid_with_player( &self, state: BlockStateId, fluid: FluidRef, _player: Option<&Player>, ) -> bool

Vanilla parity: LiquidBlockContainer.canPlaceLiquid() with a user. Read more
Source§

fn can_be_replaced_by_fluid( &self, state: BlockStateId, _fluid_block: BlockRef, ) -> bool

Vanilla parity: BlockBehaviour.BlockStateBase.canBeReplaced(Fluid). Read more
Source§

fn place_liquid( &self, level: &dyn LevelAccessor, pos: BlockPos, state: BlockStateId, fluid_state: FluidState, ) -> bool

Vanilla parity: LiquidBlockContainer.placeLiquid(). Read more
Source§

fn as_bonemealable(&self) -> Option<&dyn Bonemealable>

Returns the trait object for Blocks that have the Bonemealable trait implemented.
Source§

fn as_rail(&self) -> Option<&dyn RailBehavior>

Returns the shared vanilla rail capability implemented by this block.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoShared for T

Source§

fn into_shared(self) -> Arc<Mutex<RawMutex, Self>>

Wraps this value in an Arc<SyncMutex<>>
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more