Class BlockSetTypeBuilder

java.lang.Object
net.fabricmc.fabric.api.object.builder.v1.block.type.BlockSetTypeBuilder

public final class BlockSetTypeBuilder extends Object
This class allows easy creation of BlockSetTypes.

A BlockSetType is used to tell the game various properties of related blocks, such as what sounds they should use.

See Also:
  • Constructor Details

    • BlockSetTypeBuilder

      public BlockSetTypeBuilder()
  • Method Details

    • openableByHand

      public BlockSetTypeBuilder openableByHand(boolean openableByHand)
      Sets whether this block set type's door and trapdoor can be opened by hand.

      Defaults to true.

      Returns:
      this builder for chaining
    • openableByWindCharge

      public BlockSetTypeBuilder openableByWindCharge(boolean openableByWindCharge)
      Sets whether this block set type's door and trapdoor can be opened by wind charge.

      Defaults to true.

      Returns:
      this builder for chaining
    • buttonActivatedByArrows

      public BlockSetTypeBuilder buttonActivatedByArrows(boolean buttonActivatedByArrows)
      Sets whether this block set type's button can be activated by an arrow.

      Defaults to true.

      Returns:
      this builder for chaining
    • pressurePlateActivationRule

      public BlockSetTypeBuilder pressurePlateActivationRule(net.minecraft.world.level.block.state.properties.BlockSetType.PressurePlateSensitivity activationRule)
      Sets this block set type's pressure plate BlockSetType.PressurePlateSensitivity.

      Defaults to BlockSetType.PressurePlateSensitivity.EVERYTHING.

      Returns:
      this builder for chaining
    • soundType

      public BlockSetTypeBuilder soundType(net.minecraft.world.level.block.SoundType soundType)
      Sets this block set type's sound type.

      Defaults to SoundType.WOOD.

      Returns:
      this builder for chaining
    • doorCloseSound

      public BlockSetTypeBuilder doorCloseSound(net.minecraft.sounds.SoundEvent doorCloseSound)
      Sets this block set type's door close sound.

      Defaults to SoundEvents.WOODEN_DOOR_CLOSE.

      Returns:
      this builder for chaining
    • doorOpenSound

      public BlockSetTypeBuilder doorOpenSound(net.minecraft.sounds.SoundEvent doorOpenSound)
      Sets this block set type's door open sound.

      Defaults to SoundEvents.WOODEN_DOOR_OPEN.

      Returns:
      this builder for chaining
    • trapdoorCloseSound

      public BlockSetTypeBuilder trapdoorCloseSound(net.minecraft.sounds.SoundEvent trapdoorCloseSound)
      Sets this block set type's trapdoor close sound.

      Defaults to SoundEvents.WOODEN_TRAPDOOR_CLOSE.

      Returns:
      this builder for chaining
    • trapdoorOpenSound

      public BlockSetTypeBuilder trapdoorOpenSound(net.minecraft.sounds.SoundEvent trapdoorOpenSound)
      Sets this block set type's trapdoor open sound.

      Defaults to SoundEvents.WOODEN_TRAPDOOR_OPEN.

      Returns:
      this builder for chaining
    • pressurePlateClickOffSound

      public BlockSetTypeBuilder pressurePlateClickOffSound(net.minecraft.sounds.SoundEvent pressurePlateClickOffSound)
      Sets this block set type's pressure plate click off sound.

      Defaults to SoundEvents.WOODEN_PRESSURE_PLATE_CLICK_OFF.

      Returns:
      this builder for chaining
    • pressurePlateClickOnSound

      public BlockSetTypeBuilder pressurePlateClickOnSound(net.minecraft.sounds.SoundEvent pressurePlateClickOnSound)
      Sets this block set type's pressure plate click on sound.

      Defaults to SoundEvents.WOODEN_PRESSURE_PLATE_CLICK_ON.

      Returns:
      this builder for chaining
    • buttonClickOffSound

      public BlockSetTypeBuilder buttonClickOffSound(net.minecraft.sounds.SoundEvent buttonClickOffSound)
      Sets this block set type's button click off sound.

      Defaults to SoundEvents.WOODEN_BUTTON_CLICK_OFF.

      Returns:
      this builder for chaining
    • buttonClickOnSound

      public BlockSetTypeBuilder buttonClickOnSound(net.minecraft.sounds.SoundEvent buttonClickOnSound)
      Sets this block set type's button click on sound.

      Defaults to SoundEvents.WOODEN_BUTTON_CLICK_ON.

      Returns:
      this builder for chaining
    • copyOf

      public static BlockSetTypeBuilder copyOf(BlockSetTypeBuilder builder)
      Creates a new BlockSetTypeBuilder that copies all of another builder's values.
      Parameters:
      builder - the BlockSetTypeBuilder whose values are to be copied
      Returns:
      the created copy
    • copyOf

      public static BlockSetTypeBuilder copyOf(net.minecraft.world.level.block.state.properties.BlockSetType setType)
      Creates a new BlockSetTypeBuilder that copies all of another block set type's values.
      Parameters:
      setType - the BlockSetType whose values are to be copied
      Returns:
      the created copy
    • register

      public net.minecraft.world.level.block.state.properties.BlockSetType register(net.minecraft.resources.Identifier id)
      Builds and registers a BlockSetType from this builder's values.

      Alternatively, you can use build(Identifier) to build without registering.
      Then BlockSetType.register(BlockSetType) can be used to register it later.

      Parameters:
      id - the id for the built BlockSetType
      Returns:
      the built and registered BlockSetType
    • build

      public net.minecraft.world.level.block.state.properties.BlockSetType build(net.minecraft.resources.Identifier id)
      Builds a BlockSetType from this builder's values without registering it.

      Use BlockSetType.register(BlockSetType) to register it later.
      Alternatively, you can use register(Identifier) to build and register it now.

      Parameters:
      id - the id for the built BlockSetType
      Returns:
      the built BlockSetType