Interface BlockSupply


public interface BlockSupply
An extra source of blocks for a line, like a bag. Linear uses the player's inventory first, then asks each supply in turn. The last block in hand is used up last. Register with LinearApi.registerSupply(tschipp.linear.api.BlockSupply).
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    available(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack block, int wanted)
    How many of block this supply can provide right now, at most wanted.
    int
    take(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack block, int amount)
    Removes up to amount of block from the supply.
  • Method Details

    • available

      int available(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack block, int wanted)
      How many of block this supply can provide right now, at most wanted. Called on both sides (the client uses it for the preview). Never return more than take(net.minecraft.server.level.ServerPlayer, net.minecraft.world.item.ItemStack, int) would give.
      Parameters:
      block - the block as the player holds it, count 1; compare with ItemStack.isSameItemSameComponents
    • take

      int take(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack block, int amount)
      Removes up to amount of block from the supply. Server side.
      Returns:
      how many were removed