pub struct BlockState<'mc>(/* private fields */);Implementations§
Source§impl<'mc> BlockState<'mc>
impl<'mc> BlockState<'mc>
Sourcepub fn block(&self) -> Result<Block<'mc>, Box<dyn Error>>
pub fn block(&self) -> Result<Block<'mc>, Box<dyn Error>>
Gets the block represented by this block state.
Sourcepub fn data(&self) -> Result<MaterialData<'mc>, Box<dyn Error>>
pub fn data(&self) -> Result<MaterialData<'mc>, Box<dyn Error>>
Gets the metadata for this block state.
Sourcepub fn block_data(&self) -> Result<BlockData<'mc>, Box<dyn Error>>
pub fn block_data(&self) -> Result<BlockData<'mc>, Box<dyn Error>>
Gets the data for this block state.
Sourcepub fn copy(
&self,
location: Option<impl Into<Location<'mc>>>,
) -> Result<BlockState<'mc>, Box<dyn Error>>
pub fn copy( &self, location: Option<impl Into<Location<'mc>>>, ) -> Result<BlockState<'mc>, Box<dyn Error>>
Copies the state to another block as an unplaced BlockState.
Sourcepub fn get_type(&self) -> Result<Material<'mc>, Box<dyn Error>>
pub fn get_type(&self) -> Result<Material<'mc>, Box<dyn Error>>
Gets the type of this block state.
Sourcepub fn light_level(&self) -> Result<i8, Box<dyn Error>>
pub fn light_level(&self) -> Result<i8, Box<dyn Error>>
Gets the current light level of the block represented by this block state.
Sourcepub fn world(&self) -> Result<World<'mc>, Box<dyn Error>>
pub fn world(&self) -> Result<World<'mc>, Box<dyn Error>>
Gets the world which contains the block represented by this block state.
Sourcepub fn get_location(
&self,
loc: impl Into<Location<'mc>>,
) -> Result<Option<Location<'mc>>, Box<dyn Error>>
pub fn get_location( &self, loc: impl Into<Location<'mc>>, ) -> Result<Option<Location<'mc>>, Box<dyn Error>>
Stores the location of this block state in the provided Location object.
If the provided Location is null this method does nothing and returns null.
If this block state is not placed the location’s world will be null!
Sourcepub fn chunk(&self) -> Result<Chunk<'mc>, Box<dyn Error>>
pub fn chunk(&self) -> Result<Chunk<'mc>, Box<dyn Error>>
Gets the chunk which contains the block represented by this block state.
Sourcepub fn set_data(
&self,
data: impl Into<MaterialData<'mc>>,
) -> Result<(), Box<dyn Error>>
pub fn set_data( &self, data: impl Into<MaterialData<'mc>>, ) -> Result<(), Box<dyn Error>>
Sets the metadata for this block state.
Sourcepub fn set_block_data(
&self,
data: impl Into<BlockData<'mc>>,
) -> Result<(), Box<dyn Error>>
pub fn set_block_data( &self, data: impl Into<BlockData<'mc>>, ) -> Result<(), Box<dyn Error>>
Sets the data for this block state.
Sourcepub fn set_type(
&self,
val_type: impl Into<Material<'mc>>,
) -> Result<(), Box<dyn Error>>
pub fn set_type( &self, val_type: impl Into<Material<'mc>>, ) -> Result<(), Box<dyn Error>>
Sets the type of this block state.
Sourcepub fn update(
&self,
force: Option<bool>,
apply_physics: Option<bool>,
) -> Result<bool, Box<dyn Error>>
pub fn update( &self, force: Option<bool>, apply_physics: Option<bool>, ) -> Result<bool, Box<dyn Error>>
Attempts to update the block represented by this state, setting it to the new values as defined by this state.
If this state is not placed, this will have no effect and return true.
Unless force is true, this will not modify the state of a block if it is no longer the same type as it was when this state was taken. It will return false in this eventuality.
If force is true, it will set the type of the block to match the new state, set the state data and then return true.
If applyPhysics is true, it will trigger a physics update on surrounding blocks which could cause them to update or disappear.
pub fn raw_data(&self) -> Result<i8, Box<dyn Error>>
pub fn set_raw_data(&self, data: i8) -> Result<(), Box<dyn Error>>
Sourcepub fn is_placed(&self) -> Result<bool, Box<dyn Error>>
pub fn is_placed(&self) -> Result<bool, Box<dyn Error>>
Returns whether this state is placed in the world.
Some methods will not work if the block state isn’t placed in the world.
Sourcepub fn set_metadata(
&self,
metadata_key: impl Into<String>,
new_metadata_value: impl Into<MetadataValue<'mc>>,
) -> Result<(), Box<dyn Error>>
pub fn set_metadata( &self, metadata_key: impl Into<String>, new_metadata_value: impl Into<MetadataValue<'mc>>, ) -> Result<(), Box<dyn Error>>
Sets a metadata value in the implementing object’s metadata store.
Sourcepub fn get_metadata(
&self,
metadata_key: impl Into<String>,
) -> Result<Vec<MetadataValue<'mc>>, Box<dyn Error>>
pub fn get_metadata( &self, metadata_key: impl Into<String>, ) -> Result<Vec<MetadataValue<'mc>>, Box<dyn Error>>
Returns a list of previously set metadata values from the implementing object’s metadata store.
Sourcepub fn has_metadata(
&self,
metadata_key: impl Into<String>,
) -> Result<bool, Box<dyn Error>>
pub fn has_metadata( &self, metadata_key: impl Into<String>, ) -> Result<bool, Box<dyn Error>>
Tests to see whether the implementing object contains the given metadata value in its metadata store.
Sourcepub fn remove_metadata(
&self,
metadata_key: impl Into<String>,
owning_plugin: impl Into<Plugin<'mc>>,
) -> Result<(), Box<dyn Error>>
pub fn remove_metadata( &self, metadata_key: impl Into<String>, owning_plugin: impl Into<Plugin<'mc>>, ) -> Result<(), Box<dyn Error>>
Removes the given metadata value from the implementing object’s metadata store.
pub fn instance_of(&self, other: impl Into<String>) -> Result<bool, Error>
Trait Implementations§
Source§impl<'mc> Into<BlockState<'mc>> for TileState<'mc>
impl<'mc> Into<BlockState<'mc>> for TileState<'mc>
Source§fn into(self) -> BlockState<'mc>
fn into(self) -> BlockState<'mc>
Source§impl<'mc> Into<Metadatable<'mc>> for BlockState<'mc>
impl<'mc> Into<Metadatable<'mc>> for BlockState<'mc>
Source§fn into(self) -> Metadatable<'mc>
fn into(self) -> Metadatable<'mc>
Source§impl<'mc> JNIInstantiatable<'mc> for BlockState<'mc>
impl<'mc> JNIInstantiatable<'mc> for BlockState<'mc>
Source§impl<'mc> JNIRaw<'mc> for BlockState<'mc>
impl<'mc> JNIRaw<'mc> for BlockState<'mc>
fn jni_ref(&self) -> SharedJNIEnv<'mc>
fn jni_object(&self) -> JObject<'mc>
Auto Trait Implementations§
impl<'mc> !Freeze for BlockState<'mc>
impl<'mc> !RefUnwindSafe for BlockState<'mc>
impl<'mc> !Send for BlockState<'mc>
impl<'mc> !Sync for BlockState<'mc>
impl<'mc> Unpin for BlockState<'mc>
impl<'mc> UnwindSafe for BlockState<'mc>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more