@@ -355,13 +355,17 @@ object BuildSimulator {
355355
356356 val adjacentLiquids = Direction .entries.filter {
357357 it != Direction .DOWN && ! pos.offset(it).blockState(world).fluidState.isEmpty
358- }
358+ }.map { pos.offset(it) }
359359
360360 /* block has liquids next to it that will leak when broken */
361361 if (adjacentLiquids.isNotEmpty()) {
362362 acc.add(BreakResult .BlockedByLiquid (pos, state))
363- adjacentLiquids.forEach {
364- val submerge = checkPlaceResults(pos.offset(it), TargetState .Solid , eye, interact, rotation, inventory)
363+ adjacentLiquids.forEach { liquidPos ->
364+ val submerge = if (liquidPos.blockState(world).isReplaceable) {
365+ checkPlaceResults(liquidPos, TargetState .Solid , eye, interact, rotation, inventory)
366+ } else {
367+ checkBreakResults(liquidPos, eye, interact, rotation, inventory, build)
368+ }
365369 acc.addAll(submerge)
366370 }
367371 return acc
@@ -388,6 +392,11 @@ object BuildSimulator {
388392 val verify: CheckedHit .() -> Boolean = {
389393 hit.blockResult?.blockPos == pos
390394 }
395+ val targetState = if (! state.fluidState.isEmpty) {
396+ TargetState .State (state.fluidState.blockState)
397+ } else {
398+ TargetState .Air
399+ }
391400
392401 /* the player is buried inside the block */
393402 if (boxes.any { it.contains(eye) }) {
@@ -396,7 +405,7 @@ object BuildSimulator {
396405 lookAtBlock(pos, config = interact), rotation
397406 )
398407 val breakContext = BreakContext (
399- eye, blockHit, rotationRequest, state, player.activeHand, instantBreakable(state, pos)
408+ eye, blockHit, rotationRequest, state, targetState, player.activeHand, instantBreakable(state, pos)
400409 )
401410 acc.add(BreakResult .Break (pos, breakContext))
402411 return acc
@@ -440,7 +449,13 @@ object BuildSimulator {
440449 val blockHit = checkedHit.hit.blockResult ? : return @let
441450
442451 val breakContext = BreakContext (
443- eye, blockHit, RotationRequest (lookAt(checkedHit.targetRotation, 0.001 ), rotation), state, player.activeHand, instantBreakable(state, pos)
452+ eye,
453+ blockHit,
454+ RotationRequest (lookAt(checkedHit.targetRotation, 0.001 ), rotation),
455+ state,
456+ targetState,
457+ player.activeHand,
458+ instantBreakable(state, pos)
444459 )
445460
446461 /* player has a better tool for the job available */
0 commit comments