Skip to content

Commit 59cead9

Browse files
committed
inline block item getPlacementContext
1 parent 62ed335 commit 59cead9

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

src/main/kotlin/com/lambda/interaction/construction/result/results/PlaceResult.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ sealed class PlaceResult : BuildResult() {
151151
* @property simulated The context of the simulated item placement attempt.
152152
*/
153153
data class ScaffoldExceeded(
154-
override val pos: BlockPos,
155-
val simulated: ItemPlacementContext,
154+
override val pos: BlockPos
156155
) : PlaceResult() {
157156
override val rank = Rank.PlaceScaffoldExceeded
158157
}

src/main/kotlin/com/lambda/interaction/construction/simulation/checks/PlaceSim.kt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,18 @@ class PlaceSim private constructor(simInfo: ISimInfo)
154154
buildConfig.pointSelection.select(validHits)?.let { checkedHit ->
155155
val hitResult = checkedHit.hit.blockResult ?: return
156156

157-
var context = ItemPlacementContext(
158-
world,
159-
fakePlayer,
160-
Hand.MAIN_HAND,
161-
swapStack,
162-
hitResult,
163-
)
157+
val context = swapStack.blockItem.getPlacementContext(
158+
ItemPlacementContext(
159+
world,
160+
fakePlayer,
161+
Hand.MAIN_HAND,
162+
swapStack,
163+
hitResult,
164+
)
165+
) ?: run {
166+
result(PlaceResult.ScaffoldExceeded(pos))
167+
return
168+
}
164169

165170
if (context.blockPos != pos) {
166171
result(PlaceResult.UnexpectedPosition(pos, context.blockPos))
@@ -178,11 +183,6 @@ class PlaceSim private constructor(simInfo: ISimInfo)
178183
return
179184
}
180185

181-
context = swapStack.blockItem.getPlacementContext(context) ?: run {
182-
result(PlaceResult.ScaffoldExceeded(pos, context))
183-
return
184-
}
185-
186186
val rotatePlaceTest = simRotatePlace(fakePlayer, checkedHit, context) ?: return
187187

188188
val rotationRequest = if (placeConfig.axisRotate) {

0 commit comments

Comments
 (0)