@@ -10,7 +10,7 @@ import com.lambda.task.tasks.BuildStructure.Companion.buildStructure
1010import com.lambda.util.BaritoneUtils.primary
1111import com.lambda.util.Communication.info
1212import com.lambda.util.KeyCode
13- import com.lambda.util.player.MovementUtils.direction
13+ import com.lambda.util.player.MovementUtils.octant
1414import com.lambda.util.primitives.extension.Structure
1515import com.lambda.util.world.StructureUtils.generateDirectionalTube
1616import net.minecraft.block.Blocks
@@ -31,18 +31,19 @@ object HighwayTools : Module(
3131 private val cornerBlock by setting(" Corner Block" , false , description = " Include corner blocks in the highway" )
3232 private val material = Blocks .OBSIDIAN
3333 private val distance by setting(" Distance" , - 1 , - 1 .. 1000000 , 1 , description = " Distance to build the highway (negative for infinite)" )
34+ private val sliceSize by setting(" Slice Size" , 3 , 1 .. 5 , 1 , description = " Number of slices to build at once" )
3435 // ToDo: Fix block setting
3536// private val material by setting("Material", Blocks.OBSIDIAN, description = "Material to build the highway with")
3637
37- private var direction = EightWayDirection .NORTH
38+ private var octant = EightWayDirection .NORTH
3839 private var distanceMoved = 0
3940 private var startPos = BlockPos .ORIGIN
4041 private var currentPos = BlockPos .ORIGIN
4142 private var runningTask: Task <* >? = null
4243
4344 init {
4445 onEnable {
45- direction = player.direction()
46+ octant = player.octant
4647 startPos = player.blockPos
4748 currentPos = startPos
4849 buildSlice()
@@ -55,22 +56,22 @@ object HighwayTools : Module(
5556 }
5657
5758 private fun buildSlice () {
58- val blueprint = generateHighway()
59- .map { it.key.add(currentPos) to it.value }
60- .toMap()
61- .toBlueprint()
59+ distanceMoved + = sliceSize
60+
61+ var structure: Structure = mutableMapOf ()
62+ val slice = highwaySlice()
63+ repeat(sliceSize) {
64+ val vec = Vec3i (octant.offsetX, 0 , octant.offsetZ)
65+ currentPos = currentPos.add(vec)
66+ structure + = slice.map { it.key.add(currentPos) to it.value }
67+ }
6268
6369 buildStructure {
64- blueprint
70+ structure.toBlueprint()
6571 }.apply {
6672 runningTask = this
67- primary.customGoalProcess.setGoalAndPath(GoalNear (currentPos, 1 ))
73+ primary.customGoalProcess.setGoalAndPath(GoalNear (currentPos, sliceSize ))
6874 onSuccess { _, _ ->
69- distanceMoved++
70-
71- val vec = Vec3i (direction.offsetX, 0 , direction.offsetZ)
72- currentPos = currentPos.add(vec)
73-
7475 if (distanceMoved < distance || distance < 0 ) {
7576 buildSlice()
7677 } else {
@@ -82,9 +83,9 @@ object HighwayTools : Module(
8283 }
8384 }
8485
85- private fun generateHighway (): Structure {
86+ private fun highwaySlice (): Structure {
8687 val structure = mutableMapOf<BlockPos , TargetState >()
87- val orthogonal = EightWayDirection .entries[(direction .ordinal + 2 ).mod(8 )]
88+ val orthogonal = EightWayDirection .entries[(octant .ordinal + 2 ).mod(8 )]
8889 val center = (width / 2.0 ).roundToInt()
8990
9091 // Area to clear
0 commit comments