Fixed Painter performance

This commit is contained in:
cattyngmd
2022-11-20 12:00:30 +03:00
committed by Cloudburst
parent c4f4539a87
commit 64933773a7

View File

@@ -42,6 +42,14 @@ public class Painter extends Module {
.build() .build()
); );
private final Setting<Integer> bpt = sgGeneral.add(new IntSetting.Builder()
.name("blocks-per-tick")
.description("Amount of blocks that can be placed in one tick")
.min(1)
.defaultValue(1)
.build()
);
private final Setting<Boolean> rotate = sgGeneral.add(new BoolSetting.Builder() private final Setting<Boolean> rotate = sgGeneral.add(new BoolSetting.Builder()
.name("rotate") .name("rotate")
.description("Whether or not to rotate towards block while placing") .description("Whether or not to rotate towards block while placing")
@@ -77,7 +85,6 @@ public class Painter extends Module {
.build() .build()
); );
private ArrayList<BlockPos> positions = new ArrayList<>();
private int ticksWaited; private int ticksWaited;
public Painter() { public Painter() {
@@ -102,16 +109,15 @@ public class Painter extends Module {
} }
// Find spots // Find spots
int placed = 0;
for (BlockPos blockPos : WorldUtils.getSphere(mc.player.getBlockPos(), range.get(), range.get())) { for (BlockPos blockPos : WorldUtils.getSphere(mc.player.getBlockPos(), range.get(), range.get())) {
if (shouldPlace(blockPos, block.get())) positions.add(blockPos); if (shouldPlace(blockPos, block.get())) {
} BlockUtils.place(blockPos, findItemResult, rotate.get(), -100, false);
placed++;
// Place // Delay 0
for (BlockPos blockPos : positions) { if (delay.get() != 0 && placed >= bpt.get()) break;
BlockUtils.place(blockPos, findItemResult, rotate.get(), -100, false); }
// Delay 0
if (delay.get() != 0) break;
} }
} }