NukerModule: Creative nuker mode now only allowed in creative

This commit is contained in:
noil 2020-12-28 18:40:03 -05:00
parent b735d7d9e5
commit b8b5e08bfc
1 changed files with 30 additions and 28 deletions

View File

@ -71,38 +71,40 @@ public final class NukerModule extends Module {
pos = this.getClosestBlock(false); pos = this.getClosestBlock(false);
break; break;
case CREATIVE: case CREATIVE:
/* the amazing creative nuker straight from the latch hacked client */ if (mc.player.capabilities.isCreativeMode) {
for (double y = Math.round(mc.player.posY - 1) + this.vDistance.getValue(); y > Math.round(mc.player.posY - 1); y -= 1.0D) { /* the amazing creative 'nuker' straight from the latch hacked client */
for (double x = mc.player.posX - this.hDistance.getValue(); x < mc.player.posX + this.hDistance.getValue(); x += 1.0D) { for (double y = Math.round(mc.player.posY - 1) + this.vDistance.getValue(); y > Math.round(mc.player.posY - 1); y -= 1.0D) {
for (double z = mc.player.posZ - this.hDistance.getValue(); z < mc.player.posZ + this.hDistance.getValue(); z += 1.0D) { for (double x = mc.player.posX - this.hDistance.getValue(); x < mc.player.posX + this.hDistance.getValue(); x += 1.0D) {
final BlockPos blockPos = new BlockPos(x, y, z); for (double z = mc.player.posZ - this.hDistance.getValue(); z < mc.player.posZ + this.hDistance.getValue(); z += 1.0D) {
final Block block = BlockUtil.getBlock(blockPos); final BlockPos blockPos = new BlockPos(x, y, z);
if (block == Blocks.AIR || !mc.world.getBlockState(blockPos).isFullBlock()) final Block block = BlockUtil.getBlock(blockPos);
continue; if (block == Blocks.AIR || !mc.world.getBlockState(blockPos).isFullBlock())
final Vec3d eyesPos = new Vec3d(mc.player.posX, mc.player.posY + mc.player.getEyeHeight(), mc.player.posZ);
final Vec3d posVec = new Vec3d(blockPos).add(0.5f, 0.5f, 0.5f);
double distanceSqPosVec = eyesPos.squareDistanceTo(posVec);
for (EnumFacing side : EnumFacing.values()) {
final Vec3d hitVec = posVec.add(new Vec3d(side.getDirectionVec()).scale(0.5f));
double distanceSqHitVec = eyesPos.squareDistanceTo(hitVec);
// check if hitVec is within range (6 blocks)
if (distanceSqHitVec > 36)
continue; continue;
// check if side is facing towards player final Vec3d eyesPos = new Vec3d(mc.player.posX, mc.player.posY + mc.player.getEyeHeight(), mc.player.posZ);
if (distanceSqHitVec >= distanceSqPosVec) final Vec3d posVec = new Vec3d(blockPos).add(0.5f, 0.5f, 0.5f);
continue; double distanceSqPosVec = eyesPos.squareDistanceTo(posVec);
// face block for (EnumFacing side : EnumFacing.values()) {
final float[] rotations = EntityUtil.getRotations(hitVec.x, hitVec.y, hitVec.z); final Vec3d hitVec = posVec.add(new Vec3d(side.getDirectionVec()).scale(0.5f));
Seppuku.INSTANCE.getRotationManager().setPlayerRotations(rotations[0], rotations[1]); double distanceSqHitVec = eyesPos.squareDistanceTo(hitVec);
// damage block // check if hitVec is within range (6 blocks)
if (mc.playerController.onPlayerDamageBlock(blockPos, side)) { if (distanceSqHitVec > 36)
mc.player.swingArm(EnumHand.MAIN_HAND); continue;
// check if side is facing towards player
if (distanceSqHitVec >= distanceSqPosVec)
continue;
// face block
final float[] rotations = EntityUtil.getRotations(hitVec.x, hitVec.y, hitVec.z);
Seppuku.INSTANCE.getRotationManager().setPlayerRotations(rotations[0], rotations[1]);
// damage block
if (mc.playerController.onPlayerDamageBlock(blockPos, side)) {
mc.player.swingArm(EnumHand.MAIN_HAND);
}
} }
} }
} }