|
27 | 27 | import meteordevelopment.orbit.EventHandler; |
28 | 28 | import meteordevelopment.orbit.EventPriority; |
29 | 29 | import net.minecraft.block.Block; |
| 30 | +import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket; |
30 | 31 | import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; |
31 | 32 | import net.minecraft.util.Hand; |
32 | 33 | import net.minecraft.util.math.Direction; |
@@ -157,13 +158,6 @@ public class Nuker extends Module { |
157 | 158 | .build() |
158 | 159 | ); |
159 | 160 |
|
160 | | - private final Setting<Boolean> swingHand = sgGeneral.add(new BoolSetting.Builder() |
161 | | - .name("swing-hand") |
162 | | - .description("Swing hand client side.") |
163 | | - .defaultValue(true) |
164 | | - .build() |
165 | | - ); |
166 | | - |
167 | 161 | private final Setting<Boolean> packetMine = sgGeneral.add(new BoolSetting.Builder() |
168 | 162 | .name("packet-mine") |
169 | 163 | .description("Attempt to instamine everything at once.") |
@@ -224,6 +218,13 @@ public class Nuker extends Module { |
224 | 218 |
|
225 | 219 | // Rendering |
226 | 220 |
|
| 221 | + private final Setting<Boolean> swing = sgRender.add(new BoolSetting.Builder() |
| 222 | + .name("swing") |
| 223 | + .description("Whether to swing hand client-side.") |
| 224 | + .defaultValue(true) |
| 225 | + .build() |
| 226 | + ); |
| 227 | + |
227 | 228 | private final Setting<Boolean> enableRenderBounding = sgRender.add(new BoolSetting.Builder() |
228 | 229 | .name("bounding-box") |
229 | 230 | .description("Enable rendering bounding box for Cube and Uniform Cube.") |
@@ -485,15 +486,18 @@ else if (sortMode.get() != SortMode.None) |
485 | 486 | private void breakBlock(BlockPos blockPos) { |
486 | 487 | if (interact.get()) { |
487 | 488 | // Interact mode |
488 | | - BlockUtils.interact(new BlockHitResult(blockPos.toCenterPos(), BlockUtils.getDirection(blockPos), blockPos, true), Hand.MAIN_HAND, swingHand.get()); |
| 489 | + BlockUtils.interact(new BlockHitResult(blockPos.toCenterPos(), BlockUtils.getDirection(blockPos), blockPos, true), Hand.MAIN_HAND, swing.get()); |
489 | 490 | } else if (packetMine.get()) { |
490 | 491 | // Packet mine mode |
491 | 492 | mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, blockPos, BlockUtils.getDirection(blockPos))); |
492 | | - mc.player.swingHand(Hand.MAIN_HAND); |
| 493 | + |
| 494 | + if (swing.get()) mc.player.swingHand(Hand.MAIN_HAND); |
| 495 | + else mc.getNetworkHandler().sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND)); |
| 496 | + |
493 | 497 | mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, blockPos, BlockUtils.getDirection(blockPos))); |
494 | 498 | } else { |
495 | 499 | // Legit mine mode |
496 | | - BlockUtils.breakBlock(blockPos, swingHand.get()); |
| 500 | + BlockUtils.breakBlock(blockPos, swing.get()); |
497 | 501 | } |
498 | 502 | } |
499 | 503 |
|
|
0 commit comments