Class ButtonPart

All Implemented Interfaces:
FacePart, IconHitEffectsPart, ModelRenderPart, MultiPart, NormalOcclusionPart, FaceRedstonePart, RedstonePart, SlottedPart
Direct Known Subclasses:
ButtonPart.AcaciaButtonPart, ButtonPart.BirchButtonPart, ButtonPart.CrimsonButtonPart, ButtonPart.DarkOakButtonPart, ButtonPart.JungleButtonPart, ButtonPart.OakButtonPart, ButtonPart.PolishedBlackstoneButtonPart, ButtonPart.SpruceButtonPart, ButtonPart.StoneButtonPart, ButtonPart.WarpedButtonPart

public class ButtonPart extends McSidedStatePart implements FaceRedstonePart
  • Constructor Details

    • ButtonPart

      public ButtonPart(MultipartType<?> type, net.minecraft.world.level.block.ButtonBlock block)
    • ButtonPart

      public ButtonPart(MultipartType<?> type, net.minecraft.world.level.block.ButtonBlock block, net.minecraft.world.level.block.state.BlockState state)
  • Method Details

    • getType

      public MultipartType<?> getType()
      Description copied from interface: MultiPart
      Returns the MultipartType registry entry for this part.
      Specified by:
      getType in interface MultiPart
      Returns:
      The MultipartType.
      See Also:
    • defaultBlockState

      public net.minecraft.world.level.block.state.BlockState defaultBlockState()
      Specified by:
      defaultBlockState in class McStatePart
    • getDropStack

      public net.minecraft.world.item.ItemStack getDropStack()
      Specified by:
      getDropStack in class McStatePart
    • getSide

      public net.minecraft.core.Direction getSide()
      Specified by:
      getSide in class McSidedStatePart
    • setStateOnPlacement

      @Nullable public @Nullable MultiPart setStateOnPlacement(net.minecraft.world.item.context.BlockPlaceContext context)
      Overrides:
      setStateOnPlacement in class McStatePart
    • delay

      public int delay()
    • canArrowsPress

      public boolean canArrowsPress()
    • useWithoutItem

      public net.minecraft.world.InteractionResult useWithoutItem(net.minecraft.world.entity.player.Player player, PartRayTraceResult hit)
      Description copied from interface: MultiPart
      Called on block right-click without an item.

      This should not modify the part client-side.

      Specified by:
      useWithoutItem in interface MultiPart
      Parameters:
      player - The player that right-clicked the part.
      hit - The PartRayTraceResult hit result.
      Returns:
      The InteractionResult.
    • scheduledTick

      public void scheduledTick()
      Description copied from interface: MultiPart
      Called when a scheduled tick is executed.
      Specified by:
      scheduledTick in interface MultiPart
      See Also:
    • pressed

      public boolean pressed()
    • onEntityCollision

      public void onEntityCollision(net.minecraft.world.entity.Entity entity)
      Description copied from interface: MultiPart
      Called when an entity is within this block space.

      The entity may not actually be colliding with this part.

      Specified by:
      onEntityCollision in interface MultiPart
      Parameters:
      entity - The Entity.
    • onRemoved

      public void onRemoved()
      Description copied from interface: MultiPart
      Called when this part is removed from the block space.
      Specified by:
      onRemoved in interface MultiPart
    • weakPowerLevel

      public int weakPowerLevel(int side)
      Description copied from interface: RedstonePart
      Returns the weak (direct) being emitted by this part on the specified side.
      Specified by:
      weakPowerLevel in interface RedstonePart
      Parameters:
      side - The side index.
      Returns:
      The redstone signal.
    • strongPowerLevel

      public int strongPowerLevel(int side)
      Description copied from interface: RedstonePart
      Returns the strong (indirect, through blocks) signal being emitted by this part on the specified side.
      Specified by:
      strongPowerLevel in interface RedstonePart
      Parameters:
      side - The side index.
      Returns:
      The redstone signal.
    • canConnectRedstone

      public boolean canConnectRedstone(int side)
      Description copied from interface: RedstonePart
      Returns weather this part can connect to redstone on the specified side.

      Blocking parts like covers will be handled by RedstoneInteractions.

      Specified by:
      canConnectRedstone in interface RedstonePart
      Parameters:
      side - The side index.
      Returns:
      True if redstone can connect.
    • getFace

      public int getFace()
      Description copied from interface: FaceRedstonePart
      Returns the face which this Redstone part is attached.
      Specified by:
      getFace in interface FaceRedstonePart
      Returns:
      The face.