Package tschipp.linear.api
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 TypeMethodDescriptionintavailable(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack block, int wanted) How many ofblockthis supply can provide right now, at mostwanted.inttake(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack block, int amount) Removes up toamountofblockfrom the supply.
-
Method Details
-
available
int available(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack block, int wanted) How many ofblockthis supply can provide right now, at mostwanted. Called on both sides (the client uses it for the preview). Never return more thantake(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 withItemStack.isSameItemSameComponents
-
take
int take(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack block, int amount) Removes up toamountofblockfrom the supply. Server side.- Returns:
- how many were removed
-