Skip to content

Commit 03bc34c

Browse files
committed
Merge branch '1.21.5' into improvement/documentation
# Conflicts: # src/main/kotlin/com/lambda/interaction/request/breaking/BreakManager.kt # src/main/kotlin/com/lambda/interaction/request/breaking/BreakRequest.kt # src/main/kotlin/com/lambda/interaction/request/breaking/BrokenBlockHandler.kt # src/main/kotlin/com/lambda/interaction/request/breaking/SwapInfo.kt
2 parents 93ab581 + a9beef9 commit 03bc34c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+305
-127
lines changed

src/main/kotlin/com/lambda/interaction/construction/context/BuildContext.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ import net.minecraft.block.BlockState
2525
import net.minecraft.util.hit.BlockHitResult
2626
import net.minecraft.util.math.BlockPos
2727

28+
/**
29+
* Holds the necessary information for managers to perform actions.
30+
*/
2831
abstract class BuildContext : Comparable<BuildContext>, Drawable, Automated {
2932
abstract val hitResult: BlockHitResult
3033
abstract val rotationRequest: RotationRequest

src/main/kotlin/com/lambda/interaction/construction/processing/PlacementProcessor.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ package com.lambda.interaction.construction.processing
2020
import net.minecraft.block.BlockState
2121
import net.minecraft.util.math.BlockPos
2222

23+
/**
24+
* The class all pre-processors must extend to provide the structure. Preprocessors are used to
25+
* optimize how blocks are simulated. Some blocks might only be placeable on certain sides, so it is
26+
* unnecessary to scan all of them, for example.
27+
*/
2328
abstract class PlacementProcessor {
2429
abstract fun acceptsState(state: BlockState): Boolean
2530
abstract fun preProcess(state: BlockState, pos: BlockPos, accumulator: PreProcessingInfoAccumulator)

src/main/kotlin/com/lambda/interaction/construction/processing/ProcessingStep.kt

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/main/kotlin/com/lambda/interaction/construction/processing/ProcessorRegistry.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ object ProcessorRegistry : Loadable {
2929
private val processors = getInstances<PlacementProcessor>()
3030
private val processorCache = Collections.synchronizedMap<BlockState, PreProcessingInfo?>(mutableMapOf())
3131

32+
/**
33+
* List of properties that can be processed after the block is placed. This is often used to ignore these properties
34+
* when placing blocks, as sometimes they can only be set to the right state after placement.
35+
*/
3236
val postProcessedProperties = setOf(
3337
Properties.EXTENDED,
3438
Properties.EYE,
@@ -106,6 +110,13 @@ object ProcessorRegistry : Loadable {
106110

107111
override fun load() = "Loaded ${processors.size} pre processors"
108112

113+
/**
114+
* [PreProcessingInfo]'s are cached to avoid duplicate computations as block states are immutable.
115+
*
116+
* @return A [PreProcessingInfo] object containing information about the block state. This method runs through
117+
* each pre-processor checking if the state can be accepted. If so, the state is passed through the pre-processor
118+
* which can call the functions within the [PreProcessingInfoAccumulator] DSL to modify the information.
119+
*/
109120
fun TargetState.getProcessingInfo(pos: BlockPos): PreProcessingInfo? =
110121
if (this !is TargetState.State) PreProcessingInfo.DEFAULT
111122
else {

src/main/kotlin/com/lambda/interaction/construction/processing/TaskPlanner.kt

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/main/kotlin/com/lambda/interaction/construction/result/Contextual.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ package com.lambda.interaction.construction.result
2020
import com.lambda.interaction.construction.context.BuildContext
2121
import com.lambda.interaction.request.hotbar.HotbarManager
2222

23+
/**
24+
* Represents a result holding a [BuildContext].
25+
*/
2326
interface Contextual : ComparableResult<Rank> {
2427
val context: BuildContext
2528

src/main/kotlin/com/lambda/interaction/construction/result/Dependent.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
package com.lambda.interaction.construction.result
1919

20+
/**
21+
* Represents a [BuildResult] that depends on another [BuildResult].
22+
*/
2023
interface Dependent {
2124
val dependency: BuildResult
2225
val lastDependency: BuildResult

src/main/kotlin/com/lambda/interaction/construction/result/Drawable.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ package com.lambda.interaction.construction.result
1919

2020
import com.lambda.graphics.renderer.esp.ShapeBuilder
2121

22+
/**
23+
* Represents a [BuildResult] that can be rendered in-game.
24+
*/
2225
interface Drawable {
2326
fun ShapeBuilder.buildRenderer()
2427
}

src/main/kotlin/com/lambda/interaction/construction/result/Navigable.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ package com.lambda.interaction.construction.result
1919

2020
import baritone.api.pathing.goals.Goal
2121

22+
/**
23+
* Represents a [BuildResult] with a pathing goal.
24+
*/
2225
interface Navigable {
2326
val goal: Goal
2427
}

src/main/kotlin/com/lambda/interaction/construction/result/Resolvable.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ package com.lambda.interaction.construction.result
2020
import com.lambda.context.Automated
2121
import com.lambda.task.Task
2222

23+
/**
24+
* Represents a [BuildResult] with a resolvable [Task]
25+
*/
2326
interface Resolvable {
2427
context(automated: Automated)
2528
fun resolve(): Task<*>

0 commit comments

Comments
 (0)