Skip to content

Commit 08859f6

Browse files
committed
Place fixes
1 parent f280938 commit 08859f6

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

common/src/main/kotlin/com/lambda/module/modules/debug/BuildTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ object BuildTest : Module(
1717
onEnable {
1818
buildStructure {
1919
player.blockPos
20-
.offset(player.horizontalFacing)
21-
.offset(player.horizontalFacing)
20+
.offset(player.horizontalFacing, 2)
2221
.toStructure(TargetState.Block(Blocks.NETHERRACK))
2322
.toBlueprint()
2423
}.start(null)

common/src/main/kotlin/com/lambda/task/tasks/BuildStructure.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ class BuildStructure(
171171
val neighPos = pos.offset(neighbor)
172172
val hitSide = neighbor.opposite
173173

174-
val voxelShape = neighPos.blockState(world).getOutlineShape(world, pos)
175-
val boxes = voxelShape.boundingBoxes.map { it.offset(pos) }
174+
val voxelShape = neighPos.blockState(world).getOutlineShape(world, neighPos)
175+
val boxes = voxelShape.boundingBoxes.map { it.offset(neighPos) }
176176
val verify: HitResult.() -> Boolean = {
177177
blockResult?.blockPos == neighPos && blockResult?.side == hitSide
178178
}

common/src/main/kotlin/com/lambda/task/tasks/PlaceBlock.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.lambda.task.tasks
33
import com.lambda.Lambda.LOG
44
import com.lambda.context.SafeContext
55
import com.lambda.event.events.RotationEvent
6+
import com.lambda.event.events.TickEvent
67
import com.lambda.event.listener.SafeListener.Companion.listener
78
import com.lambda.interaction.construction.context.PlaceContext
89
import com.lambda.task.Task
@@ -49,7 +50,8 @@ class PlaceBlock @Ta5kBuilder constructor(
4950
ctx.result
5051
)
5152

52-
if (actionResult.isAccepted) {
53+
val match = ctx.targetState.matches(ctx.resultingPos.blockState(world), ctx.resultingPos, world)
54+
if (actionResult.isAccepted && match) {
5355
if (actionResult.shouldSwingHand() && swingHand) {
5456
player.swingHand(ctx.hand)
5557
}
@@ -58,6 +60,8 @@ class PlaceBlock @Ta5kBuilder constructor(
5860
if (!player.getStackInHand(ctx.hand).isEmpty && interaction.hasCreativeInventory()) {
5961
mc.gameRenderer.firstPersonRenderer.resetEquipProgress(ctx.hand)
6062
}
63+
64+
success(Unit)
6165
} else {
6266
failure("Failed to place block as simulation does not match actual result $actionResult")
6367
}

0 commit comments

Comments
 (0)