Class TillableBlockRegistry

java.lang.Object
net.fabricmc.fabric.api.registry.TillableBlockRegistry

public final class TillableBlockRegistry extends Object
A registry for hoe tilling interactions. A vanilla example is turning dirt to dirt paths.
  • Method Details

    • register

      public static void register(Block input, Predicate<ItemUsageContext> usagePredicate, Consumer<ItemUsageContext> tillingAction)
      Registers a tilling interaction.

      Tilling interactions are a two-step process. First, a usage predicate is run that decides whether to till a block. If the predicate returns true, an action is executed. Default instances of these can be created with these HoeItem methods:

      Parameters:
      input - the input block that can be tilled
      usagePredicate - a predicate that filters if the block can be tilled
      tillingAction - an action that is executed if the predicate returns true
    • register

      public static void register(Block input, Predicate<ItemUsageContext> usagePredicate, BlockState tilled)
      Registers a simple tilling interaction.
      Parameters:
      input - the input block that can be tilled
      usagePredicate - a predicate that filters if the block can be tilled
      tilled - the tilled result block state
    • register

      public static void register(Block input, Predicate<ItemUsageContext> usagePredicate, BlockState tilled, ItemConvertible droppedItem)
      Registers a simple tilling interaction that also drops an item.
      Parameters:
      input - the input block that can be tilled
      usagePredicate - a predicate that filters if the block can be tilled
      tilled - the tilled result block state
      droppedItem - an item that is dropped when the input block is tilled