Class LineBuilder

java.lang.Object
tschipp.linear.build.LineBuilder

public final class LineBuilder extends Object
Places the blocks of a line on the server, and works out the positions for the preview.
  • Nested Class Summary

    Nested Classes
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    build(net.minecraft.server.level.ServerPlayer player, net.minecraft.core.BlockPos start, net.minecraft.core.BlockPos end, net.minecraft.world.InteractionHand hand, net.minecraft.core.Direction face, net.minecraft.world.phys.Vec3 hitOffset)
    Builds a line the client asked for, after validating the request.
    static net.minecraft.world.phys.Vec3
    hitOffset(net.minecraft.world.phys.BlockHitResult target)
    Where the click hit within the target block, 0 to 1 per axis.
    plan(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, LinearSettings settings, BuildMode mode, net.minecraft.core.BlockPos start, net.minecraft.core.BlockPos end)
    Splits a drag's free positions into the ones that may get a block (nearest first) and the ones the survival distance or block limits refuse.
    static List<net.minecraft.core.BlockPos>
    positions(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, LinearSettings settings, BuildMode mode, net.minecraft.core.BlockPos start, net.minecraft.core.BlockPos end)
    The positions that can take a block, nearest first, and in survival within the distance and block limits.
    static @Nullable net.minecraft.world.phys.BlockHitResult
    target(net.minecraft.world.entity.player.Player player, double reach, boolean midair)
    Where a click builds: the clicked block if replaceable, else the one in front of it.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • positions

      public static List<net.minecraft.core.BlockPos> positions(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, LinearSettings settings, BuildMode mode, net.minecraft.core.BlockPos start, net.minecraft.core.BlockPos end)
      The positions that can take a block, nearest first, and in survival within the distance and block limits. Both sides.
    • plan

      public static LineBuilder.Plan plan(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, LinearSettings settings, BuildMode mode, net.minecraft.core.BlockPos start, net.minecraft.core.BlockPos end)
      Splits a drag's free positions into the ones that may get a block (nearest first) and the ones the survival distance or block limits refuse.
    • build

      public static int build(net.minecraft.server.level.ServerPlayer player, net.minecraft.core.BlockPos start, net.minecraft.core.BlockPos end, net.minecraft.world.InteractionHand hand, net.minecraft.core.Direction face, net.minecraft.world.phys.Vec3 hitOffset)
      Builds a line the client asked for, after validating the request.
      Returns:
      how many blocks were placed
    • target

      @Nullable public static @Nullable net.minecraft.world.phys.BlockHitResult target(net.minecraft.world.entity.player.Player player, double reach, boolean midair)
      Where a click builds: the clicked block if replaceable, else the one in front of it. If nothing was hit and midair is allowed, the block at the end of the player's reach. Both sides.
    • hitOffset

      public static net.minecraft.world.phys.Vec3 hitOffset(net.minecraft.world.phys.BlockHitResult target)
      Where the click hit within the target block, 0 to 1 per axis. Every block uses the same offset, so e.g. slabs are all top or all bottom.