Package tschipp.linear.build
Interface BlockSource
- All Known Implementing Classes:
BlockSource.HeldBlock,BlockSource.HeldItem
Where a line's blocks come from: a block in hand (plus inventory and supplies), or an item that picks blocks.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordA block in hand.static final recordA non-block item that places blocks, seeHeldItemHandler. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanallowed(net.minecraft.world.item.ItemStack block, LinearSettings settings) Whether a block may be used in a line, checking the blacklist or whitelist.intavailable(net.minecraft.world.entity.player.Player player, int wanted) How many blocks there are for the line, at mostwanted.static @Nullable net.minecraft.world.InteractionHanddrawingHand(net.minecraft.world.entity.player.Player player) The hand to draw a line with (main hand first), or null.voidgiveBack(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack block) Puts back a block that was taken but not placed.static @Nullable BlockSourceof(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand) What the player can draw a line with inhand, or null if nothing.net.minecraft.world.item.ItemStackpreview(net.minecraft.world.entity.player.Player player) The block the preview shows.net.minecraft.world.item.ItemStacktakeOne(net.minecraft.server.level.ServerPlayer player) Takes the next block, or returns empty if there are none left.
-
Method Details
-
preview
net.minecraft.world.item.ItemStack preview(net.minecraft.world.entity.player.Player player) The block the preview shows. -
available
int available(net.minecraft.world.entity.player.Player player, int wanted) How many blocks there are for the line, at mostwanted. Creative players have no limit. -
takeOne
net.minecraft.world.item.ItemStack takeOne(net.minecraft.server.level.ServerPlayer player) Takes the next block, or returns empty if there are none left. -
giveBack
void giveBack(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack block) Puts back a block that was taken but not placed. -
of
@Nullable static @Nullable BlockSource of(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand) What the player can draw a line with inhand, or null if nothing. -
drawingHand
@Nullable static @Nullable net.minecraft.world.InteractionHand drawingHand(net.minecraft.world.entity.player.Player player) The hand to draw a line with (main hand first), or null. -
allowed
Whether a block may be used in a line, checking the blacklist or whitelist.
-