Skip to content

Commit 0d57201

Browse files
committed
use sequences in the breakContexts function to limit collection creation and population spam
1 parent 05afa47 commit 0d57201

File tree

1 file changed

+3
-0
lines changed
  • common/src/main/kotlin/com/lambda/module/modules/player

1 file changed

+3
-0
lines changed

common/src/main/kotlin/com/lambda/module/modules/player/PacketMine.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,15 @@ object PacketMine : Module(
191191

192192
private fun SafeContext.breakContexts(positions: Collection<BlockPos?>) =
193193
positions
194+
.asSequence()
194195
.filterNotNull()
195196
.associateWith { TargetState.State(blockState(it).fluidState.blockState) }
196197
.toBlueprint()
197198
.simulate(player.eyePos, interact, rotation, inventory, build)
199+
.asSequence()
198200
.filterIsInstance<BreakResult.Break>()
199201
.map { it.context }
202+
.toCollection(mutableListOf())
200203

201204
private fun addBreak(pos: BlockPos) {
202205
if (breakConfig.doubleBreak && breakPositions[0] != null) {

0 commit comments

Comments
 (0)