Interface TurtleRefuelHandler


public interface TurtleRefuelHandler
A function called when a turtle attempts to refuel via turtle.refuel(). This may be used to provide alternative fuel sources, such as consuming RF batteries.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    refuel(ITurtleAccess turtle, net.minecraft.world.item.ItemStack stack, int slot, int limit)
    Refuel a turtle using an item.
  • Method Details

    • refuel

      OptionalInt refuel(ITurtleAccess turtle, net.minecraft.world.item.ItemStack stack, int slot, int limit)
      Refuel a turtle using an item.
      Parameters:
      turtle - The turtle to refuel.
      stack - The stack to refuel with.
      slot - The slot the stack resides within. This may be used to modify the inventory afterwards.
      limit - The maximum number of refuel operations to perform. This will often correspond to the number of items to consume.

      This value may be zero. In this case, you should still detect if the item can be handled (returning OptionalInt#of(0) if so), but should NOT modify the stack or inventory.

      Returns:
      The amount of fuel gained, or OptionalInt.empty() if this handler does not accept the given item.