Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/kotlin/com/lambda/config/groups/PlaceSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PlaceSettings(
) : PlaceConfig {
override val rotateForPlace by c.setting("Rotate For Place", true, "Rotate towards block while placing", visibility = vis).group(groupPath)
override val airPlace by c.setting("Air Place", AirPlaceMode.None, "Allows for placing blocks without adjacent faces", visibility = vis).group(groupPath)
override val axisRotateSetting by c.setting("Axis Rotate", true, "Overrides the Rotate For Place setting and rotates the player on each axis to air place rotational blocks") { vis() && airPlace.isEnabled() }.group(groupPath)
override val axisRotateSetting by c.setting("Axis Rotate", true, "Overrides the Rotate For Place setting and rotates the player on each axis to air place rotational blocks") { vis() && airPlace.isEnabled }.group(groupPath)
override val placeStageMask by c.setting("Place Sequence Mode", setOf(TickEvent.Pre, TickEvent.Input.Pre, TickEvent.Player.Post), description = "The sub-tick timing at which break actions are performed", visibility = vis).group(groupPath)
override val placeConfirmationMode by c.setting("Place Confirmation", PlaceConfirmationMode.PlaceThenAwait, "Wait for block placement confirmation", visibility = vis).group(groupPath)
override val maxPendingPlacements by c.setting("Max Pending Placements", 5, 0..30, 1, "The maximum amount of pending placements", visibility = vis).group(groupPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ object BuildSimulator {
val validHits = mutableListOf<CheckedHit>()
val blockedHits = mutableSetOf<Vec3d>()
val misses = mutableSetOf<Vec3d>()
val airPlace = placing && place.airPlace.isEnabled()
val airPlace = placing && place.airPlace.isEnabled

boxes.forEach { box ->
val refinedSides = if (interactionConfig.checkSideVisibility) {
Expand Down Expand Up @@ -396,13 +396,13 @@ object BuildSimulator {
if (!currentState.isReplaceable && !statePromoting) return acc

preProcessing.sides.forEach { neighbor ->
val hitPos = if (!place.airPlace.isEnabled() && (currentState.isEmpty || statePromoting))
val hitPos = if (!place.airPlace.isEnabled && (currentState.isEmpty || statePromoting))
pos.offset(neighbor)
else pos
val hitSide = neighbor.opposite

val voxelShape = blockState(hitPos).getOutlineShape(world, hitPos).let { outlineShape ->
if (!outlineShape.isEmpty || !place.airPlace.isEnabled()) outlineShape
if (!outlineShape.isEmpty || !place.airPlace.isEnabled) outlineShape
else VoxelShapes.fullCube()
}
if (voxelShape.isEmpty) return@forEach
Expand Down Expand Up @@ -433,10 +433,10 @@ object BuildSimulator {
val hit = if (interactionConfig.strictRayCast) {
val rayCast = newRotation.rayCast(interactionConfig.interactReach, eye)
when {
rayCast != null && (!place.airPlace.isEnabled() || eye distSq rayCast.pos <= distSquared) ->
rayCast != null && (!place.airPlace.isEnabled || eye distSq rayCast.pos <= distSquared) ->
rayCast.blockResult

place.airPlace.isEnabled() -> {
place.airPlace.isEnabled -> {
val hitVec = newRotation.castBox(box, interactionConfig.interactReach, eye)
BlockHitResult(hitVec, hitSide, hitPos, false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface PlaceConfig : RequestConfig {
val airPlace: AirPlaceMode
val axisRotateSetting: Boolean
val axisRotate
get() = rotateForPlace && airPlace.isEnabled() && axisRotateSetting
get() = rotateForPlace && airPlace.isEnabled && axisRotateSetting
val placeStageMask: Set<Event>
val placeConfirmationMode: PlaceConfirmationMode
val maxPendingPlacements: Int
Expand All @@ -46,7 +46,7 @@ interface PlaceConfig : RequestConfig {
Grim("Grim", "Use grim specific air placing.")
;

fun isEnabled() = this != None
val isEnabled get() = this != None
}

enum class PlaceConfirmationMode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ object PlaceManager : RequestHandler<PlaceRequest>(

private var shouldSneak = false
private val validSneak: (player: ClientPlayerEntity) -> Boolean =
{ player -> shouldSneak == player.isSneaking }
{ player -> !shouldSneak || player.isSneaking }

override val blockedPositions
get() = pendingActions.map { it.context.blockPos }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ import net.minecraft.util.math.BlockPos

data class PlaceRequest(
val contexts: Collection<PlaceContext>,
val pendingInteractions: MutableCollection<BuildContext>,
val build: BuildConfig,
val rotation: RotationConfig,
val hotbar: HotbarConfig,
val pendingInteractions: MutableCollection<BuildContext>,
val rotation: RotationConfig,
val onPlace: ((BlockPos) -> Unit)? = null
) : Request(), PlaceConfig by build.placing {
override val config = build.placing

override val done: Boolean
get() = runSafe {
contexts.all { it.expectedState.matches(blockState(it.blockPos)) }
Expand Down
Loading