Package tschipp.linear.build
Class LineBuilder
java.lang.Object
tschipp.linear.build.LineBuilder
Places the blocks of a line on the server, and works out the positions for the preview.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record -
Method Summary
Modifier and TypeMethodDescriptionstatic intbuild(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.Vec3hitOffset(net.minecraft.world.phys.BlockHitResult target) Where the click hit within the target block, 0 to 1 per axis.static LineBuilder.Planplan(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.BlockHitResulttarget(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.
-
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.
-