@@ -44,127 +44,145 @@ public class Nuker extends Module {
44
44
.name ("shape" )
45
45
.description ("The shape of nuking algorithm." )
46
46
.defaultValue (Shape .Sphere )
47
- .build ());
47
+ .build ()
48
+ );
48
49
49
50
private final Setting <Nuker .Mode > mode = sgGeneral .add (new EnumSetting .Builder <Nuker .Mode >()
50
51
.name ("mode" )
51
52
.description ("The way the blocks are broken." )
52
53
.defaultValue (Nuker .Mode .Flatten )
53
- .build ());
54
+ .build ()
55
+ );
54
56
55
57
private final Setting <Double > range = sgGeneral .add (new DoubleSetting .Builder ()
56
58
.name ("range" )
57
59
.description ("The break range." )
58
60
.defaultValue (4 )
59
61
.min (0 )
60
62
.visible (() -> shape .get () != Shape .Cube )
61
- .build ());
63
+ .build ()
64
+ );
62
65
63
66
private final Setting <Integer > range_up = sgGeneral .add (new IntSetting .Builder ()
64
67
.name ("up" )
65
68
.description ("The break range." )
66
69
.defaultValue (1 )
67
70
.min (0 )
68
71
.visible (() -> shape .get () == Shape .Cube )
69
- .build ());
72
+ .build ()
73
+ );
70
74
71
75
private final Setting <Integer > range_down = sgGeneral .add (new IntSetting .Builder ()
72
76
.name ("down" )
73
77
.description ("The break range." )
74
78
.defaultValue (1 )
75
79
.min (0 )
76
80
.visible (() -> shape .get () == Shape .Cube )
77
- .build ());
81
+ .build ()
82
+ );
78
83
79
84
private final Setting <Integer > range_left = sgGeneral .add (new IntSetting .Builder ()
80
85
.name ("left" )
81
86
.description ("The break range." )
82
87
.defaultValue (1 )
83
88
.min (0 )
84
89
.visible (() -> shape .get () == Shape .Cube )
85
- .build ());
90
+ .build ()
91
+ );
86
92
87
93
private final Setting <Integer > range_right = sgGeneral .add (new IntSetting .Builder ()
88
94
.name ("right" )
89
95
.description ("The break range." )
90
96
.defaultValue (1 )
91
97
.min (0 )
92
98
.visible (() -> shape .get () == Shape .Cube )
93
- .build ());
99
+ .build ()
100
+ );
94
101
95
102
private final Setting <Integer > range_forward = sgGeneral .add (new IntSetting .Builder ()
96
103
.name ("forward" )
97
104
.description ("The break range." )
98
105
.defaultValue (1 )
99
106
.min (0 )
100
107
.visible (() -> shape .get () == Shape .Cube )
101
- .build ());
108
+ .build ()
109
+ );
102
110
103
111
private final Setting <Integer > range_back = sgGeneral .add (new IntSetting .Builder ()
104
112
.name ("back" )
105
113
.description ("The break range." )
106
114
.defaultValue (1 )
107
115
.min (0 )
108
116
.visible (() -> shape .get () == Shape .Cube )
109
- .build ());
117
+ .build ()
118
+ );
110
119
111
120
private final Setting <Integer > delay = sgGeneral .add (new IntSetting .Builder ()
112
121
.name ("delay" )
113
122
.description ("Delay in ticks between breaking blocks." )
114
123
.defaultValue (0 )
115
- .build ());
124
+ .build ()
125
+ );
116
126
117
127
private final Setting <Integer > maxBlocksPerTick = sgGeneral .add (new IntSetting .Builder ()
118
128
.name ("max-blocks-per-tick" )
119
129
.description ("Maximum blocks to try to break per tick. Useful when insta mining." )
120
130
.defaultValue (1 )
121
131
.min (1 )
122
132
.sliderRange (1 , 6 )
123
- .build ());
133
+ .build ()
134
+ );
124
135
125
136
private final Setting <Nuker .SortMode > sortMode = sgGeneral .add (new EnumSetting .Builder <Nuker .SortMode >()
126
137
.name ("sort-mode" )
127
138
.description ("The blocks you want to mine first." )
128
139
.defaultValue (Nuker .SortMode .Closest )
129
- .build ());
140
+ .build ()
141
+ );
130
142
131
143
private final Setting <Boolean > swingHand = sgGeneral .add (new BoolSetting .Builder ()
132
144
.name ("swing-hand" )
133
145
.description ("Swing hand client side." )
134
146
.defaultValue (true )
135
- .build ());
147
+ .build ()
148
+ );
136
149
137
150
private final Setting <Boolean > packetMine = sgGeneral .add (new BoolSetting .Builder ()
138
151
.name ("packet-mine" )
139
152
.description ("Attempt to instamine everything at once." )
140
153
.defaultValue (false )
141
- .build ());
154
+ .build ()
155
+ );
142
156
143
157
private final Setting <Boolean > rotate = sgGeneral .add (new BoolSetting .Builder ()
144
158
.name ("rotate" )
145
159
.description ("Rotates server-side to the block being mined." )
146
160
.defaultValue (true )
147
- .build ());
161
+ .build ()
162
+ );
148
163
149
164
// Whitelist and blacklist
150
165
151
166
private final Setting <ListMode > listMode = sgWhitelist .add (new EnumSetting .Builder <ListMode >()
152
167
.name ("list-mode" )
153
168
.description ("Selection mode." )
154
169
.defaultValue (ListMode .Blacklist )
155
- .build ());
170
+ .build ()
171
+ );
156
172
157
173
private final Setting <List <Block >> blacklist = sgWhitelist .add (new BlockListSetting .Builder ()
158
174
.name ("blacklist" )
159
175
.description ("The blocks you don't want to mine." )
160
176
.visible (() -> listMode .get () == ListMode .Blacklist )
161
- .build ());
177
+ .build ()
178
+ );
162
179
163
180
private final Setting <List <Block >> whitelist = sgWhitelist .add (new BlockListSetting .Builder ()
164
181
.name ("whitelist" )
165
182
.description ("The blocks you want to mine." )
166
183
.visible (() -> listMode .get () == ListMode .Whitelist )
167
- .build ());
184
+ .build ()
185
+ );
168
186
169
187
private Block autoSelectBlock = null ; // Internal field to store the selected block for AutoSelect mode
170
188
@@ -174,52 +192,60 @@ public class Nuker extends Module {
174
192
.name ("bounding-box" )
175
193
.description ("Enable rendering bounding box for Cube and Uniform Cube." )
176
194
.defaultValue (true )
177
- .build ());
195
+ .build ()
196
+ );
178
197
179
198
private final Setting <ShapeMode > shapeModeBox = sgRender .add (new EnumSetting .Builder <ShapeMode >()
180
199
.name ("nuke-box-mode" )
181
200
.description ("How the shape for the bounding box is rendered." )
182
201
.defaultValue (ShapeMode .Both )
183
- .build ());
202
+ .build ()
203
+ );
184
204
185
205
private final Setting <SettingColor > sideColorBox = sgRender .add (new ColorSetting .Builder ()
186
206
.name ("side-color" )
187
207
.description ("The side color of the bounding box." )
188
208
.defaultValue (new SettingColor (16 , 106 , 144 , 100 ))
189
- .build ());
209
+ .build ()
210
+ );
190
211
191
212
private final Setting <SettingColor > lineColorBox = sgRender .add (new ColorSetting .Builder ()
192
213
.name ("line-color" )
193
214
.description ("The line color of the bounding box." )
194
215
.defaultValue (new SettingColor (16 , 106 , 144 , 255 ))
195
- .build ());
216
+ .build ()
217
+ );
196
218
197
219
private final Setting <Boolean > enableRenderBreaking = sgRender .add (new BoolSetting .Builder ()
198
220
.name ("broken-blocks" )
199
221
.description ("Enable rendering bounding box for Cube and Uniform Cube." )
200
222
.defaultValue (true )
201
- .build ());
223
+ .build ()
224
+ );
202
225
203
226
private final Setting <ShapeMode > shapeModeBreak = sgRender .add (new EnumSetting .Builder <ShapeMode >()
204
227
.name ("nuke-block-mode" )
205
228
.description ("How the shapes for broken blocks are rendered." )
206
229
.defaultValue (ShapeMode .Both )
207
230
.visible (enableRenderBreaking ::get )
208
- .build ());
231
+ .build ()
232
+ );
209
233
210
234
private final Setting <SettingColor > sideColor = sgRender .add (new ColorSetting .Builder ()
211
235
.name ("side-color" )
212
236
.description ("The side color of the target block rendering." )
213
237
.defaultValue (new SettingColor (255 , 0 , 0 , 80 ))
214
238
.visible (enableRenderBreaking ::get )
215
- .build ());
239
+ .build ()
240
+ );
216
241
217
242
private final Setting <SettingColor > lineColor = sgRender .add (new ColorSetting .Builder ()
218
243
.name ("line-color" )
219
244
.description ("The line color of the target block rendering." )
220
245
.defaultValue (new SettingColor (255 , 0 , 0 , 255 ))
221
246
.visible (enableRenderBreaking ::get )
222
- .build ());
247
+ .build ()
248
+ );
223
249
224
250
private final List <BlockPos > blocks = new ArrayList <>();
225
251
@@ -274,8 +300,7 @@ private void onRender(Render3DEvent event) {
274
300
int maxX = Math .max (pos1 .getX (), pos2 .getX ());
275
301
int maxY = Math .max (pos1 .getY (), pos2 .getY ());
276
302
int maxZ = Math .max (pos1 .getZ (), pos2 .getZ ());
277
- event .renderer .box (minX , minY , minZ , maxX , maxY , maxZ , sideColorBox .get (), lineColorBox .get (),
278
- shapeModeBox .get (), 0 );
303
+ event .renderer .box (minX , minY , minZ , maxX , maxY , maxZ , sideColorBox .get (), lineColorBox .get (), shapeModeBox .get (), 0 );
279
304
}
280
305
}
281
306
}
@@ -295,8 +320,7 @@ private void onTickPre(TickEvent.Pre event) {
295
320
296
321
double rangeSq = Math .pow (range .get (), 2 );
297
322
298
- if (shape .get () == Shape .UniformCube )
299
- range .set ((double ) Math .round (range .get ()));
323
+ if (shape .get () == Shape .UniformCube ) range .set ((double ) Math .round (range .get ()));
300
324
301
325
// Some render stuff
302
326
@@ -322,28 +346,24 @@ private void onTickPre(TickEvent.Pre event) {
322
346
case 0 -> {
323
347
pZ_ += 1 ;
324
348
pX_ += 1 ;
325
- pos1 .set (pX_ - (range_right .get () + 1 ), Math .ceil (pY ) - range_down .get (),
326
- pZ_ - (range_back .get () + 1 )); // down
349
+ pos1 .set (pX_ - (range_right .get () + 1 ), Math .ceil (pY ) - range_down .get (), pZ_ - (range_back .get () + 1 )); // down
327
350
pos2 .set (pX_ + range_left .get (), Math .ceil (pY + range_up .get () + 1 ), pZ_ + range_forward .get ()); // up
328
351
}
329
352
case 2 -> {
330
353
pX_ += 1 ;
331
354
pZ_ += 1 ;
332
- pos1 .set (pX_ - (range_left .get () + 1 ), Math .ceil (pY ) - range_down .get (),
333
- pZ_ - (range_forward .get () + 1 )); // down
355
+ pos1 .set (pX_ - (range_left .get () + 1 ), Math .ceil (pY ) - range_down .get (), pZ_ - (range_forward .get () + 1 )); // down
334
356
pos2 .set (pX_ + range_right .get (), Math .ceil (pY + range_up .get () + 1 ), pZ_ + range_back .get ()); // up
335
357
}
336
358
case 3 -> {
337
359
pX_ += 1 ;
338
360
pos1 .set (pX_ - (range_back .get () + 1 ), Math .ceil (pY ) - range_down .get (), pZ_ - range_left .get ()); // down
339
- pos2 .set (pX_ + range_forward .get (), Math .ceil (pY + range_up .get () + 1 ),
340
- pZ_ + range_right .get () + 1 ); // up
361
+ pos2 .set (pX_ + range_forward .get (), Math .ceil (pY + range_up .get () + 1 ), pZ_ + range_right .get () + 1 ); // up
341
362
}
342
363
}
343
364
344
365
// get largest horizontal
345
- maxh = 1 + Math .max (Math .max (Math .max (range_back .get (), range_right .get ()), range_forward .get ()),
346
- range_left .get ());
366
+ maxh = 1 + Math .max (Math .max (Math .max (range_back .get (), range_right .get ()), range_forward .get ()), range_left .get ());
347
367
maxv = 1 + Math .max (range_up .get (), range_down .get ());
348
368
}
349
369
@@ -411,17 +431,15 @@ private void onTickPre(TickEvent.Pre event) {
411
431
if (sortMode .get () == SortMode .TopDown )
412
432
blocks .sort (Comparator .comparingDouble (value -> -value .getY ()));
413
433
else if (sortMode .get () != SortMode .None )
414
- blocks .sort (Comparator .comparingDouble (value -> Utils .squaredDistance (pX , pY , pZ , value .getX () + 0.5 ,
415
- value .getY () + 0.5 , value .getZ () + 0.5 ) * (sortMode .get () == SortMode .Closest ? 1 : -1 )));
434
+ blocks .sort (Comparator .comparingDouble (value -> Utils .squaredDistance (pX , pY , pZ , value .getX () + 0.5 , value .getY () + 0.5 , value .getZ () + 0.5 ) * (sortMode .get () == SortMode .Closest ? 1 : -1 )));
416
435
417
436
// Check if some block was found
418
437
if (blocks .isEmpty ()) {
419
- // If no block was found for long enough then set firstBlock flag to true to not
420
- // wait before breaking another again
421
- if (noBlockTimer ++ >= delay .get ())
422
- firstBlock = true ;
438
+ // If no block was found for long enough then set firstBlock flag to true to not wait before breaking another again
439
+ if (noBlockTimer ++ >= delay .get ()) firstBlock = true ;
423
440
return ;
424
- } else {
441
+ }
442
+ else {
425
443
noBlockTimer = 0 ;
426
444
}
427
445
@@ -432,34 +450,25 @@ else if (sortMode.get() != SortMode.None)
432
450
firstBlock = false ;
433
451
lastBlockPos .set (blocks .getFirst ());
434
452
435
- if (timer > 0 )
436
- return ;
453
+ if (timer > 0 ) return ;
437
454
}
438
455
439
456
// Break
440
457
int count = 0 ;
441
458
442
459
for (BlockPos block : blocks ) {
443
- if (count >= maxBlocksPerTick .get ())
444
- break ;
460
+ if (count >= maxBlocksPerTick .get ()) break ;
445
461
446
462
boolean canInstaMine = BlockUtils .canInstaBreak (block );
447
463
448
- if (rotate .get ())
449
- Rotations .rotate (Rotations .getYaw (block ), Rotations .getPitch (block ), () -> breakBlock (block ));
450
- else
451
- breakBlock (block );
464
+ if (rotate .get ()) Rotations .rotate (Rotations .getYaw (block ), Rotations .getPitch (block ), () -> breakBlock (block ));
465
+ else breakBlock (block );
452
466
453
- if (enableRenderBreaking .get ())
454
- RenderUtils .renderTickingBlock (block , sideColor .get (), lineColor .get (), shapeModeBreak .get (), 0 , 8 ,
455
- true , false );
467
+ if (enableRenderBreaking .get ()) RenderUtils .renderTickingBlock (block , sideColor .get (), lineColor .get (), shapeModeBreak .get (), 0 , 8 , true , false );
456
468
lastBlockPos .set (block );
457
469
458
470
count ++;
459
- if (!canInstaMine && !packetMine .get () /*
460
- * With packet mine attempt to break everything possible at once
461
- */ )
462
- break ;
471
+ if (!canInstaMine && !packetMine .get () /* With packet mine attempt to break everything possible at once */ ) break ;
463
472
}
464
473
465
474
firstBlock = false ;
@@ -471,11 +480,9 @@ else if (sortMode.get() != SortMode.None)
471
480
472
481
private void breakBlock (BlockPos blockPos ) {
473
482
if (packetMine .get ()) {
474
- mc .getNetworkHandler ().sendPacket (new PlayerActionC2SPacket (
475
- PlayerActionC2SPacket .Action .START_DESTROY_BLOCK , blockPos , BlockUtils .getDirection (blockPos )));
483
+ mc .getNetworkHandler ().sendPacket (new PlayerActionC2SPacket (PlayerActionC2SPacket .Action .START_DESTROY_BLOCK , blockPos , BlockUtils .getDirection (blockPos )));
476
484
mc .player .swingHand (Hand .MAIN_HAND );
477
- mc .getNetworkHandler ().sendPacket (new PlayerActionC2SPacket (PlayerActionC2SPacket .Action .STOP_DESTROY_BLOCK ,
478
- blockPos , BlockUtils .getDirection (blockPos )));
485
+ mc .getNetworkHandler ().sendPacket (new PlayerActionC2SPacket (PlayerActionC2SPacket .Action .STOP_DESTROY_BLOCK , blockPos , BlockUtils .getDirection (blockPos )));
479
486
} else {
480
487
BlockUtils .breakBlock (blockPos , swingHand .get ());
481
488
}
0 commit comments