Class TBlockStateElement

java.lang.Object
com.thecsdev.common.scene.Node<TElement>
com.thecsdev.commonmc.api.client.gui.TElement
com.thecsdev.commonmc.api.client.gui.misc.TBlockStateElement
All Implemented Interfaces:
INode<TElement>, INodeBounded<TElement,Bounds2i>, INodeRenderable<TElement, TGuiGraphics>, Iterable<TElement>, Collection<TElement>

@Virtual public class TBlockStateElement extends TElement
TElement that renders a given BlockState on the screen, like how the game does it in the inventory screen.
  • Constructor Details

    • TBlockStateElement

      public TBlockStateElement()
    • TBlockStateElement

      public TBlockStateElement(@Nullable @Nullable net.minecraft.world.level.block.state.BlockState blockState)
  • Method Details

    • blockStateProperty

      public final NotNullProperty<net.minecraft.world.level.block.state.BlockState> blockStateProperty()
      Returns the NotNullProperty holding the BlockState that is to be rendered by this TBlockStateElement.
    • renderItemStackProperty

      public final BooleanProperty renderItemStackProperty()
      If set to true, the BlockState's corresponding default ItemStack will be rendered where possible (similar to TItemStackElement). Otherwise, only the BlockState's sprite will be rendered.
    • renderCallback

      public final void renderCallback(@NotNull @NotNull TGuiGraphics pencil)
      Description copied from interface: INodeRenderable
      Callback method that is invoked when this Node is being rendered.
      Specified by:
      renderCallback in interface INodeRenderable<TElement, TGuiGraphics>
      Overrides:
      renderCallback in class TElement
      Parameters:
      pencil - The rendering context.
    • isAir

      public static final boolean isAir(@NotNull @NotNull net.minecraft.world.level.block.Block block)
      Returns true if a Block is an instance of AirBlock. This includes regular air, cave air, and void air.

      Note: This does NOT include structure void, as that is not air.